Results 1 to 12 of 12

Thread: Possible to use inserttags in templates?

  1. #1
    User
    Join Date
    08-15-09.
    Location
    Sweden
    Posts
    82

    Default Possible to use inserttags in templates?

    Hi,

    I'm trying to insert a module within a template with an inserttag, like this: {{insert_module::7}}. The problem is when looking at the page in the webbrowser, the inserttag is rendered as normal text, and the module in this case is not inserted.

    Details:
    1. I have a custom html-module with an inserttag to insert my template file.
    2. In the template file, I have some html and php-code. Additionally, I want to insert another module, so I add an inserttag: {{insert_module::7}}.
    3. When looking at the page in the browser, the html and php renders, but my inserttag is not rendered. It is rendered as normal text: "{{insert_module::7}}".

    The template I am using is stored properly in the templates directory. I have tried, and inserttags in the fe_page template work, so inserttags should be allowed in templates.

    Maybe it's not possible to use inserttags in templates, that is called from within another module?

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

    Default Re: Possible to use inserttags in templates?

    Did you use copy&paste tag string from documentation page? Try to write it by hand. I'don't know why but sometimes it's not working after copy&paste.
    BTW: inserttags works fine if you put it directly inside template.
    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
    User
    Join Date
    08-15-09.
    Location
    Sweden
    Posts
    82

    Default Re: Possible to use inserttags in templates?

    I tried to write it by hand with no luck.

    See if I can clarify a bit:
    Custom HTML-module -> {{file::login-panel.tpl}} -> login-panel.tpl -> {{insert_module::7}}

    Maybe you can't chain inserttags?

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

    Default Re: Possible to use inserttags in templates?

    Quote Originally Posted by Ola
    {{file::login-panel.tpl}}
    What's this? You can not including tpl file via inserttag "file" only php files stored in "templates" forlder.
    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

  5. #5
    User
    Join Date
    08-15-09.
    Location
    Sweden
    Posts
    82

    Default Re: Possible to use inserttags in templates?

    Quote Originally Posted by qrczak
    Quote Originally Posted by Ola
    {{file::login-panel.tpl}}
    What's this? You can not including tpl file via inserttag "file" only php files stored in "templates" forlder.
    No? It works for me to include tpl-files with inserttags though.

    But for this problem I have now, it makes no difference whether I include a tpl or php file. Really strange. :?

    Everything else in the file I want to include works (html & php-code). It's just the inserttags that doesn't render. None of them work. ( {{insert_module::7}} {{link_url::5}} {{user::firstname}} )

    See screenshot. The whole black bar in the top is inserted via inserttags through custom html module. Inserttags in the template do not render properly...

    [attachment=0:f5d1ixtt]inserttags problem.png[/attachment:f5d1ixtt]

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

    Default Re: Possible to use inserttags in templates?

    Quote Originally Posted by Ola
    No? It works for me to include tpl-files with inserttags though.
    Hmm... the true is I've never try that but documentacion says only about php file. But if you say it work - so it works :-)

    Quote Originally Posted by Ola
    Everything else in the file I want to include works (html & php-code). It's just the inserttags that doesn't render. None of them work. ( {{insert_module::7}} {{link_url::5}} {{user::firstname}} )
    If I corectly remember files gets via inserttag "file" is rendered after rendering all inserttags so it's mean, none of inserttags inside file including via file inserttag will no rendered properly. Maybe I'm wrong but try (only for test purposes) move this inserttags to main template and see what will happen.
    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

  7. #7
    User
    Join Date
    08-15-09.
    Location
    Sweden
    Posts
    82

    Default Re: Possible to use inserttags in templates?

    Quote Originally Posted by qrczak
    If I corectly remember files gets via inserttag "file" is rendered after rendering all inserttags so it's mean, none of inserttags inside file including via file inserttag will no rendered properly. Maybe I'm wrong but try (only for test purposes) move this inserttags to main template and see what will happen.
    The inserttags works as they should if I place them in other templates.

    But, inserttags apparently won't work if they are placed within a template, which is called from another inserttag.

    I have tried this on another TL installation with the same results. I cannot test it on the online demo since I don't have access to the templates in the demo.

    If anyone could confirm this would be great. If it is a bug, or if it is this way it should work.

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

    Default Re: Possible to use inserttags in templates?

    Quote Originally Posted by Ola
    But, inserttags apparently won't work if they are placed within a template, which is called from another inserttag.
    That's exactly what I mean. It won't work propertly for you in this case.
    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

  9. #9
    User
    Join Date
    08-15-09.
    Location
    Sweden
    Posts
    82

    Default Re: Possible to use inserttags in templates?

    Ok, thats a bummer. Guess I need to figure out another way to do what I want.

    What I want to to is to make a sliding panel with a login form. To build the panel I have to use php code to see if a user is logged in, therefore I cannot write the code in a custom html module. Instead I use an inserttag in the custom html module to run the html and php code via a php template. In this template for the panel, I want to insert my login form, that exists in the form of a module. So I insert the module via an inserttag, but this apparently wont work.

    I will try to find another solution, like editing the fe_page directly instead of using modules. But it would be nicer to be able to use the powerful(?) inserttags. (And it would be really nice to be able to use php code in the custom html module, but I think that is not recommended for security reasons..)

    But thanks for your help so far.

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

    Default Re: Possible to use inserttags in templates?

    Quote Originally Posted by Ola
    To build the panel I have to use php code to see if a user is logged in
    To check if user is logged in you can use this code:
    [code=php:3ga55pfk]<span class="syntaxhtml"><?php*if*(FE_USER_LOGGED_IN): *?><div*id="logout">{{insert_module::6}}</div><?php*endif;*?></span>[/code:3ga55pfk]
    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

  11. #11
    User
    Join Date
    08-15-09.
    Location
    Sweden
    Posts
    82

    Default Re: Possible to use inserttags in templates?

    Quote Originally Posted by qrczak
    Quote Originally Posted by Ola
    To build the panel I have to use php code to see if a user is logged in
    To check if user is logged in you can use this code:
    [code=php:3n64kvy8]<span class="syntaxhtml"><?php*if*(FE_USER_LOGGED_IN): *?><div*id="logout">{{insert_module::6}}</div><?php*endif;*?></span>[/code:3n64kvy8]
    Thanks for your info, but I had already that figured out.

    I got all working by editing the fe_page template instead. You can see the result here: http://www.mrfagel.se

  12. #12
    New user
    Join Date
    07-24-09.
    Posts
    29

    Default Re: Possible to use inserttags in templates?

    Quote Originally Posted by Ola
    Quote Originally Posted by qrczak
    Quote Originally Posted by Ola
    To build the panel I have to use php code to see if a user is logged in
    To check if user is logged in you can use this code:
    [code=php:32s6glmc]<span class="syntaxhtml"><?php*if*(FE_USER_LOGGED_IN): *?><div*id="logout">{{insert_module::6}}</div><?php*endif;*?></span>[/code:32s6glmc]
    Thanks for your info, but I had already that figured out.

    I got all working by editing the fe_page template instead. You can see the result here: http://www.mrfagel.se

    Nice Clean Site, great effects with login area
    Internet Marketing is both measurable and accountable.
    On Twitter Marketing Guy
    On LinkedIn Nigel Copley
    On Facebook Caroco Marketing

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
  •