How to use {NAV_TABLE_COLUMN:[sectionID]} dynamically?

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
jamba
Posts: 50
Joined: Fri 23. Apr 2004, 11:18
Location: UK
Contact:

How to use {NAV_TABLE_COLUMN:[sectionID]} dynamically?

Post by jamba »

I would like to use the {NAV_TABLE_COLUMN:1} replacement tag so that I can have subcategories displayed when you click on each section. The {NAV_TABLE_COLUMN:1} replacement tag will produce a menu of each subsection of ID 1, but how do can I make this generate according to the section you're in?
Example:
About us
- Privacy
- Conditions
- Contact
Services
- Design
- Production
- Testing
When you're looking at any page within the About us section, I'd like the nav to show all 3 subsections on the left. Likewise when in Services, I'd like each of the 3 Services subsections shown.

Any ideas :?
Russ Back :D
Jamba Solutions
http://jambasolutions.com
argos
Posts: 135
Joined: Mon 15. Mar 2004, 20:02

Post by argos »

If I understand correctly what you mean is the same as I did on http://www.argosmail.net

If so, then do this:

Create a different template for each section, so one for About Us and one for Services. The templates only differ in the number in {NAV_TABLE_COLUMN:1}. Assign each category their own template.
Regards,
Jurgen Nijhuis
http://www.argosmedia.nl
jamba
Posts: 50
Joined: Fri 23. Apr 2004, 11:18
Location: UK
Contact:

Post by jamba »

Thanks, argos.

I thought if this but was hoping there was a more intuitive way around it. I guess that's what I'll have to do.
Russ Back :D
Jamba Solutions
http://jambasolutions.com
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

Hi Jamba, You need to get the 'site structure' integer and create separate templates based on these. For example

Code: Select all

{NAV_TABLE_COLUMN:12}
{NAV_TABLE_COLUMN:8}
etc 


"This integer can be found by rolling your cursor over the site structure icons in the admin-site structure section. Using this parameter, menus are generated from this site structure level and below."

from:

http://docu.fhss.de/navigation_tags.phtml

Hope this helps.....
User avatar
Oliver Georgi
Site Admin
Posts: 9907
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

check file in "sample_ext_php/nav.php".

There you can find a solution to get the ID of a parental structure - like when using a breadcrumb menu.

Then only 1 template for everything is neccessary (often).

Oliver
Last edited by Oliver Georgi on Sun 26. Sep 2004, 22:53, edited 1 time in total.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

Hi Oliver....Nice feature which I had never looked into. So basically, if you don't mind doing a little hard-coding, then putting expression in a given page template:

Code: Select all

{PHP:sample_ext_php/nav.php}
will return the 'dynamic' context sensitive menu.
Nice, maybe this needs to be documented a little more on the docu.fhss.de site.

cheers,
john
Flinti
Posts: 19
Joined: Mon 3. May 2004, 21:42

Post by Flinti »

hi

I've tried the nav.php. I am using for my main navigation

Code: Select all

{NAV_ROW}
and for my left navigation

Code: Select all

{PHP:sample_ext_php/nav.php}
from oliver.
Now lets say my site structure looks like this:

a
.aa
.ab
.ac
b
.ba
.bb
.bc

a and b are used by {NAV_ROW} and .aa .ab and so on are used by nav.php. Now when my left navi is like this:

.aa
.ab
.ac

and then i click on .aa or .ab or so, my left navigation disapears... but i would like that it stays. How could i fix this problem? is it even possible by using sample_ext_php/nav.php ? or must i do it by using NAV_TABLE_COLUMN:X}? (but i would like to do it with only one template)

thx for any help
Flinti
Posts: 19
Joined: Mon 3. May 2004, 21:42

Post by Flinti »

kann man in sample_ext_php/nav.php eine abfrage einbauen, die schaut ob der jeweilige menüpunt ein untermenü besitzt?

wäre um jede hilfe dankbar.
Jimmy_Jazz
Posts: 23
Joined: Thu 28. Oct 2004, 13:04
Location: London

Post by Jimmy_Jazz »

Oliver Georgi wrote:check file in "sample_ext_php/nav.php".

There you can find a solution to get the ID of a parental structure - like when using a breadcrumb menu.

Then only 1 template for everything is neccessary (often).

Oliver

Hi

Ive created a graphics based navigation and used the nav.php example to make it dynamic as suggested by Oliver. It works fine. However is there any way of grouping some cases - if you would like several categories to echo the same line of code rather than having to duplicate the same lines of code?

i.e

case 1 & 2 & 3 :
echo '<img src="template/head/agenda.gif" width="131" height="19" alt="Agenda" />';
echo '{NAV_TABLE_COLUMN:1}';
break;

Sorry if this is a stupid question but my php isnt very good although i understand a little.


Thanks
Gnolen
Posts: 158
Joined: Thu 11. Mar 2004, 11:34

Post by Gnolen »

Yeah, this is a great solution but when I make one the subcategories doesn't display the colomn. How can I resolve this?

It wouldn't be a problem if I could do like Jimmy_Jazz wrote 'case 1 & 2 & 3 :'
and so on..

But this would still be a problem when clients add a page...

Any idees anyone?

Greetings from

Martin
leone
Posts: 21
Joined: Tue 19. Oct 2004, 11:30
Location: Switzerland

Post by leone »

Try this, enter in nav.php before the switch statement:

Code: Select all

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 '<img src="template/head/agenda.gif" width="131" height="19" alt="Agenda" />';
			echo '{NAV_TABLE_COLUMN:1}';
			break;
			
	case 2: 	//level2
			echo '<img src="template/head/events.gif" width="131" height="19" alt="Events" />';
			echo '{NAV_TABLE_COLUMN:2}';
			break;

.......

This will cause the program to find the topmost menu before the index menu (0) in any case. This will always show the full left menu, regardless of what level you descend into.

regards,
Leone
Jimmy_Jazz
Posts: 23
Joined: Thu 28. Oct 2004, 13:04
Location: London

Post by Jimmy_Jazz »

Hi Leone

This is just what i needed but when i replace the code i get the following error:

Parse error: parse error, unexpected T_STRING in /home/wallcrea/public_html/loopdream/sample_ext_php/nav.php on line 35


line 35 is the second line of your replacement code.

Any ideas?
gogoguerilla
Posts: 29
Joined: Mon 12. Apr 2004, 01:22

RE

Post by gogoguerilla »

I ran into the same problem as Jimmy.. any follow-ups?

Thanks!
Post Reply