0
votes

I'm new to Orchard CMS, and have mostly been dealing with creating a custom theme so far. I've run across an issue and I'm not sure I even know the right concepts yet for what I want to do... but here goes:

I would like to do the following:

  • Add a custom field to the "Page" content type, called "Parent Title."
  • On all pages, display the content of the Parent Title field inside the "Before Main" widget zone.

So an author who creates a new page in the CMS will fill out the fields, for example:

  • Page Title: "Company ABC is Hiring"
  • Parent Title: "Careers at Company ABC"
  • etc.

And the rendered markup from Orchard will look something like this (slightly simplified for brevity):

<div id="layout-before-main">
    <div class="zone zone-before-main">
        Careers at Company ABC
    </div>
</div>
...
<div id="content">
    <div class="zone zone-content">
        <article class="page content-item">
            <header><h1>Company ABC is Hiring</h1></header>

            <p>Some page content.</p>
        </article>
    </div>
</div>

I know how to create the custom field; what I don't know is how (or whether) it's possible to put a reference to that field's value inside another zone.

Any advice is appreciated - I am eager to learn!

1

1 Answers

3
votes

Is there any reason why you would want to place it in a separate widget? You can just use placement.info for this functionality.

Say you have a TextField attached to the Page content type that is named "ParentTitle". Your placement.info would then look like the following:

<Placement>
    <Match ContentType="Page">
        <Place Fields_Common_Text-ParentTitle="/BeforeMain:5" />
    </Match>
</Placement>

Notice the preceding slash at the BeforeMain. The preceding slash means that it targets a global zone (a layout zone).

If you want to get a grasp on placement.info and which fields/names you should target, enable the module "Shape Tracing". This enables you to look at the fields on the frontend and see which id's to target.

You can read the following articles to understand what is going on:

http://docs.orchardproject.net/Documentation/Customizing-Orchard-using-Designer-Helper-Tools

http://docs.orchardproject.net/Documentation/Understanding-placement-info