Table of Contents

Level-Lift

Level can be queried independently the ID, in addition it requires a small script. I represent here the fundamental use.

Docu:
Forum: Level-Lift ([DE])

Autor: K.Heermann (flip-flop) http://planmatrix.de 2009/05/14
CMS-Version: >= V1.2.7
Update:

Condition:http://www.phpwcms-docu.de/conf_inc_php_en.phtml




Basis level and ID

We differentiate between ID-and level-based points of re-entry point. ID= Absolute point of re-entry point:

Functioned in each situation in life, even if I am not located in the characterized tree part. (ID= side structure (with the mouse over the little book sheet)).

Level= relative point of re-entry point:

E.g. a script or {RT} can be processed, if I stay in the indicated level (or level range). (Level: Regard the tree structure once in columns, then you see the level).

Condition (IDs are freely invented ):

 ------------------------------------
L  E  V  E  L
.:  :  :  :
.0  1  2  3   <- LEVEL-No.
.:  :  :  :
-+ home   :                    ID=0
-+--+ category_01              ID=01
-+--+ category_02              ID=02
-+--+--+ category_02_01        ID=04
-+--+--+--+ category_02_01_01  ID=06
-+--+--+--+ category_02_01_02  ID=07
-+--+--+ category_02_01        ID=05
-+--+--+ category_02_02        ID=08
-+--+ category_03              ID=03
-+--+ category_04              ID=09
.:  :  :  :
.0  1  2  3   <- LEVEL No.
------------------------------------

ID-based:

The level is absolutely addressed.
The advantage: This level is always processed by a script or {RT}, equal where the client stays on the side.

The disadvantage: If we use different level strands, we needed several templates for this procedure.

Level-based:

The level is relatively addressed .
The advantage: If we e.g. write one {RT} into the template all client activated levels can be addressed, which fit on the pattern.

The disadvantage: We cannot display a level, which is not called by the Client straight.


Test:

I would like to spend a particular picture if the user stays in the category category_02_01, in all other categories another picture is delivered:

ID-based:

[PHP]
if ($GLOBALS['content'][cat_id] == 4) { // ist die ID=4 aktiv? (User stays at the site category_02_01)
 
  echo <img src="img/backend/sourceforge.gif' border="0" alt="" />'.LF;
}
else {
  echo <img src="img/backend/preinfo2.jpg' border="0" alt="" />'.LF;
}
[/PHP]

A classical example of an ID-based absolutely addressed query . It is insignificant in which place the user on the side is (except in category_02_01), always a picture is delivered.

I would like to display a own picture in each case for the first, second and third level, therefore I must check the level.

Level-based:

Level check

[PHP]
$my_image = 'img/backend/preinfo2.jpg';  // preset picture level 0 and 1
 
if(isset($GLOBALS['LEVEL_ID'][2])) {   // 2 for the second level  -> is the 2nd level active?
  $my_image = 'img/backend/hotscripts.gif';  // Picture for all categories in the 2nd level
 
  if (isset($GLOBALS['LEVEL_ID'][3])) {   // does it give an active third level?
    $my_image = 'img/backend/sourceforge.gif';  // Picture for all categories in the 3rd level
  }
}
 
// Image output
echo '<img src="'.$my_image.'" border="0" alt="" />'.LF;
 
 
// ======= Test section: Output level / category / ID
$level = 0;
for ($i = 0; $i <= $level; $i++) {  // How many level are present?
  isset($GLOBALS['LEVEL_ID'][$i]) ? $level++ : $level--;
}
 
// Current category alias and ID select
 
$cat_alias = $GLOBALS['content']["struct"][$GLOBALS['content']["cat_id"]]["acat_alias"];
$cat_id =    $GLOBALS['content']['cat_id'];
 
echo 'Level='.$level.' Cat.'.$cat_alias.' ID='.$cat_id.LF;
// ======= Ende test section
 
[/PHP]

The wanted information is inside the array $LEVEL_ID[X] .

If the level is present, (isset($LEVEL_ID[X]) the current category ID is supplied as contents.

Also completely different instructions can be processed instead of the image output. No borders are set to the fantasy.

Level-Lift

The level-lift works exactly like this method and is used typically for separate navigations.

[PHP]
if(isset($GLOBALS['LEVEL_ID'][1])) {  // the first level is queried
$level_id = $GLOBALS['LEVEL_ID'][1];
echo '<div class="untermenu">'.LF;
echo '<h1>Filme</h1>'.LF;
echo '{NAV_LIST_UL:F,'.$level_id.',1,act_path,active,,,#|}';
echo '</div>';
}
[/PHP]

Level = column No. 0, 1, 2, …. (relative navigation)
ID= Numeral value of the side level in the side structure (move mouse over the little book sheet) (absolute navigation)


Since version r317 available: New tag {LEVELX_ID}

[PHP]
if(isset($GLOBALS['LEVEL_ID'][1])) {  // hier wird das erste Level abgefragt
echo '<div class="untermenu">'.LF;
echo '<h1>Filme</h1>'.LF;
echo '{NAV_LIST_UL:F,{LEVEL1_ID},1,act_path,active,,,#|}';
echo '</div>';
}
[/PHP]

Have a look: Navigation in different Levels