Forums / Cotonti / Support / Site navigation row in header.tpl

how can I create a plugin to do that?

Trustmaster
#22735 2010-02-06 00:47
OK, if you know alias or id in your plugin hooking into header, you can learn page_cat for that alias/id with 1 sql query:
if (empty($c)) {
  $where = empty($alias) ? 'page_id = '.(int)$id : "page_alias = '".sed_sql_prep($alias)."'";
  $cat_row = sed_sql_fetchassoc(sed_sql_query("SELECT page_cat FROM $db_pages WHERE $where"));
  $c = $cat_row['page_cat'];
}
After that you should either set a global variable or assign a tag containing that title:
$cat_title = $sed_cat[$c]['title'];
// OR
$t->assign('CAT_TITLE', $sed_cat[$c]['title']);
and then use either global {PHP.cat_title} (will work in any template and any block where $cat_title exists) or local {CAT_TITLE} (will work only in the template you assign it).
May the Source be with you!