{GT} and custom replacement tags
Posted: Sat 16. Jul 2005, 06:52
hi all
while writeing a question post about the gt used by custom tag, i found the soluton for the problem/bug
i wanted to create gt menus with custom tags, but this dont work because the gt mod is called before
the included custom files.
include\inc_front\content.func.inc.php
the {GT} part has to be moved after the custom function part
so that custom tags can use {GT} functions
should look like that afterwards
but i dont know if this makes any other problem because of loading after the "redirection" stuff.
maybe oliver can tell.
if the change makes no problem, maybe oliver can change it so that it works for all.
after the change the following will work
"phpwcms_template\inc_script\frontend_render\sublevelnav.php"
just an idea: if you missuse the "phpwcms_template\inc_script\frontend_init\youfile.php" it should also work, because it it called before gt. (havenot tested this)
greets
This post was lovingly crafted with Pawsoft Fass, the (F)orum (ass)istant
while writeing a question post about the gt used by custom tag, i found the soluton for the problem/bug
i wanted to create gt menus with custom tags, but this dont work because the gt mod is called before
the included custom files.
include\inc_front\content.func.inc.php
the {GT} part has to be moved after the custom function part
Code: Select all
// -------------------------------------------------------------
// Jérôme's Graphical Text MOD
// Coypright (C) 2004 by
if($phpwcms["gt_mod"]) { //enabled/disable GT MOD
require_once ('include/inc_module/mod_graphical_text/inc_front/gt.func.inc.php');
}
// -------------------------------------------------------------
// -------------------------------------------------------------
// add possible redirection code (article summary) to $block["htmlhead"];
$block["htmlhead"] = render_PHPcode($block["htmlhead"]);
$block["htmlhead"] = $content["redirect"]["code"].$block["htmlhead"]."\n";
$block["htmlhead"] .= '<meta name="generator" content="phpwcms v'.$phpwcms['version']."\">\n";
// insert description meta tag if not definied
if(!stristr($block["htmlhead"], '"description"') && $content["struct"][$aktion[0]]["acat_info"]) {
$block["htmlhead"] .= '<meta name="description" content="';
$block["htmlhead"] .= html_specialchars($content["struct"][$aktion[0]]["acat_info"])."\">\n";
}
// insert keywords meta tag if not definied
//if(!stristr($block["htmlhead"], '"keywords"') && !empty($content["articles"][$aktion[1]]["article_keyword"])) {
if(!stristr($block["htmlhead"], '"keywords"') && !empty($content['all_keywords'])) {
$content['all_keywords'] = explode (",", $content['all_keywords']);
$content['all_keywords'] = array_map('trim', $content['all_keywords']);
$content['all_keywords'] = array_diff($content['all_keywords'], array(''));
$content['all_keywords'] = array_unique($content['all_keywords']);
$block["htmlhead"] .= '<meta name="keywords" content="';
$block["htmlhead"] .= html_specialchars(implode(', ', $content['all_keywords']))."\">\n";
}
// -------------------------------------------------------------
// if you want to use the Coppermine slideshow hack
// {SLIDESHOW:ID}
//include('sample_ext_php/slideshow.php');
// -------------------------------------------------------------
// try to include custom functions and replacement tags or what you want to do at this point of the script
// default dir: "phpwcms_template/inc_script/frontend_render"; only *.php files are allowed there
if($phpwcms["allow_ext_render"]) {
if(count($custom_includes = get_tmpl_files(PHPWCMS_TEMPLATE.'inc_script/frontend_render', 'php'))) {
foreach($custom_includes as $value) {
include_once(PHPWCMS_TEMPLATE.'inc_script/frontend_render/'.$value);
}
}
}
should look like that afterwards
Code: Select all
// -------------------------------------------------------------
// -------------------------------------------------------------
// add possible redirection code (article summary) to $block["htmlhead"];
$block["htmlhead"] = render_PHPcode($block["htmlhead"]);
$block["htmlhead"] = $content["redirect"]["code"].$block["htmlhead"]."\n";
$block["htmlhead"] .= '<meta name="generator" content="phpwcms v'.$phpwcms['version']."\">\n";
// insert description meta tag if not definied
if(!stristr($block["htmlhead"], '"description"') && $content["struct"][$aktion[0]]["acat_info"]) {
$block["htmlhead"] .= '<meta name="description" content="';
$block["htmlhead"] .= html_specialchars($content["struct"][$aktion[0]]["acat_info"])."\">\n";
}
// insert keywords meta tag if not definied
//if(!stristr($block["htmlhead"], '"keywords"') && !empty($content["articles"][$aktion[1]]["article_keyword"])) {
if(!stristr($block["htmlhead"], '"keywords"') && !empty($content['all_keywords'])) {
$content['all_keywords'] = explode (",", $content['all_keywords']);
$content['all_keywords'] = array_map('trim', $content['all_keywords']);
$content['all_keywords'] = array_diff($content['all_keywords'], array(''));
$content['all_keywords'] = array_unique($content['all_keywords']);
$block["htmlhead"] .= '<meta name="keywords" content="';
$block["htmlhead"] .= html_specialchars(implode(', ', $content['all_keywords']))."\">\n";
}
// -------------------------------------------------------------
// if you want to use the Coppermine slideshow hack
// {SLIDESHOW:ID}
//include('sample_ext_php/slideshow.php');
// -------------------------------------------------------------
// try to include custom functions and replacement tags or what you want to do at this point of the script
// default dir: "phpwcms_template/inc_script/frontend_render"; only *.php files are allowed there
if($phpwcms["allow_ext_render"]) {
if(count($custom_includes = get_tmpl_files(PHPWCMS_TEMPLATE.'inc_script/frontend_render', 'php'))) {
foreach($custom_includes as $value) {
include_once(PHPWCMS_TEMPLATE.'inc_script/frontend_render/'.$value);
}
}
}
// -------------------------------------------------------------
// Jérôme's Graphical Text MOD
// Coypright (C) 2004 by
if($phpwcms["gt_mod"]) { //enabled/disable GT MOD
require_once ('include/inc_module/mod_graphical_text/inc_front/gt.func.inc.php');
}
maybe oliver can tell.
if the change makes no problem, maybe oliver can change it so that it works for all.
after the change the following will work
"phpwcms_template\inc_script\frontend_render\sublevelnav.php"
Code: Select all
if( ! ( strpos($content["all"],'{MY_NAV_ROW')===false ) ) {
$GLOBALS['template_default']["nav_row"]["link_direct_before"] = '{GT:menu}';
$GLOBALS['template_default']["nav_row"]["link_direct_after"] = '{/GT}';
$GLOBALS['template_default']["nav_row"]["link_direct_before_active"] = '{GT:menu}';
$GLOBALS['template_default']["nav_row"]["link_direct_after_active"] = '{/GT}';
$content["all"] = str_replace('{MY_NAV_ROW}', nav_level_row(0), $content["all"]);
$content["all"] = preg_replace('/\{MY_NAV_ROW:(\w+|\d+):(0|1)\}/e',"nav_level_row('$1',$2);",$content["all"]);
}greets
This post was lovingly crafted with Pawsoft Fass, the (F)orum (ass)istant