Jump to content

Add variables across all templates...


dexus

Recommended Posts

I would like to add some variables in header template (or maybe somwhere else) that can be used in all template files.

 

For example I tried to add to header.tpl something like this...

 

{php}

$myVar = "something";

{/php}

 

and tried to use it in template as {$myVar} but that doesn't work :)

 

I never used smarty before so I just don't know how the php code in header should look like that will add variable that can be later used in all template files.

Link to comment
Share on other sites

Yes, that helped, thanks :)

 

If someone else is interested, variables can be added to header.tpl file like this:

 

{php}

$this->assign('myVar', 'my custom value');

{/php}

 

and can be used later across all template files like this:

 

{$myVar}

Link to comment
Share on other sites

  • 8 months later...

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