Jump to content

Best way to apply varibles/text set in one file to multiple pages?


zomex

Recommended Posts

Hello everyone,

 

I'm currently working on a WHMCS template and need some help with 1 area. What I need to do is allow the users to set for example their web hosting plan price in one file which is then applied across the template.

 

I would really like to be able to create custom language snippets in the language files but I haven't been able to find out if this is possible.

 

In the mean time I'm using the following:

 

{php}

$whp1_price = "4.00";
{/php}

 

which is then applied with:

 

${php} echo $whp1_price; {/php}/month

 

The problem is that if I add the top code to the header.tpl file the code to display the option won't work. The only way to get this to work is to add the top code to each page where it's used. The problem with this is that it then means updating multiple pages with the options.

 

Does anyone know of a better way?

 

Thanks,

Jack

Link to comment
Share on other sites

Hello Sparky,

 

Everything is working great but I do get the following error in the WHMCS log:

 

Smarty Error: [in template/header.tpl line 55]: syntax error: expecting '=' after attribute name 'nocache' (Smarty_Compiler.class.php, line 1591)

 

Would the following have the same effect?

 

{assign var="color" value="red" cache="nocache"}

 

I tried it for one and the variable still works but it's probably easier to ask than change everything only for it not to be right :)

 

Thanks in advance for any assistance.

Jack

 

EDIT:

 

I'm currently using the following which is one of the examples given:

 

{assign var="color" value="red" nocache}

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