Search code examples
ezpublish

Add parameters to URLs in ezPublish


I have an url like $article.url|ezurl(,'full'), but I need to pass additional parameters to it (eg. (offset)/2).

Please note that I am using attribute_view_gui for images, so I can't just hardcode it.

I tried creating variables:

{def $url = $article.url|ezurl(,'full')}

And then adding values there, but it's useless.

What can I do?


Solution

  • You can add view parameters to the URL before passing it to the ezurl() template operator.

    <a href={concat( $article.url, '/(offset)/2' )|ezurl}>{$article.name|wash}</a>
    

    Note that ezurl adds double quotes by default so you don't need to add them in your html/tpl code with <a href="{concat...}">...

    If you want to use a $url variable, then you need to tell ezurl not to add these quotes :

    {def $url = concat( $article.url, '/(offset)/2' )|ezurl('no')
         $name = $article.name}
    <a href="{$url}">{$name|wash}</a>