Results 1 to 4 of 4

Thread: Nested insert tags

  1. #1
    New user
    Join Date
    07-19-11.
    Posts
    5

    Default Nested insert tags

    I need to dinamically generate a link using insert tags, but since I use a multi language site, I would like that the link follows the current language:
    is it possible to do something like that:

    Code:
    {{link_open::home-{{env::page_language}}}}
      <li title="tab_Home" class="active">
        
    
    {{link_title::home-{{env::page_language}}}}</p>
      
    {{link_close}}
    ---
    Alessandro Proglio

  2. #2
    User
    Join Date
    06-19-09.
    Location
    Elbl?g, Poland
    Posts
    152

    Default Re: Nested insert tags

    Try this
    Code:
    {{link_title::home-<?php echo $this->replaceInsertTags('{{env::page_language}}'); ?>}}
    Marcin

    http://www.contao.pl - Polish Support Site
    http://forum.contao.pl - Polish Contao community forum


    -----------------------
    Need custom template? Feel free to contact me by e-mail marcin@contao.pl

  3. #3
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Nested insert tags

    Quote Originally Posted by qrczak
    Try this
    Code:
    {{link_title::home-<?php echo $this->replaceInsertTags('{{env::page_language}}'); ?>}}
    Good idea. Perhaps we can make it more efficient and bypass running replaceInsertTags because if the entire string is an insert tag we might as well insert the actual value. (99% update safe. But insert tags can change as well between versions, so they are about as unsafe)

    Code:
    {{link_title::home-<?php global $objPage; echo $objPage->language; ?>}}
    Inside the same template you can use the shorter version <?php echo $objPage->language; ?> after global $objPage; has been included once;

  4. #4
    New user
    Join Date
    07-19-11.
    Posts
    5

    Default Re: Nested insert tags

    I tried the above method but my code is in a module and it doesn't work. but anyway I found the solution.
    It's my fault since I didn't read all the documentation, sorry.
    there is a specific insert tag for my problem: {{iflng::*}} {{iflng}}

    I'm using it and it works perfectly:

    Code:
    	{{iflng::it}}{{link_open::home-it}}{{iflng}}{{iflng::fr}}{{link_open::home-fr}}{{iflng}}
    		<li title="tab_Home" class="active">
    			
    
    {{iflng::it}}{{link_title::home-it}}{{iflng}}{{iflng::fr}}{{link_title::home-fr}}{{iflng}}</p>
    		
    	{{link_close}}
    ---
    Alessandro Proglio

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •