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?
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.
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?
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.
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]
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.
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.
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.
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.
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]
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
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 ;)