NAVIGATION
System-oriented link representation of category, article, print.
This representation can be used actively to operate as a link or query the existing status.
0 = structure ID 1 = article ID 2 = e.g. if 1 then print 3 = if 1 then show category 4 = if a link to an article then show (1) 5 = free use
Provided at: /include/inc_front/content.func.inc.php
$aktion = array(0,0,0,0,1,0);
$aktion = explode(',', $_GET["id"], 6); $aktion[0] = intval($aktion[0]); //$aktion[0] will be always available // structure ID $aktion[1] = isset($aktion[1]) ? intval($aktion[1]) : 0; // article ID $aktion[2] = isset($aktion[2]) ? intval($aktion[2]) : 0; // e.g. if 1 then print $aktion[3] = isset($aktion[3]) ? intval($aktion[3]) : 1; // if 1 then show cat $aktion[4] = isset($aktion[4]) ? intval($aktion[4]) : 0; // if a link to an article then show (1) $aktion[5] = isset($aktion[5]) ? intval($aktion[5]) : 0; // free use
Request using $GLOBALS['aktion']
The category ID:
echo 'Cat-ID: '.$GLOBALS['aktion']['0'];
The article ID (Output only in article detail view):
echo 'Article-ID: '.$GLOBALS['aktion']['1'];
When we are in category view? [1=Yes|0=No]
echo 'CatShow: '.$GLOBALS['aktion']['3'];
When we are in article detail view? [1=Yes|0=No]:
echo 'Detail: '.$GLOBALS['aktion']['4'];
Assumption: A category (ID=7) operating in simple article mode (ID=26) (Top article count: -1, or if the number of top articles: > 1 and article count = 1)
[0] => 7 // category-ID [1] => 26 // article-ID [2] => 0 [3] => 1 // category view [4] => 1 // article detail view [5] => 0
As a link: index.php?id=7,26,0,1,1,0
Assumption: A category (ID=2) operating in article list mode (ID=26,6,5,3) (Top article count: > 1, article count > 1)
[0] => 2 // category-ID [1] => 0 [2] => 0 [3] => 1 // category view [4] => 0 [5] => 0
As a link: index.php?id=2,0,0,1,0,0
[0] => 2 // category-ID [1] => 6 // article-ID [2] => 0 [3] => 0 [4] => 1 // article detail view [5] => 0
As a link: index.php?id=2,6,0,0,1,0
Be shure you have set in conf.inc.php
$phpwcms['allow_cntPHP_rt'] = 1; //allow PHP replacement tags and includes in content parts
<!-- Var Dump =================== //--> [PHP] echo '<pre>LEVEL ID</pre>'; dumpVar($GLOBALS['LEVEL_ID']); echo '<pre>LEVEL KEY</pre>'; dumpVar($GLOBALS['LEVEL_KEY']); echo '<pre>LEVEL STRUCT</pre>'; dumpVar($GLOBALS['LEVEL_STRUCT']); echo '====================== <br /> '; dumpVar($GLOBALS['content']["articles"]); // article-structure dumpVar($GLOBALS['content']["struct"]); // category-structure // article list mode: if more then one article available and in site structure -> category -> top article count: > 1 dumpVar($GLOBALS['content']["list_mode"]); // (true|false) // top article count for article list mode in site structure -> category -> top article count: dumpVar($GLOBALS['content']['struct'][$content['cat_id']]['acat_topcount']; // (count) // Article title of the current article (detail mode) dumpVar($GLOBALS['content']['article_title']); // Article subtitle of the current article (detail mode) dumpVar($GLOBALS['content']['articles'][$GLOBALS['content']['article_id']]['article_subtitle']); [/PHP] <!-- ====================== //-->
The variable $content['all_keywords'] (or $GLOBALS['content']['all_keywords'] if used in functions ) supplies the Keywords of the current article.
E.g.: Write the keywords into an array:
$keywords_array = convertStringToArray($GLOBALS['content']['all_keywords']);
E.g.: Forum Css eines Artikels ändern [DE]
A special CSS formatting for an article:
Question:
“If I liked to indicate a special css for only one article , where will I do that? > > For explanation, I would like to have individual articles with a dark instead of a bright page background.”
Answer:
“I would work with a special keyword by using a frontend_render script to trigger it accordingly. Set the keyword “*CSS-dark*” into the appropriate fiel dof the article. When rendering is checked out the <body> tag is enhanced by the corresponding class. This normally can be defined via CSS.”
frontend_init
if(strpos($content['all_keywords'], '*CSS-dark*') !== false) { $template_default['body']['class'] = 'dark level-'; $content['all_keywords'] = str_replace('*CSS-dark*', '', $content['all_keywords']); } ?>
CSS:
body.dark { background-color: #666666; }
Attention - the class(es) “dark level-” were selected intentionally in such a way, since still additionally the level ID is given.
Update 25.06.2009: Revision: r317
Now it is possible to select the current category ID related to the level.
<div style="font-size:10px;"><br> <b>Old Level-Ids:</b><br> ---------------------------<br> [PHP] // Old Level-Ids echo ( (isset($GLOBALS['LEVEL_ID'][1])) ? ( 'Level 1 ID='. $GLOBALS['LEVEL_ID'][1]) : 'no level 1' ) . '<br \/>'; echo ( (isset($GLOBALS['LEVEL_ID'][2])) ? ( 'Level 2 ID='. $GLOBALS['LEVEL_ID'][2]) : 'no level 2' ) . '<br \/>'; echo ( (isset($GLOBALS['LEVEL_ID'][3])) ? ( 'Level 3 ID='. $GLOBALS['LEVEL_ID'][3]) : 'no level 3' ) . '<br \/>'; echo ( (isset($GLOBALS['LEVEL_ID'][4])) ? ( 'Level 4 ID='. $GLOBALS['LEVEL_ID'][4]) : 'no level 4' ) . '<br \/>'; [/PHP] <br> <b>New Level-Ids (since r317):</b><br> ---------------------------<br> {LEVEL1_ID:} {LEVEL1_ID} <br> {LEVEL2_ID:} {LEVEL2_ID} <br> {LEVEL3_ID:} {LEVEL3_ID} <br> {LEVEL4_ID:} {LEVEL4_ID} <br> ---------------------------<br> <!-- =================== //--> </div> <!-- end font-size //-->
Actual level No. / Actual category alias / Actual category-ID
Autor: K.Heermann (flip-flop) http://planmatrix.de 2009/05/14
CMS-Version: >= V1.2.7
Tag: {LEVCATID}
File: template/inc_script/frontend_render/rt_levcatid.php
Condition: → /config/phpwcms/conf.inc.php
<?php // ---------------------------------------------------------------- // OBLIGATE CHECK FOR PHPWCMS CONSTANTS if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");} // ---------------------------------------------------------------- // FE output {LEVCATID}: Actual level No. / Actual category alias / Actual category-ID function LEV_CAT_ID () { $level = 0; for ($i = 0; $i <= $level; $i++) { // Wieviele Level sind vorhanden? isset($GLOBALS['LEVEL_ID'][$i]) ? $level++ : $level--; } // Catch actual category alias- and ID $cat_alias = $GLOBALS['content']["struct"][$GLOBALS['content']["cat_id"]]["acat_alias"]; $cat_id = $GLOBALS['content']['cat_id']; // ======= End test section return '[LEVEL='.$level.' | CAT='.$cat_alias.' | ID='.$cat_id.']'.LF; } $content['all'] = str_replace('{LEVCATID}', '<span style="color:green; font-size:10px; font-weight:bold;">'.LEV_CAT_ID().'</span>', $content['all']); ?>
Have a look: Standard tags assembled
Example: The variable is called “cpimage” and is containing an integer value.
$site = $GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root']; $cat_alias = $GLOBALS['content']["struct"][$GLOBALS['content']["cat_id"]]["acat_alias"]; $href_str = $site.'index.php?'.$cat_alias; $get_str = 'cpimage=';
z.B. http://my_site.tld/index.php?active_category&cpimage=34
$my_number = 34; $my_complete_link = $href_str.'&'.$get_str.$my_number; // http://my_site.tld/index.php?active_category&cpimage=34
// Is there a GET var? if (isset($GLOBALS['_getVar']['cpimage'])) { $GLOBALS['_getVar']['cpimage'] = intval($GLOBALS['_getVar']['cpimage']); // Convert to integer $cpImgNr = $GLOBALS['_getVar']['cpimage']; } else $cpImgNr = false; // if there is no GET var set it to false
The integer value in $cpImgNr can be processed now, but should be checked prior to “false”.