{NAV_ROW} dynamic

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Marie_Huana
Posts: 9
Joined: Fri 11. Jun 2004, 16:22
Location: Mömbris, Germany
Contact:

{NAV_ROW} dynamic

Post by Marie_Huana »

Hallo zusammen,

ich benutze als Hauptnavigation den {NAV_LIST_TOP}-Tag. Als Ergänzung dazu habe ich den {NAV_ROW}-Tag im Einsatz, der Kontextbezogen die zweite Navigationsebene zeigen soll. Benutze ich aber hier {NAV_ROW:CURRENT}, so verschwindet diese Navigation, wenn ich mich in der zweiten Ebene befinde (da keine Ebene mehr untergeordnet ist). Dies lässt sich zwar mit dem Tag {NAV_ROW:INT:0} lösen, jedoch muss ich hier für jede Seite ein eigenes Template erstellen. Gibt es keine Möglichkeit, das Ziel auch mit nur einem Template zu erreichen? Ich habe von nav.php gelesen, das genau das ermöglichen soll, allerdings nur in Verbindung mit {NAV_TABLE}, nicht aber mit "ROW" funktioniert. Hat irgendjemand einen Lösungsansatz?

Vielen Dank
Fabi

----------------------------------------------------------------------------------

Cheers,

I'm using {NAV_LIST_TOP} as main navigation and I want to get the second navigation-level with {NAV_ROW}. If I use {NAV_ROW:CURRENT}, the navigation disappears when visiting a site in the second level. This could be solved by using {NAV_ROW:INT:0}, I know. But this would make necessary to use own templates for every site, so I'd like to know if there is another possibility (I read something about the nav.php that can do exactly this but this is only for {NAV_TABLE}-Tags)?!.

Thanks for your help!
Fabi
Igor
Posts: 97
Joined: Fri 30. Apr 2004, 16:30
Location: The Netherlands
Contact:

Post by Igor »

Hello,

As far as I know isn't this possible. I met the same problem. I use seven different templates. The only difference is the {NAV_ROW:x} tag.
Igor
Marie_Huana
Posts: 9
Joined: Fri 11. Jun 2004, 16:22
Location: Mömbris, Germany
Contact:

Post by Marie_Huana »

If someone is interested: It seems, I solved the problem. I modified the nav.php (from folder sample_ext_php) to navrow.php:

Code: Select all

<?php
// used to return the code for menu based on given ID
// can be used to use only 1 template for all

// get the current level ID
$check_id = $GLOBALS['content']['cat_id'];

while ( $GLOBALS['content']['struct'][$check_id]['acat_struct'] > 0 ) {
   $check_id = $GLOBALS['content']['struct'][$check_id]['acat_struct'];
}

switch($check_id) {

	case 1:		//level1
			echo '{NAV_ROW:1:0}';
			break;

	case 2: 	//level2
			echo '{NAV_ROW:2:0}';
			break;

	case 3:		//level3
			echo '{NAV_ROW:3:0}';
			break;

	case 4:		//level4
			echo '{NAV_ROW:4:0}';
			break;

	case 5:		//level5
			echo '{NAV_ROW:5:0}';
			break;

	default:	//default
			echo '{NAV_ROW:0:0}';

}

?>
As far as I tested, it works fine. Just use {PHP:} to include it instead of {NAV_ROW}. Maybe this will help someone?

Merry christmas to all of you!
Fabi
mazze
Posts: 21
Joined: Thu 3. Mar 2005, 10:14
Location: zug/switzerland
Contact:

Post by mazze »

Where did you find this sample_ext_php folder....?
Marie_Huana
Posts: 9
Joined: Fri 11. Jun 2004, 16:22
Location: Mömbris, Germany
Contact:

Post by Marie_Huana »

I think in the new DEV-Release ist is no longer included -
use older releases if you need the file.

But the code posted at the top is all you need -
just create the file yourself.
Last edited by Marie_Huana on Tue 8. Mar 2005, 21:02, edited 1 time in total.
mazze
Posts: 21
Joined: Thu 3. Mar 2005, 10:14
Location: zug/switzerland
Contact:

Post by mazze »

Marie_Huana wrote:I think in the new DEV-Release ist is no longer included -
use older releases if you need the file.

But the code posted at the top is all you need -
just create the file yourself.

Just tried it, and it works. Thanks for helping!
breitsch
Posts: 473
Joined: Sun 6. Mar 2005, 23:12
Location: bern switzerland

NAV_ROW fixed in second level

Post by breitsch »

Marie_Huana

I found a solution to fix the second navigation-level so it wont disappear when you click a link on this second level.
It works only for max. 2 navigation-levels, of course :-)
It works in DEV-Release and schould work in all former releases as well.


in file: include/inc_front/front.func.inc.php

Code: Select all

---FIND---

	// check against breadcrumb - active site tree
	if($GLOBALS['content']['struct'][$GLOBALS['content']["cat_id"]]['acat_struct'] != 0) {
		$breadcrumb = get_breadcrumb($GLOBALS['content']["cat_id"], $GLOBALS['content']['struct']);	
	}

---ADD AFTER---

	// if it wants to go deeper than 2 levels from main-navigation then set cat_id back to main-navigation-id
	if (count($breadcrumb) > 2 && strtoupper($show_id) == "CURRENT") {
	$act_cat_id = $GLOBALS['content']['struct'][$act_cat_id]['acat_struct'];
	}
in your template you can now use {NAV_ROW:CURRENT:0} (it only makes sense with actual-site OFF) for the second navigation-level so you wont have to create a different template for each main-navigation-category.
http://www.youtube.com/watch?v=jqxENMKaeCU
because it's important!
breitsch
blutch
Posts: 23
Joined: Tue 8. Mar 2005, 15:20

Post by blutch »

This works really nice. Tnx a lot.
Post Reply