Page 1 of 1

Get the current site structure level

Posted: Mon 21. Feb 2005, 11:22
by Rainer G
With:
{NAV_TABLE_COLUMN:integer}
can i set the beginning of the NavMenü.

With {NAV_ROW_CURRENT} starts the Menü with the next entry below. This will i do with the NAV_TABLE_COLUMN.

How can i get the current id to set in {NAV_TABLE_COLUMN:id}?

A good new replacement-tag for the future: {NAV_TABLE_CURRENT} :D

Posted: Mon 21. Feb 2005, 11:48
by rk
Try {NAV_LIST}, now available in the dev-release.

http://www.phpwcms.de/forum/viewtopic.php?p=32037#32037

Posted: Mon 21. Feb 2005, 11:59
by Rainer G
I use the RC4 :-(, the dev only for testing.

Posted: Mon 21. Feb 2005, 12:09
by Pappnase
hello

to get the id move the mouse over this icon in admin -> sitestructure, then you will see it.

Image

Posted: Mon 21. Feb 2005, 12:17
by Rainer G
doubleposting :x

Posted: Mon 21. Feb 2005, 12:17
by Rainer G
Pappnase wrote:hello

to get the id move the mouse over this icon in admin -> sitestructure, then you will see it.

Image
Witzbold :-)

I will script this in the template/left with coding like this:

{NAV_TABLE_COLUMN:
[PHP]
echo $get_current_navid;
[/PHP]
integer}

I will use one template and not one for every subpage!

It will be look at this page from Pepe:
http://www.peperkorn-online.de/index.php

You understand me?

Posted: Wed 23. Feb 2005, 21:39
by Rainer G
anyone an idea?

Posted: Wed 23. Feb 2005, 23:53
by Karla

Posted: Thu 24. Feb 2005, 02:10
by Rainer G
With your help i have this written (it's not a good code, but it runs how i will):

Code: Select all

[PHP]
$id = $GLOBALS['content']['cat_id'];
$parent_id=$GLOBALS['content']['struct'][$id]['acat_struct'];

if ($id==0) {$top_id = $id;}			// Home
elseif ($parent_id==0) {$top_id = $id;}	// Sub 1
else {
 $id=$parent_id;
 $parent_id=$GLOBALS['content']['struct'][$id]['acat_struct'];
 if ($parent_id==0) {$top_id=$id;}		// Sub 2
 else {
  $id=$parent_id;
  $parent_id=$GLOBALS['content']['struct'][$id]['acat_struct'];
  if ($parent_id==0) {$top_id=$id;}	// Sub 3
  else {
   $id=$parent_id;
   $parent_id=$GLOBALS['content']['struct'][$id]['acat_struct'];
   if ($parent_id==0) {$top_id=$id;}	// Sub 4
  }
  // Add here next
 }
}
//echo "Top: ".$top_id." ID: ".$id." Parent: ".$parent_id;
if ($top_id > 0) {echo '{NAV_TABLE_COLUMN:'.$top_id.'}';}
[/PHP]
And for every additional sub structure, add this lines:

Code: Select all

  else {
   $id=$parent_id;
   $parent_id=$GLOBALS['content']['struct'][$id]['acat_struct'];
   if ($parent_id==0) {$top_id=$id;}	// Sub 4
  }
  // Add here next
:D :D :D :mrgreen: :D :D :D :mrgreen: :D :D :D

Posted: Thu 3. Mar 2005, 10:40
by kiwix
Hi Rainer,

I used your code, but I thought it was a bit to difficult (and ugly :-) ).
So I tried to optimize it a bit. On my intsallation it seams to word and you you haven't to do the check for every sub level of your structure.

Code: Select all

[PHP]
$id        = $GLOBALS['content']['cat_id'];
$parent_id = $GLOBALS['content']['struct'][$id]['acat_struct'];
if ($id!=0) {
  while ($parent_id != 0):
    $id=$parent_id;
    $parent_id=$GLOBALS['content']['struct'][$id]['acat_struct'];
  endwhile;
}
if ($id > 0) {
  echo '{NAV_TABLE_COLUMN:'.$id.'}';
}
[/PHP]
Cheers
KiWiX

Posted: Thu 3. Mar 2005, 21:01
by Rainer G
Hi Kiwix!

Meanwhile i use my selfoptimized code:

Code: Select all

$id = $GLOBALS['content']['cat_id'];

 $parent_id=$GLOBALS['content']['struct'][$id]['acat_struct'];
 While ($parent_id<>0){
   $id=$parent_id;
   $parent_id=$GLOBALS['content']['struct'][$id]['acat_struct'];
 }

 if ($id > 0) {
  echo '{NAV_TABLE_COLUMN:'.$id.'}';
 }
8) 8) 8)