Copied to clipboard

Flag this post as spam?

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


  • arviman 71 posts 92 karma points
    May 21, 2010 @ 22:10
    arviman
    0

    Toggling visibility of sections in a web page

    For the web site that i'm planning on building, one of the requirements is that the editor should have the abillity to alter the layout of a page.

    More specifically, he/she should have the ability to change which sections of a page are to be displayed, and which not.

    So for eg. the editor could choose to not display an ad on the page.

    One way I could go about implementing this is to have different templates, one for each possible layout of a page. For eg. if there are 3 main contents - an article list, a content section and an ad section, I would have six different templates for all the combinations. This would become rather time consuming if there were many sections.

    So i was wondering if there was a way for me to architect this system to make this easier. Is there some super property that I can assign to a document type, so all content nodes of that document type inherit the value of that property? Then I can check this property in a macro and choose whether to render the content or not. Pretty sure I can't do this but I would like to know any alternate ideas for this.

    Thanks!

    Arvi

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    May 21, 2010 @ 23:31
    Jan Skovgaard
    0

    Hi aviman

    I think that your challenge can be solved. It's really just a matter of how generic one's mindset is. I can sometimes have trouble thinking generic enough myself - but it's not Umbraco that is the limitation :-)


    In your case is it then specifically ads that you need to manage? Or is it also other content items like news lists, events, image galleries etc.?

    One way to solve this, would be to create another root node at the same level of your "home" node or whatever you call it and then create ads in this new content section.

    Then using for instance the ultimate picker on the content-pages you can select one or more ads for the specific page. When ads are selected on a node, which has children you can easily make an XSLT macro that inherits the values selected. If you don't want the values to be inherited you can ad a property to your document, which allows the content editor to disable inheritance.

    If you don't like cluttering up the tree in the content section you can install the "documents" package, which creates a "documents" section where content repositories can be created and structured, which would give a more clean solution and not confuse content editors if they should not be allowed to create ads etc.

    I hope it makes sense and gives you an idea on how to solve your problem.

    /Jan

  • arviman 71 posts 92 karma points
    May 22, 2010 @ 01:36
    arviman
    0

    Hi Jan, thanks for the reply. I'm thinking rather generic here, where the editor should easily be able to toggle visibility of sections. Not necessarily something specific for ads. The ultimate picker tool looks very interesting. However,as I'm working on a classifieds and newspaper site most of the content I'm going to display is going to come from macros and not necessarily hand picked by the editor.

    The idea of inheriting property values looks very feasible, so thanks again for the tip!

    Cheers

    Arvi

     

     

  • arviman 71 posts 92 karma points
    May 24, 2010 @ 23:39
    arviman
    0

    BTW does anyone know where I can find this "documents" package Jan has described here? A link would be useful.

     

  • Bert 128 posts 251 karma points
    May 25, 2010 @ 00:07
    Bert
    2

    A not so generic methode:

    Add a property to your document (boolean: section a visible)

    The macro that generates the specific section can check the property of the current page (page he is rendered on) for visibility.

     

    Drawback, you need a property for each section you want toggled.

  • Chris Dunn 210 posts 401 karma points
    May 25, 2010 @ 05:28
    Chris Dunn
    0

    I would suggest creating the property on a base document type (if it applies to all document types), then inherit your other document types from that doctype.  Place all related properties on a  "Display Options" tab.  Will save you from adding to each doctype.

    Also you can pass the page property as recursive =true to the macro, then follow the logic as mentioned by Bert.  This will prevent you from needing to set the property on each document and only set it on the "exceptions".  In this case it will "loop" up the nodes until it finds a value "true/false" for the property.  So if all documents under a section do not display the navigation, you only set it once at the top node of the section.

    My 2cents :)

    -Chris

Please Sign in or register to post replies

Write your reply to:

Draft