Copied to clipboard

Flag this post as spam?

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


  • Fahad Ayub 71 posts 238 karma points
    Aug 17, 2016 @ 14:40
    Fahad Ayub
    0

    Dynamic Sections links

    Hi, I have a one page with different section for Home , about Us,Our Team,Contact Us etc. The Nav bar contain links to all these sections like:

    <ul class="nav navbar-nav">
    
                        <li class="menuItem"><a href="#whatis">What is?</a></li>
                        <li class="menuItem"><a href="#useit">Use It</a></li>
                        <li class="menuItem"><a href="#screen">Screenshot</a></li>
                        <li class="menuItem"><a href="#credits">Credits</a></li>
                        <li class="menuItem"><a href="#contact">Contact</a></li>
                    </ul>
    

    Is there a way where I can allow user to create a new section in Umbraco and if there is then how the Nva bar will be updated accordingly. I am planing to use grid layout but not sure how user will name the new section of the page and how the Nav bar will be updated.

    Any help. Thanks

  • Ian 178 posts 752 karma points
    Aug 17, 2016 @ 20:45
    Ian
    0

    You may not like it but i think you may be best creating separate nodes for you navigable sections. Those nodes would use the grid for laying out their content.

    If this is a spa then your view would use the node sort order to determine the order of sections in layout. Your navigation render could use the node alias.as the target and this would be added as the section id in layout.

    Other than this i can only think of adding custom settings in the grid when editing you datatype a section name property 'could' be added, but the problem.with this is that the setting would display not only on rows but also cells. You would need to educate users why that setting is there and ypu grid renderer ignore entries on cells (not very intuitive)

  • Fahad Ayub 71 posts 238 karma points
    Aug 18, 2016 @ 07:29
    Fahad Ayub
    0

    Hi Ian, Thanks for your response. So the solution would be to create a main page with grid layout. and the create a separate node for each section like home , about us etc. Then add these nodes in to main page layout , is this correct ? If it is then I am not sure how to add nodes in gridlayout.

    Thanks

  • Ian 178 posts 752 karma points
    Aug 18, 2016 @ 12:28
    Ian
    0

    I don't know what other content you have in your site but if this were a single page app where the only thing that makes up the entire content of your site is these sections then I would probably have a root node with a template, this the node that would be visited by its url and because it is the root node would just be the address of your site.

    This node doesn't need to have any fields on it if you don't want though you may decide to add fields which determine global site behaviour like site logo / google analytics code.

    Then you would have child nodes beneath this which have a grid control field so editors can manage the content layout of a section.

    Editors would add new child nodes for each section required. These child nodes would not need to have a template associated with them in your case.

    So your 1 template for the site which is associated with your root node would get all children of the current node, order these 'sections' by their sort order and proceed to get the fields you require. This may be only the grid field and the document alias. In a loop you would render the getgridhtml output for each child (section) on the page possibly wrapped in a div with an id value retrieved from the document alias.

    For your navigation your template may use a helper to process these same children into a list with href targets again retrieved from the document alias of each child.

Please Sign in or register to post replies

Write your reply to:

Draft