Jump to content

Adding anew variable to a .inc.php file to be picked up by a .tpl


Guest efree

Recommended Posts

Guest efree

This Question is similar to the one asked in this thread:

http://www.cubecart.com/site/forums/index....=18114&st=0

but not the same.

I want to know how to (if i can) simply do this.

viewProd.inc.php

$view_prod->assign("MYNEWVAR","HELLOWORLD");

viewProd.tpl

{MYNEWVAR}

I've tried as above but I don't get HELLOWORLD or anything getting printed in the product page where i use {MYNEWVAR}.

Something else i need to change?

Link to comment
Share on other sites

Might be an issue of where in the .tpl file you put the {MYNEWVAR} placeholder. Look at the source code view of the page sent back to your browser and see if HELLOWORLD shows up, but the browser isn't rendering it.

Link to comment
Share on other sites

This Question is similar to the one asked in this thread:

http://www.cubecart.com/site/forums/index....=18114&st=0

but not the same.

I want to know how to (if i can) simply do this.

viewProd.inc.php

$view_prod->assign("MYNEWVAR","HELLOWORLD");

viewProd.tpl

{MYNEWVAR}

I've tried as above but I don't get HELLOWORLD or anything getting printed in the product page where i use {MYNEWVAR}.

Something else i need to change?

Syntax is correct however all depends to placement in code/template. Template has some subsections they are called in php file once or sveral times.

Just post the a piece of code (few lines above ant below to lines above) to see what is this code related to.

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.

×
×
  • Create New...