X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Can you use PHP code in Smarty templates? (https://forum.x-cart.com/showthread.php?t=342)

groovico 04-03-2004 07:46 AM

Solution
 
Same thing was driving me crazy for a while last night, the answer was staring me right in the face all the time but it was so simple I couldn't see it until the very last minute then it hit me.

In the include file from smarty level do this:

Lets say you want to include the above in product.tpl:

Put

Code:

{include file="customer/main/whatever.tpl" productcode=$product.productcode}

In product.tpl

Notice I'm passing the productcode via smarty.

Now in whatever.tpl

Put

Code:

{php}

$productcode = $GLOBALS['smarty']->_tpl_vars[productcode];

include("http://www.mysite.com/d/{$productcode}.php");

{/php}


And your home and dry.

Note: Include() is dependant on server PHP configuration, looks like you're trying to pull in a product page from another site so keep in mind PHP may be set up in such a way that it doesn't let you do remote includes.

ATKOgirl 04-04-2004 06:40 PM

Groovico,

You are the X-cart KING!! You gave me the resolution to an issue I've been trying to solve for months!

THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!
THANK YOU!


:wink:


ATKOgirl


All times are GMT -8. The time now is 09:48 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.