![]() |
Pass Varialbles from another page
Hello,
I have a sales page located at http://www.theherbsplace.com/sales.php where each product has a link to a page for more information. I am trying to get the productcode and amount passed to the page with more info. So, I can then create a buy now button for each sale option available for that product. I read about {include} can pass varialbles but I am not sure of the syntax of it or if that is the correct approach. I use include to add in content but I only need the variables Is there some way when I am trying to get the amount to display using {include file="currency.tpl" value=$sales[sale].amount} that I can pass the $sales values to the individual product page? Thanks, Randal |
Re: Pass Varialbles from another page
I have taken a tutorial on smarty and the code on the sales.php page shows:
$smarty->assign('main', 'sale_products'); $smarty->display("rjw/specials.tpl"); func_display("customer/home.tpl",$smarty); I have confirmed the array I need and the values I need thru webmaster mode can be found on the sales.php page but when I click on the links of one of the products the values aren't there. I know I need to set a display page for the smarty variables to be displayed. However, I don't know what page to display the variables at. In my example above I tried the specials.tpl page. For example, the first link is for a $2 OFF product. When I access that page via webmaster mode the variables aren't present. Following this tutorial: http://www.codewalkers.com/c/a/Miscellaneous/Smarty-for-Beginners/1/ It shows the example of using the index.html to display the variable In my example I used the specials.tpl code. In my case what should I put in place of the specials.tpl code? Please help me with this, I want to understand this concept. Thanks, Randal |
Re: Pass Varialbles from another page
Here are some links to other posts that show how to pass a Smarty variable to a PHP page. Hopefully one will do the trick for you:
http://forum.x-cart.com/showthread.php?t=13768 and http://forum.x-cart.com/showthread.php?t=738 I also successfully passed a variable between PHP and Smarty Template pages via the instructions on my Post #60 in this thread: http://forum.x-cart.com/showthread.php?t=6888&page=6 In that example, I'm appending the variable onto the end of the URL to get it from one page to another, so it's not safe for any sensitive information, but good for non-descript data. |
Re: Pass Varialbles from another page
you have the right idea in the original post, but the value needs to match up with the variable you use in the included page
say in the included page the variable you want to use is called $blah, but the variable in the current page you want to pass is $asdf...you would then type {include file="theincludepage.tpl" blah=$asdf} ...unless you want to pass variables between php pages, then you would use x_session_register |
All times are GMT -8. The time now is 11:27 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.