Pergunta

I don't figure out how to display products/services from cart.php in homepage.tpl. I can't get other variables, without those shown in {debug}.

I find a way, to make a query directly in homepage.tpl, but I don't think that's the right way.

Foi útil?

Solução

You will need to pass your products/services through a Smarty variable.

In your PHP file:

global $smarty;

$products = "Query goes here";

$smarty->assign("products", $products);

Then in your .tpl file you can access it as following, assuming it's an array:

{foreach $products as $product}
   <p>{$product.name}</p>
{/foreach}

This is really basic knowledge though. You may want to consider re-reading the basics of templating.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top