Jump to content

[Smarty help] Dynamic template file content


GORF

Recommended Posts

Using the standard "Creating Pages" structure, I would like to dynamically generate the .tpl file contents.

 

Let's say I have a (global?) variable $content that contains what would normally be in a .tpl file:

<p><b>This is the stuff!</b><br>New things happening...</p>
<p>TEST = {$test}<p>
<p>{$something}<p>

 

If I simply put {$content} in the .tpl file, the end result is verbatim.

 

I have played with eval() and other things to no avail.

 

Anyone have any direction?

Link to comment
Share on other sites

Rob,

 

I tried that with no luck. The Smartyvalues for $test and $something are getting to the .tpl from the .php file but I can't get the $content working.

 

I guess this weekend will be sitting down with the Smarty site for some long reading!!

 

If I can get past this, I think I will have the next cool thing since sliced bread :)

Link to comment
Share on other sites

I'm not fully understanding the question, but I've hit a rock with rename the $pagetitle variable so when I needed I can up with another solution.

 

 

 

{php}$this->assign('pagetest',$_SERVER['REQUEST_URI']);{/php}

 

 

and the did a test on: $pagetest

 

eg:

 

{if $pagetest == '/submitticket.php?step=4'}Do something here{/if}

 

 

 

 

 

 

The problem I found is that its pretty easy to change the $pagetitle

in relevant tpl, the problem is this isn't carried across to the header or footer file :-/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated