Return to Snippet

Revision: 8914
at October 14, 2008 03:19 by localhorst


Initial Code
<?php
/* ================================================================
14.10.2008 Tags assembled by (KH) flip-flop

TAG:
{ARTICLE_TITLE} {ARTICLE_ID} {ARTICLE_ALIAS}
{TOPLEVEL}
{PAGETITLE}={CATEGORY} {CATEGORY_ID} {CATEGORY_ALIAS}

Filename: rt_cat_article_id.php
Folder:  /template/inc_script/frontend_render/
Switch:  $phpwcms['allow_ext_render'] = 1; (/config/phpwcms/conf.inc.php)

Forum:   http://forum.phpwcms.org/viewtopic.php?p=110038#p110038
   ================================================================ */
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ----------------------------------------------------------------



// {ARTICLE_TITLE}  -> ARTICLE_TITLE replacement 
// -----------------------------------------------------
if( ! (strpos($content["all"],'{ARTICLE_TITLE}')===false)) {
   $content["all"] = str_replace('{ARTICLE_TITLE}', $GLOBALS['row']['article_title'], $content["all"]);
}

// {ARTICLE_ID}  -> ARTICLE_ID replacement
// -----------------------------------------------------
if( ! (strpos($content["all"],'{ARTICLE_ID}')===false)) {
   $content["all"] = str_replace('{ARTICLE_ID}', $GLOBALS['row']['article_id'], $content["all"]);
}

// {ARTICLE_ALIAS}  -> ARTICLE_ALIAS replacement
// -----------------------------------------------------
if( ! (strpos($content["all"],'{ARTICLE_ALIAS}')===false)) {
   $content["all"] = str_replace('{ARTICLE_ALIAS}', $GLOBALS['row']['article_alias'], $content["all"]);
}




// {TOPLEVEL}  -> TOPLEVEL replacement
// -----------------------------------------------------
if( ! (strpos($content["all"],'{TOPLEVEL}')===false)) {

$cur_toplevel_name = '';
$GLOBALS['nav_point_listing'] = get_breadcrumb($GLOBALS['content']["cat_id"], $GLOBALS['content']['struct']);

if(isset($GLOBALS['nav_point_listing']) && count($GLOBALS['nav_point_listing']) > 1) {
   reset($GLOBALS['nav_point_listing']);
   next($GLOBALS['nav_point_listing']);
   $cur_toplevel_name = html_specialchars($GLOBALS['content']['struct'][ intval(key($GLOBALS['nav_point_listing'])) ]['acat_name']);
}
$content['all'] = str_replace('{TOPLEVEL}', $cur_toplevel_name, $content['all']);
}

// {PAGETITLE}  -> PAGETITLE replacement
// sinze V1.3.5 this tag is replaced default by {CATEGORY}
// -----------------------------------------------------
if( ! (strpos($content["all"],'{PAGETITLE}')===false)) {
   $content["all"] = str_replace('{PAGETITLE}', $content["struct"][$content["cat_id"]]
["acat_name"], $content["all"]);
}

// {CATEGORY_ID}  -> CATEGORY ID replacement
// -----------------------------------------------------
if( ! (strpos($content["all"],'{CATEGORY_ID}')===false)) {
   $content["all"] = str_replace('{CATEGORY_ID}', $GLOBALS['content']["struct"][$GLOBALS['content']["cat_id"]]["acat_id"], $content["all"]);
}

// {CATEGORY_ALIAS}  -> CATEGORY ALIAS replacement
// -----------------------------------------------------
if( ! (strpos($content["all"],'{CATEGORY_ALIAS}')===false)) {
   $content["all"] = str_replace('{CATEGORY_ALIAS}', $GLOBALS['content']["struct"][$GLOBALS['content']["cat_id"]]["acat_alias"], $content["all"]);
}

// -----------[ CLOSE ]----------------
?>

Initial URL
http://forum.phpwcms.org/viewtopic.php?f=8&t=17949

Initial Description
{ARTICLE_TITLE} {ARTICLE_ID} {ARTICLE_ALIAS}
{TOPLEVEL}
{PAGETITLE} = {CATEGORY} (since v1.3.5 )
{CATEGORY_ID} {CATEGORY_ALIAS}

Filename: rt_cat_article_id.php
Folder: /template/inc_script/frontend_render/
Switch: $phpwcms['allow_ext_render'] = 1; (/config/phpwcms/conf.inc.php)

Initial Title
phpwcms article replacement tags

Initial Tags

                                

Initial Language
PHP