[thelist] PHP / smarty
Bob Meetin
bobm at dottedi.biz
Sun Oct 9 11:30:12 CDT 2011
I am working a project, a shopping cart, which is done using smarty which I don't know. I am making some customizations to the product page which require running a query against the product ID. Looking at the smarty template files, the product ID can be displayed using this smarty code:
{$product.product_id}
as in: <h4>Product ID: {product.product_id}</h4>
The question. How can you convert the smarty ID to a PHP variable that can be used in the PHP/MySQL query? Example:
<?php
$product_id = some PHP function on product.product_id ; // meaning what php code do I use to extract the ID out of smarty
$query = "select pcid, pid, group, title, description from product_xdesc where pid = $product_id";
?>
I will probably set up the PHP as an include file. Once I have the $product_id passed to PHP, the rest is easy.
--
Bob
More information about the thelist
mailing list