Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Goto page: [-1] 1 - 2

Bottom
Setting Active Links to a Nav bar
  • Posted: 16.04.2008, 02:15
     
    jaenosjelantru
    rank:
    Helper Helper
    registered:
     March 2005
    Status:
    online
    Posts:
    360
    This produced a Smarty error:

    Code

    <li<!--[if $module eq 'htmlpages' && $pid = '1' ]-->


    An unknown error has occured. The following error message was returned by the system

    Smarty error: [in master.htm line 29]: syntax error: unidentified token '=' (Smarty_Compiler.class.php, line 1405) (in file C:\PATH\Websites\xampp\htdocs\test\includes\classes\Smarty\Smarty.class.php on line 1092)





    This worked however:

    Code

    <li<!--[if $module eq 'htmlpages' && '$pid=1' ]-->




    Sorry for the confusion!



    edited by: jaenosjelantru, Apr 15, 2008 - 03:17 PM

    --
    [ stevencopley.com ]
  • Posted: 16.04.2008, 02:55
     
    AmmoDump
    rank:
    Professional Professional
    registered:
     December 2003
    Status:
    offline
    last visit:
    21.11.08
    Posts:
    2975
    sure

    Code

    $pid = '1' // variable pid equals the string 1
    '$pid=1'   // the value of variable pid is 1



    --
    David Pahl
    Zikula Support Team
  • Posted: 16.04.2008, 16:54
     
    espaan
    rank:
    Helper Helper
    registered:
     August 2003
    Status:
    offline
    last visit:
    22.11.08
    Posts:
    465
    According to smarty.net the "equals" test is

    Code

    $a == $b
    or

    Code

    $a eq $a

    so a single = is not valid indeed. You use eq with module eq htmlpages, why not use eq with pid icon_wink



    edited by: espaan, Apr 16, 2008 - 12:55 PM

    --
    http://www.erikspaan.nl
    http://www.avwijchen.nl

    Involved in: BlankTheme, StoriesExt, Menu templates, SmugView and zikula.nl
  • Posted: 13.06.2008, 03:38
     
    jaenosjelantru
    rank:
    Helper Helper
    registered:
     March 2005
    Status:
    online
    Posts:
    360
    Ok.. new question:

    This seems to work:

    Code

    <li<!--[if $module eq 'htmlpages' && $pid eq '1' ]--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Staff]-->">Staff</a></li>


    This does not:

    Code

    <li<!--[if $module eq 'Pages' && $pid eq '1' ]--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Staff]-->">Staff</a></li>


    Nor does this:

    Code

    <li<!--[if $module eq 'Pages' && $pageid eq '1' ]--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Staff]-->">Staff</a></li>


    Or this:

    Code

    <li<!--[if $module eq 'Pages' && 'pageid' eq '1' ]--> class="selected"<!--[/if]-->><a href="<!--[pnmodurl modname=Staff]-->">Staff</a></li>


    Any help appreciated!

    --
    [ stevencopley.com ]
  • Posted: 13.06.2008, 16:07
     
    jaenosjelantru
    rank:
    Helper Helper
    registered:
     March 2005
    Status:
    online
    Posts:
    360
    Mateo or Mark?

    You guys or anyone have the answer to this? I'm certain its something simple for you but I can't get it working.

    icon_mad

    --
    [ stevencopley.com ]
  • Posted: 13.06.2008, 16:53
     
    nestormateo
    rank:
    Professional Professional
    registered:
     September 2006
    Status:
    offline
    last visit:
    22.11.08
    Posts:
    1451

    jaenosjelantru

    This seems to work:

    Code

    <li<!--[if $module eq 'htmlpages' && $pid eq '1' ]--> class="selected"...


    Ah!, though you get what you wanted...

    Our method in BlankTheme is a plugin responsible of the navigation menu,
    there you can get some passed values if needed, and evaluate all some conditionals like pid = 1.
    Currently we are based in a template id only
    but i'll think in a better way to customize it.

    With menutree that's easy and we've already included that feature in our copy.

    Mmmm
    in the other hand, have you saw the pndebug output to see if $pid is set?
    if not, use:
    <--[formutil_getpassedvalue key="pid" default="0" source="GET" assign="pid"]-->
    then verify it in the conditional
    icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Posted: 13.06.2008, 17:17
     
    jaenosjelantru
    rank:
    Helper Helper
    registered:
     March 2005
    Status:
    online
    Posts:
    360
    What I meant by that one seeming to work is that it works for the htmlpages module, but not for the Pages module. I even reassigned the variable name to pageid which is what Pages uses. It isn't working no matter what variable I use. I suppose I can try to use the pndebug when I get home later and see if the pageid is set, but it should be. It just doesn't work.

    Thanks for your help, I am just really frustrated because I know it is something simple.

    --
    [ stevencopley.com ]
  • Posted: 13.06.2008, 17:50
     
    nestormateo
    rank:
    Professional Professional
    registered:
     September 2006
    Status:
    offline
    last visit:
    22.11.08
    Posts:
    1451
    Mmmmm
    are you using short-urls?
    in that case, Pages module uses the URL-title parameter i guess
    or another option, is to compare the requested UR ( using pnGetCurrentURI() )

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Posted: 13.06.2008, 17:55
     
    jaenosjelantru
    rank:
    Helper Helper
    registered:
     March 2005
    Status:
    online
    Posts:
    360
    I am using shortURLs, file type, HTML

    As seen on my website.

    In that case, do you know the proper conditional for the active nav link?

    --
    [ stevencopley.com ]
  • Posted: 13.06.2008, 19:31
     
    AmmoDump
    rank:
    Professional Professional
    registered:
     December 2003
    Status:
    offline
    last visit:
    21.11.08
    Posts:
    2975
    Like my friend Mateo suggested, set an ID to to the module name, and let the filtering be done through the CSS. The cool thing about doing it this way is you can recycle the parameter for other purposes. The code will be set and it just makes better sense. This was a feature I pushed for in BlankTheme, and it made the need for code less.

    --
    David Pahl
    Zikula Support Team

Goto page: [-1] 1 - 2

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula