section title & MLE
Posted: Fri Sep 19, 2008 8:41 am
Hi,
I'm using the the {sectiontitle} plugin, but it seem that it only gets the default language's title of a section.
Can you help fix this? I got a website in ENG & BG.
Here is the plugin:
I'm using the the {sectiontitle} plugin, but it seem that it only gets the default language's title of a section.
Can you help fix this? I got a website in ENG & BG.
Here is the plugin:
Code: Select all
function smarty_cms_function_sectiontitle($params, &$smarty)
{
global $gCms;
$levels = isset($params["levels"]) ? $params["levels"] : 1 ;
// which page are we viewing?
$curPageID = $gCms->variables['content_id'];
$curPage = ContentManager::LoadContentFromId($curPageID);
// figure out the details of the current page and where it fits in
// the content hierarchy
$curHierarchy = $curPage->Hierarchy().'.';
$theLevels = explode (".",$curHierarchy);
$imSpec = $sectiontitle;
$depth = substr_count($curHierarchy,'.');
if ($levels < $depth)
{
$depth = $levels;
}
$hierCode = "";
for ($j=0;$j<$depth;$j++)
{
$hierCode .= substr("00000",0,5-strlen($theLevels[$j])) . $theLevels[$j] . ".";
}
$hierCode = rtrim($hierCode,".");
$db = $gCms->db;
$query = "select content_alias, content_name from " . cms_db_prefix().
"content where hierarchy=?";
$dbresult = $db->Execute($query, array($hierCode));
if ($dbresult && $dbresult->RecordCount() > 0)
{
$row = $dbresult->FetchRow();
$imSpec = strtolower($row["content_alias"]). "";
$imText = $row["content_name"];
}
echo "${imSpec}";
}