PostNuke: A Flexible Open Source Content Management System
home | forum | international support | contact us

Support Forum

Start ::  PostNuke 0.7 Support ::  XTE Support ::  Setting Active Links to a Nav bar

Moderated by: Support Team

Goto page : 1 | 2 Next Page
Bottom
Setting Active Links to a Nav bar

  • Link to this postingPosted: 02.08.2007, 19:39
    Profile Homepage
    AmmoDump
    rank:
    pnProfessional pnProfessional
    registered:
     December 2003
    Status:
    offline
    last visit:
    08.05.08
    Posts:
    2635
    Currently it is slipping my mind...

    What I am trying to do is get the module name assign a variable to it, check it against link name, to assign the active link...

    Any Ideas?

    -----
    -- David Pahl -- (PostNuke Support Team)

    <div id="me" class="none" style="none" />

  • Link to this postingPosted: 02.08.2007, 20:48
    Profile Homepage
    Jusuff
    rank:
    pnSoftmore pnSoftmore
    registered:
     April 2005
    Status:
    offline
    last visit:
    04.05.08
    Posts:
    96
    Try this - at the top of template:
    Code
    <!--[pnvarcleanfrominput name='module' assign='thismodname']-->

    Then you'll have to check for every link:
    Code
    <!--[if $thismodname == 'somemodname']-->class='selected'<!--[/if]-->


    -----
    Polish PN Team
  • Link to this postingPosted: 03.08.2007, 08:56
    Profile Homepage
    markwest
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    24.04.08
    Posts:
    7647
    Xanthia already assigns the top-level module name as a template variable named $module.

    To see what variables are available in any template add the pndebug tag to that template. A popup will appear (if your a site admin) containing all available template variables.

    -Mark
  • Link to this postingPosted: 03.08.2007, 14:19
    Profile Homepage
    AmmoDump
    rank:
    pnProfessional pnProfessional
    registered:
     December 2003
    Status:
    offline
    last visit:
    08.05.08
    Posts:
    2635
    markwestTo see what variables are available in any template add the pndebug tag to that template. A popup will appear (if your a site admin) containing all available template variables.


    And of course, I knew this... Seems, I forgot it though icon_rolleyes


    -----
    -- David Pahl -- (PostNuke Support Team)

    <div id="me" class="none" style="none" />

  • Link to this postingPosted: 03.08.2007, 16:00
    Profile Homepage
    markwest
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    24.04.08
    Posts:
    7647
    AmmoDumpSeems, I forgot it though icon_rolleyes


    Consider this a gentle hint then icon_wink

    -Mark
  • Link to this postingPosted: 03.08.2007, 17:26
    Profile Homepage
    AmmoDump
    rank:
    pnProfessional pnProfessional
    registered:
     December 2003
    Status:
    offline
    last visit:
    08.05.08
    Posts:
    2635
    Perfect!
    For anyone interested in the code... Also, to set the home page use $mainpage
    Thanks Guys!
    Code
    <div id="menu">
            <ul>
                <!--[if $module == $mainpage]-->
                    <li class="active">
                <!--[else]-->
                    <li>
                <!--[/if]-->
                    <a href="index.php">Home</a></li>
                <!--[if $module == 'mediashare']-->
                    <li class="active">
                <!--[else]-->
                    <li>
                <!--[/if]-->
                    <a href="index.php?&name=Mediashare">Gallery</a></li>
                <!--[if $module == 'pnForum']-->
                    <li class="active">
                <!--[else]-->
                    <li>
                <!--[/if]-->
                    <a href="index.php?&name=pnForum">Message Board</a></li>




    edited by: AmmoDump, Aug 14, 2007 - 12:05 AM
    -----
    -- David Pahl -- (PostNuke Support Team)

    <div id="me" class="none" style="none" />

  • Link to this postingPosted: 14.08.2007, 05:19
    Profile Homepage
    AmmoDump
    rank:
    pnProfessional pnProfessional
    registered:
     December 2003
    Status:
    offline
    last visit:
    08.05.08
    Posts:
    2635
    Or... I love this:
    Code
    <body id="<!--[$module]-->">

    <ul>
                <!--[if $module == $mainpage]-->
                    <li class="active">
                <!--[else]-->
                    <li>
                <!--[/if]-->
                    <a href="index.php">Home</a></li>

                    <a href="index.php?&name=Mediashare" class="mediashare">Gallery</a></li>
                    <a href="index.php?&name=pnForum" class="pnForum">Message Board</a></li>

    Now in the CSS we add the following...
    Code
    #mediashare .mediashare, #pnForum .pnForum {
     /* your active style */
    }

    Thus we eliminate the conditional statements, save the main page. The styles need to be added, but I think this is a cleaner solution.




    edited by: AmmoDump, Aug 14, 2007 - 12:21 AM
    -----
    -- David Pahl -- (PostNuke Support Team)

    <div id="me" class="none" style="none" />

  • Link to this postingPosted: 23.01.2008, 14:16
    Profile
    DavidJ
    rank:
    pnFreshman pnFreshman
    registered:
     January 2008
    Status:
    offline
    last visit:
    25.04.08
    Posts:
    22
    I would welcome some advice on the following:
    I am using the Andreas08 theme in 0.8.0.0-RC2
    The nav bar consists of a number of seperate links to individual pages in the new content module, for example one link will go to Content&func=view&pid=1 and another to Content&func=view&pid=2.
    If I use
    Code
    <!--[if $module == 'content']-->
    all the content links are shown as active. How do I show the different pids in the above code to only show one active link ?

    -----
    David
  • Link to this postingPosted: 23.01.2008, 14:21
    Profile Homepage
    Herr.Vorragend
    rank:
    pnSoftmore pnSoftmore
    registered:
     July 2004
    Status:
    offline
    last visit:
    23.03.08
    Posts:
    89
    Same procedure:
    Code
    <!--[pnvarcleanfrominput name='pid' assign='pid']-->

    and so on....
    -----
    www.carsten-volmer.de
    Unternehmensberatung Volmer
  • Link to this postingPosted: 23.01.2008, 14:44
    Profile
    DavidJ
    rank:
    pnFreshman pnFreshman
    registered:
     January 2008
    Status:
    offline
    last visit:
    25.04.08
    Posts:
    22
    Herr.Vorragend many thanks for your quick reply it is appreciated.
    A bit new to this so I am still a bit confused so where in my theme template do I place
    Code
    <!--[pnvarcleanfrominput name='pid' assign='pid']-->

    This is from my existing theme template:
    Code
    <div id="theme_navigation_bar">
    <ul>
    <!--[if $loggedin eq true]-->
    <li class="selected"><a href="<!--[pngetbaseurl]-->">Home</a></li>
    <li<!--[if $module eq 'content']--> class="selected"<!--[/if]-->><a href="index.php?module=Content&func=view&pid=1">Trustees</a></li>
    <li<!--[if $module eq 'content']--> class="selected"<!--[/if]-->><a href="index.php?module=Content&func=view&pid=2">Location</a></li>
    <li> <a href="index.php?module=Pagesetter%20Calendar&func=classic&tid=1">Events</a></li>
    <li<!--[if $module eq 'mediashare']--> class="selected"<!--[/if]-->><a href="index.php?module=mediashare&type=edit&func=view&aid=1">Gallery</a></li>
    <li<!--[if $module eq 'content']--> class="selected"<!--[/if]-->><a href="index.php?module=Content&func=view&pid=3">History</a></li>
    <li<!--[if $module eq 'Search']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Search]-->"><!--[pnml name="_SEARCH"]--></a></li>
    <li<!--[if $module eq 'Profile']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Profile]-->"><!--[pnml name="_YOURACCOUNT"]--></a></li>
    <li<!--[if $module eq 'Admin']--> class="selected"<!--[/if]-->><a href="index.php?module=Admin&type=admin&func=adminpanel">Admin</a></li>
    <!--[else]-->

    -----
    David
  • Link to this postingPosted: 23.01.2008, 14:58
    Profile Homepage
    Herr.Vorragend
    rank:
    pnSoftmore pnSoftmore
    registered:
     July 2004
    Status:
    offline
    last visit:
    23.03.08
    Posts:
    89
    Somewhere at the top of the theme/template:
    Code
    <!--[pnvarcleanfrominput name="module" assign=module]-->
    <!--[pnvarcleanfrominput name="pid" assign=pid]-->

    Now you have to variables: $module and $pid.

    Code
    ...
    <li <!--[if $module eq "content" && $pid="1" ]--> class="selected"<!--[/if]-->>
       <a href="<!--[pnmodurl modname="Content" type="user" func="view" pid="1"]-->">
          Trustees
       </a>
    </li>
    ...





    edited by: Herr.Vorragend, Jan 23, 2008 - 04:00 PM
    -----
    www.carsten-volmer.de
    Unternehmensberatung Volmer
  • Link to this postingPosted: 23.01.2008, 15:32
    Profile Homepage
    nestormateo
    rank:
    pnProfessional pnProfessional
    registered:
     September 2006
    Status:
    offline
    last visit:
    08.05.08
    Posts:
    913
    I preffer to manage this with a simple plugin.
    An example of the think i do is in my alpha blanktheme (available here).

    -----
    - Mateo T. -
    Mis principios... son mis fines
  • Link to this postingPosted: 23.01.2008, 17:05
    Profile
    DavidJ
    rank:
    pnFreshman pnFreshman
    registered:
     January 2008
    Status:
    offline
    last visit:
    25.04.08
    Posts:
    22
    Thanks Herr.Vorragend. The template variable named $module was already assigned so I only needed to assign the $pid variable and all now works as it should.

    Mateo thanks very much for your comments. I have downloaded a copy of your blank theme and will try it out.



    -----
    David
  • Link to this postingPosted: 15.04.2008, 20:34
    Profile Homepage
    jaenosjelantru
    rank:
    pnHelper pnHelper
    registered:
     March 2005
    Status:
    offline
    last visit:
    30.04.08
    Posts:
    124
    This is an excellent guide on setting active links. I would add that Smarty doesn't seem to like = but rather eq.
    So I used the following:
    Code
    <div id="theme_navigation_bar">
    <ul>
    <li><a href="index.php"><!--[pnml name="_NEXUS_HOME"]--></a></li>
    <li<!--[if $module eq 'About Us']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=About]-->">About Us</a></li>
    <li<!--[if $module eq 'htmlpages' && $pid eq '1' ]--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Staff]-->">Staff</a></li>
    <li<!--[if $module eq 'crpCalendar']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Events]-->">Events</a></li>
    <li<!--[if $module eq 'htmlpages' && $pid eq '5' ]--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Services]-->">Services</a></li>
    <li<!--[if $module eq 'News']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=News]-->">Newsletter</a></li>
    <li<!--[if $module eq 'Search']--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Search]-->"><!--[pnml name="_SEARCH"]--></a></li>
    </ul>
    </div>
  • Link to this postingPosted: 15.04.2008, 21:11
    Profile Homepage
    AmmoDump
    rank:
    pnProfessional pnProfessional
    registered:
     December 2003
    Status:
    offline
    last visit:
    08.05.08
    Posts:
    2635
    Smarty likes = signs just fine... how else would you assign a variable?
    Code
    <!--[something this=that]-->

    == are for comparing
    Code
    <!--[if this == that]-->



    -----
    -- David Pahl -- (PostNuke Support Team)

    <div id="me" class="none" style="none" />

Goto page : 1 | 2 Next Page

Start ::  PostNuke 0.7 Support ::  XTE Support ::  Setting Active Links to a Nav bar

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to PostNuke