Various trips & tricks
Sending headers in Smarty
For automatic redirect add following lines at the beginning of the page template:
{insert name=header content="Location: http://www.site.com"} For changing content type add following lines at the beginning of the page template:
{insert name=header content="Content-Type: text/vnd.wap.wml"}
Finding current content template in the object template
Inside object template (displaying one object detail view) sometimes you need to know which content template is currently used by parent section. In that case variable {$c_tpl} holds object template ID and not the current section content template ID.
This example finds parent section's content template ID:
{* get all parents info *}
{init_trail name="parents"}
{assign var="index" value=$parents|@sizeof} {* get direct parent index value *} {assign var="index" value=$index-2} {* load direct parent object *} {init_object id=$parents.$index->id name="parent_section"} {* print parent info *} parent section content template: {$parent_section->all.ttyyp_id} (section name: {$parent_section->title})
