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

Dizkus

Bottom
tip: concatenate parameters with smarty
  • Posted: 06.04.2008, 08:11
     
    mumuri
    rank:
    Helper Helper
    registered:
     May 2004
    Status:
    offline
    last visit:
    30.11.08
    Posts:
    196
    if you want to pass parameters to a Smarty, you can use the cat modifier

    You can use it like that

    Code

    <!--[ pnmodurl modname=pnForum type=user func=main fragment=$forum.cat_id|cat:"cat" ]-->">


    in order to have the following ouput

    Code

    index.php?module=pnForum#2cat


    AND you can use it like that

    Code

    <!--[ pnmodurl modname=pnForum type=user func=main fragment="cat"|cat:$forum.cat_id ]-->">


    in order to have the following ouput

    Code

    index.php?module=pnForum#cat2


    http://www.smarty.net/manual/en/language.modifier.cat.php

    --
    4 pages of french & english Zik.1 tips
  • Posted: 06.04.2008, 13:52
     
    rgasch
    rank:
    Professional Professional
    registered:
     January 2003
    Status:
    offline
    last visit:
    26.11.08
    Posts:
    568
    There is also the assign_concat pnRender plugin which allows you to concatenate up to 10 arguments and assign the result to a new variable.

    Greetings
    R
  • Posted: 06.04.2008, 14:04
     
    espaan
    rank:
    Helper Helper
    registered:
     August 2003
    Status:
    offline
    last visit:
    01.12.08
    Posts:
    468
    Yeah, you can do nice stuff with the modifiers:
    the page with all of them: http://www.smarty.ne…guage.modifiers.php
    Also multiple cats after each other:

    Code

    <!--[pnpageaddvar name="rawtext" value='<style type="text/css">'|cat:$parsedstyle|cat:'</style>']-->

    or an inline string replacement

    Code

    <!--[pnml name=$scrollstyle|replace:'%DIVID%':$divid assign=parsedstyle]-->




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

    Involved in: BlankTheme, StoriesExt, Menu templates, SmugView and zikula.nl
  • Posted: 06.04.2008, 16:42
     
    mumuri
    rank:
    Helper Helper
    registered:
     May 2004
    Status:
    offline
    last visit:
    30.11.08
    Posts:
    196
    the idea was to avoid two lines of code in the template,

    but assign_concat is more fit if you ve got multiple arguments



    edited by: mumuri, Apr 06, 2008 - 03:43 AM

    --
    4 pages of french & english Zik.1 tips

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula