push content into a zone

Topics: General
Oct 26, 2012 at 3:16 PM

 

I would like to get the following effect on the NotFound.cshtml shape which is basically 2 elements:

<h1>@Html.TitleForPage(T("Not found").ToString())</h1>
<p>@T("The page you are looking for does not exist.")</p>

is it possible to push the <h1> element into the "Featured Zone" whilst the <p> element on the second line stays in the standard "Content Zone"?

I've been looking for this on the forum and found several things like pushing parts and fields in different zones based on the placement instructions. however, this is.

I'm more of a designer than a developer and I haven't quiet figured out the theory of zones, shapes, clay, etc.

Developer
Oct 26, 2012 at 6:13 PM
Edited Oct 26, 2012 at 6:15 PM

Try this:

  1. Create a new template called "NotFoundTitle.cshtml" and paste the <h1> element stuff in there.
  2. In "NotFound.cshtml", replace the <h1> element with a call to @Display.NotFoundTitle()

Should work. Unless it doesn't.

Developer
Oct 26, 2012 at 6:17 PM

Correcting the previous post. Please replace point 2 with:

2. In "NotFound.cshtml", replace the <h1> element with a call to @Layout.FeaturedZone.Add(New.NotFoundTitle()), provided that the "Featured Zone" is called "FeaturedZone".

Oct 26, 2012 at 9:19 PM
Edited Oct 26, 2012 at 9:19 PM

That's working great. 

I've done another attempt to read the docs about shapes. So, let me see if I got this. The "NotFoundTitle.cshtml" is a  shape template and with the razor syntax New.NotFoundTitle() I make an instance of the shape? Then using Layout.FeaturedZone.Add() call I can place this new shape on the FeaturedZone.

(learning mode here :) )

There just one more thing I would like to ask.

On the place where I wrote the "@Layout.FeaturedZone.Add(New.NotFoundTitle())" in the NotFound.cshtml I now get "ZoneProxyf279106ea716454186997daa4b3c23cd" in the html output, is this something I can suppress?

Developer
Oct 26, 2012 at 10:09 PM

You got it exactly right.

To remove that "ZoneProxyf279106ea716454186997daa4b3c23cd" output, change this:

@Layout.FeaturedZone.Add(New.NotFoundTitle())

to this:

@{ Layout.FeaturedZone.Add(New.NotFoundTitle());  }

 

Oct 26, 2012 at 10:17 PM

super., tyvm m8 :)

I'm back on my way in creating my second Orchard site.

 

Developer
Oct 27, 2012 at 12:57 AM

Excellent. Keep those sites coming!