Copied to clipboard

Flag this post as spam?

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


  • MartinB 411 posts 512 karma points
    May 16, 2010 @ 04:06
    MartinB
    0

    Site with comprehensive menu

    Hi

    I'm building a site with a menusystem like this:

    Front page

    Section picker (dropdown)

       - Sections (listed in dropdown)

           - Sections submenu

    The section picker is one item/link that holds x children in a dropdown menu.

    How should i build my content and templates? Should i put the Sections out below "Content", or should i do it like:

    Content

      - Sections

         - Menus

    The reason i ask is because i've run into trouble with the templates. All the sections will have nearly identical layout, but different logos and maybe different body backgrounds. Somehow i can't seem to choose between different textpage templates when adding new submenus as it seems that one of my "section Textpage" is now the default for that whole section.

    Shouldn't i be able to select between all of the textpage templates i made, regardless of which section i add submenus for?

    I hope it makes sense, i'm a bit tired :)

     

  • MartinB 411 posts 512 karma points
    May 16, 2010 @ 15:01
    MartinB
    0

    Ok it seems i got my head wrapper around the template concept all wrong.

    It seems that for a site with many sub sections, that runs on the same layout, but needs to have different logos, fading images etc, you simply just use the contentPlaceholder tag to fetch that content from the sub masterpages.

    Anyone care to elaborate?

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    May 16, 2010 @ 18:13
    Sebastiaan Janssen
    0

    What I've done before is just create a property on my top-level documentType that contains the logo and in an XSLT I always refer to that logo (something like $currentPage/ancestor::node [@alias = 'logoImg']) that way, everything is always the same except for the logo that you need to upload for each site.

  • MartinB 411 posts 512 karma points
    May 17, 2010 @ 18:22
    MartinB
    0

    Hi Sebastiaan

    Thank you for your reply. I think i'm too much of an Umbraco newbie to fully comprehend what you wrote above.

    What i did instead was to insert a contentPlaceHolder in my master template, and on the subtemplates i then insert the path to the img file being used as a logo. It works like a charm none the less.

    Is your way a more "correct" way of doing things like that?

  • Peter Duncanson 430 posts 1360 karma points c-trib
    May 17, 2010 @ 22:05
    Peter Duncanson
    0

    Hey Martin, try this (in a fresh install if you can) and have a play with it.

    Create a new doctype called "BasePage" or similar. You can decorate this doctype with any properties that you would like all your pages to have. Here is the trick, for the other pages to inherit these properties they must be a child of this BasePage doctype. So in your doc type tree you would have something like this:

    Doctypes
    L BasePage
       L About Us
       L Homepage
       L Contact Us
       L Section

    So if you add to your BasePage a "logo" field then all of the child doctypes will have a logo field too. So you can then create you content like this:

    Content
    L Homepage
       L Section 1
          L About Us
          L Contact Us
       L Section 2
          L About Us
          L Contact Us

     

     

    Now the trick is when you create your content you can do a "recursive" field which is a fancy way of ask your templates to render out a value from your current page but if it does not find out to look in the parent page, which if it does not have one will look in the parent page, which if it does not have one....etc.

    Because you know all your pages have a "logo" parameter you can do a recursive search for the logo. This allows you to have a default site wide logo (which would be in your homepage) and you can also over-write the value for logo on a section by section or page by page basis as the search will stop as soon as it finds a value. To do a recursive search is easy, in the template editor click the "insert umbraco page field" button and in the pop up select your "logo" field and tick the recursive check box. This will now make this field look first at the page's content, then the section then the homepage and will stop on the first one it finds.

    Some words of warning, you can't move a doctype in the UI once its been created so any existing doctypes will either need to be recreated (safest) or you can dip into the DB and have a play around in there if feeling brave (it is doable though).

    Have a play with that and see if that helps.

    Pete

  • MartinB 411 posts 512 karma points
    May 18, 2010 @ 00:01
    MartinB
    0

    So many kind and helpful people on this forum :)

    Peter thanks alot for you explanation. I will use your description for my next umbraco projects which is right around the corner.

    For this project all sites are similar in structure, but some sections have different logos and menus. So right now my site is functioning the way i want it to.

    My master template is the skeleton with some contentPlaceholders that gets logo and topheader fader images from the subpages. Ofcourse the logo and header images are manually written out, but there are not so many, so i'll live. For my next project they have to be dynamically loaded from a media folder for sure ^^

  • MartinB 411 posts 512 karma points
    May 18, 2010 @ 00:07
    MartinB
    0

    subpages = suptemplates of course

Please Sign in or register to post replies

Write your reply to:

Draft