Smarty şablonda bulunan tüm değişkenleri yazdırmak

3 Cevap php

Nasıl tüm değişkenleri Smarty şablon bağlamında mevcut yazdırırım? Geçirilen her şeyi listeler Django hata ayıklama izleme gibi bir şey.

Teşekkürler

3 Cevap

Use {debug} :

{debug} dumps the debug console to the page. This works regardless of the debug settings in the php script. Since this gets executed at runtime, this is only able to show the assigned variables; not the templates that are in use. However, you can see all the currently available variables within the scope of a template.

var_dump($Smarty->_tpl_vars);

Smarty kodundan :)

Smarty 3 için Güncelleme cevap:

// get assigned template var 'foo'
$myVar = $smarty->getTemplateVars('foo');

// get all assigned template vars
$all_tpl_vars = $smarty->getTemplateVars();

Taken straight from the doc page