Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Candice 14 posts 34 karma points
    Sep 26, 2010 @ 03:01
    Candice
    0

    templates, doctypes and inheritance

    Hello,

     I'm creating a rather simple site but (since I'm still a newbie) I am having trouble understanding whether I should be inheriting with templates or doctypes. Here is what I'm having trouble with:

    1) On the left side of every page in the site, I want to have 3 text areas that always show the same content. I.E., sidetextarea 1 = "here is sidetext area1"; sidetextarea2 = "here is sidetextarea2" and sidetextarea3 = "here is sidetextarea3". I want it to be whatever the admin types in there, and be the same on every page. How do I get each page to inherit that text area with the content in it so that it only needs to be typed into one place?

    2) On the Home page, I want to have 2 Main Content areas, but on all other pages, I only want to have 1 Main Content area. How do I prevent the 2nd Main Content area from appearing on my other pages?

    Thanks very much.

    Candice

     

  • Rich Green 2246 posts 4008 karma points
    Sep 26, 2010 @ 10:05
    Rich Green
    1

    Hi Candice,

    Ensure you have a 'Home' doc type with one content area as you need, then create another doc type named something like "content" this will have 2 content areas.

    In the 'Home' doctype click the 'structure' tab and make sure you allow the 'content' doc type as a child.

    Then create your structure like this:

    Home

    - Page with two content areas

    - Another Page with two content areas

    You will need two sepearate templates to ensure you have a different homepage, one for home and one for content.

    With regards to the side area text, add the following properties to your homepage doc type, "sidetextarea1", "sidetextarea2", "sideareatext3"

    You can then use these in your template, note the recursive="true" attribute, this means this will work from any page in your site.

    <umbraco:Item field="sidetextarea1" recursive="true" runat="server"></umbraco:Item>
    
    <umbraco:Item field="sidetextarea3" recursive="true" runat="server"></umbraco:Item>
    
    <umbraco:Item field="sidetextarea3" recursive="true" runat="server"></umbraco:Item>

    Best of luck

    Rich

  • Candice 14 posts 34 karma points
    Sep 26, 2010 @ 19:13
    Candice
    0

    Thank you, Rich, your post was very helpful. I think you were giving me instructions for the homepage having 1 content area and the other pages having 2 content areas?...I am looking to do the opposite, but no worries - I just flipped your instructions around and I have it working now. For anyone else wondering how to do this, here is what I have:  I have 2 templates: Master_Template_1Content and Master_Template_2Content. ( These both list the Sidetext areas - not sure if I am doing this correctly since the sidetext code is now repeated in 2 templates, but at least it is working.) I also have 2 doctypes: Content_DocType_1area and Content_DocType_2area, and then correspond to the Master Templates. My Home pate is a Master_Template_1Content and my other pages are all Master_Template_2Content.

    The "recursive=true" in my MasterTemplates for the 3 sidetext areas did the trick for me.

    thanks for your help!

    Candice

Please Sign in or register to post replies

Write your reply to:

Draft