From: SourceForge.net <no...@so...> - 2012-08-25 04:22:34
|
Feature Requests item #3561574, was opened at 2012-08-24 21:22 Message generated for change (Tracker Item Submitted) made by irmtfan You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=430843&aid=3561574&group_id=41586 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: XOOPS 2.6 Status: Open Resolution: None Priority: 5 Private: No Submitted By: irmtfan (irmtfan) Assigned to: Nobody/Anonymous (nobody) Summary: customization: new smarty is needed for <title> Initial Comment: 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 <title> in the themes. 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. this title hardcode smarty is defined in class/theme.php codes: [code] $this->template->assign(array( 'xoops_theme' => $xoops->getConfig('theme_set'), 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $xoops->getConfig('theme_set') . '/', 'xoops_themecss' => $xoops->getCss($xoops->getConfig('theme_set')), 'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoops->getConfig('sitename'), ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES), 'xoops_dirname' => $xoops->moduleDirname, 'xoops_banner' => $this->renderBanner ? $xoops->getBanner() : ' ', 'xoops_pagetitle' => $xoops->isModule() ? $xoops->module->getVar('name') : htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES) )); $this->template->assign(array( 'theme_path' => $this->path, 'theme_tpl' => $this->path . '/xotpl', 'theme_url' => $this->url, 'theme_img' => $this->url . '/img', 'theme_icons' => $this->url . '/icons', 'theme_css' => $this->url . '/css', 'theme_js' => $this->url . '/js', 'theme_lang' => $this->url . '/language', )); [/code] As you can see we have xoops_slogan smarty variable but again it is used in xoops_pagetitle variable. It is bad coding. We already have xoops_slogan and xoops_sitename smarties. we should define a xoops_modulename smarty that back the module name or empty string if the module is not exist: 'xoops_modulename' => $xoops->isModule() ? $xoops->module->getVar('name') : ''; then xoops_array_pagetitle should be defined as an array in class/theme.php like this: $xoops_array_pagetitle = array(); .... 'xoops_array_pagetitle' => $xoops_array_pagetitle, 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) for example for publisher module like this: $xoops_array_pagetitle['item_title'] = ... $xoops_array_pagetitle['item_subtitle'] = ... or for newbb like this: $xoops_array_pagetitle['post_title'] = .... $xoops_array_pagetitle['topic_title'] = .... $xoops_array_pagetitle['forum_title'] = ... (sub forums and others included) $xoops_array_pagetitle['cat_title'] = .... then all modules can use the unify below code to assign xoops_array_pagetitle like this: $xoopsTpl->assign('xoops_array_pagetitle',$xoops_array_pagetitle); then can be used in all themes like this: [code] <title> <{if $xoops_array_pagetitle}> <{foreachq item=xo_title from=$xoops_array_pagetitle}> <{$xo_title}> : <{/foreach}> <{/if}> <!-- irmtfan for backward compatibility --> <{if $xoops_pagetitle !=''}> <{$xoops_pagetitle}> : <{/if}> <{$xoops_modulename}> : <{$xoops_slogan}> : <{$xoops_sitename}> </title> [/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 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=430843&aid=3561574&group_id=41586 |