Now many people in xoops.org create topics and want to remove some parts from title but they cannot do it easily because the hardcoded
in the themes.<br>
Anyway this hardcode problem (more than one php variable is defined for one smarty) is not limited to the themes. It is generally used in modules/core and make customization very hard especially for new webmasters.<br>
this title hardcode smarty is defined in class/theme.php codes:<br>
<span>[code]</span><br>
$this->template->assign(array(<br>
'xoops_theme' => $xoops->getConfig('theme_set'),<br>
'xoops_imageurl' => XOOPS_THEME_URL . '/' . $xoops->getConfig('theme_set') . '/',<br>
'xoops_themecss' => $xoops->getCss($xoops->getConfig('theme_set')),<br>
'xoops_requesturi' => htmlspecialchars($_SERVER<span>['REQUEST_URI']</span>, ENT_QUOTES),<br>
'xoops_sitename' => htmlspecialchars($xoops->getConfig('sitename'), ENT_QUOTES),<br>
'xoops_slogan' => htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES),<br>
'xoops_dirname' => $xoops->moduleDirname,<br>
'xoops_banner' => $this->renderBanner ? $xoops->getBanner() : ' ',<br>
'xoops_pagetitle' => $xoops->isModule() ? $xoops->module->getVar('name') : htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES)<br>
));<br>
$this->template->assign(array(<br>
'theme_path' => $this->path,<br>
'theme_tpl' => $this->path . '/xotpl',<br>
'theme_url' => $this->url,<br>
'theme_img' => $this->url . '/img',<br>
'theme_icons' => $this->url . '/icons',<br>
'theme_css' => $this->url . '/css',<br>
'theme_js' => $this->url . '/js',<br>
'theme_lang' => $this->url . '/language',<br>
));<br>
<span>[/code]</span><br>
As you can see we have xoops_slogan smarty variable but again it is used in xoops_pagetitle variable. It is bad coding.</p>
<p>We already have xoops_slogan and xoops_sitename smarties.<br>
we should define a xoops_modulename smarty that back the module name or empty string if the module is not exist:</p>
<p>'xoops_modulename' => $xoops->isModule() ? $xoops->module->getVar('name') : '';</p>
<p>then xoops_array_pagetitle should be defined as an array in class/theme.php like this:<br>
$xoops_array_pagetitle = array();<br>
....</p>
<p>'xoops_array_pagetitle' => $xoops_array_pagetitle,</p>
<p>and can be defined for each module separately (can be fully customized eg: page title - page subtitle - cat title - sub cat title - sub sub cat title)<br>
for example for publisher module like this:<br>
$xoops_array_pagetitle<span>['item_title']</span> = ...<br>
$xoops_array_pagetitle<span>['item_subtitle']</span> = ...</p>
<p>or for newbb like this:</p>
<p>$xoops_array_pagetitle<span>['post_title']</span> = ....<br>
$xoops_array_pagetitle<span>['topic_title']</span> = ....<br>
$xoops_array_pagetitle<span>['forum_title']</span> = ... (sub forums and others included)<br>
$xoops_array_pagetitle<span>['cat_title']</span> = ....</p>
<p>then all modules can use the unify below code to assign xoops_array_pagetitle like this:<br>
$xoopsTpl->assign('xoops_array_pagetitle',$xoops_array_pagetitle);</p>
<p>then can be used in all themes like this:<br>
<span>[code]</span><br>
<title><br>
<{if $xoops_array_pagetitle}><br>
<{foreachq item=xo_title from=$xoops_array_pagetitle}><br>
<{$xo_title}> :<br>
<{/foreach}><br>
<{/if}><br>
<!-- irmtfan for backward compatibility --><br>
<{if $xoops_pagetitle !=''}> <{$xoops_pagetitle}> : <{/if}><br>
<{$xoops_modulename}> : <{$xoops_slogan}> : <{$xoops_sitename}>
[/code]
The above is the final solution for full customization of title in the head without hardcoding.
we can implement the above by modifying class/theme.php and show the use in theme.html or other html like xometas.html
then we can promote for module developers to use $xoops_array_pagetitle instead of $xoops_pagetitle