Section Id and Node Id

Author Message

jonathan howes

Wednesday 30 April 2003 2:43:54 pm

is there a way to return the node id of the first folder/article etc. in a section.

IE, in the demo data the section 3 has a folder (my company) in the root list - I would like to return the value of the node id of that folder regardless of where you are in the site if you query for section3 node.id

Query Section 3 Node id = 16 (for example this # may be wrong) but you get the idea

this way you could assign a link to a section based on the section id rather than knowing the node id and having to hard code it in multiple page formats.

I have used the section Id to link images etc. but this will not work for items like the nest folder tree as you need to assign a top category .

Any help as always appreciated.

Jonathan

jonathan howes

Wednesday 30 April 2003 3:46:38 pm

I have been looking into this further and it appears I answered my own question (forgive me for being a Newbie - my actual profession is as an accountant)

This is what I have come up with ( parent_node_id,2 is my root folder of the enire site - I then have 11 different sections and each folder in the root is assigned to a different section)

IE,
Root
Folder1 (section1)
- Sub pages and folders
Folder2 (section2)
- Sub pages and folders
.
.
Folder11 (Section11)
-Sub pages and folders

I used to need 11 templates (one for each section) that all share common script except for references relating to images, and menu bars etc. I can now have 1 main template for all 11 and use variables throughout based on the uniques section id's. A specific example is the top_cat variable in the nav tree menu .

{let name=Child children=fetch('content','list',hash(parent_node_id,2))}

{section loop=$:children}
{section show=eq $Child:item.object.section_id,$DesignKeys:used.section)}
{$Child:item.node_id}
{/section}
{/section}
{/let}

I am stuck on how to this variable {Child:itm.node_id} to the variable top_cat that is used in the nav tree menu?? I have tried set and top_cat= but it does not seem to work -

If you have any suggestions please let me know

I seem to be having difficulty understanding the way you pass variables.

I am going to move on for now to sort out how to loop through the nav tree menu based on a count of how deep the folder structure is - rather than having to pre-define all the levels manually. This will include a way to show the active items with varying css applied based on that depth.

On another note I have modified the the sitemap to always show the node_id to make things easier to understand - this is a simple mod I can post for any new people if they want - it helps understand the site structure.

jonathan

Gunnstein Lye

Friday 02 May 2003 6:55:24 am

I'm not entirely sure I understand what you want to do, but here is my suggestion:

{let children=fetch('content','list',hash(parent_node_id,2))
top_cat=false()}

{section name=Child loop=$children}
{section show=eq $:item.object.section_id,$DesignKeys:used.section)}
{set top_cat=$:item.node_id}
{/section}
{/section}

{* Now you can use $top_cat (within the let pair). *}
top_cat is: {$top_cat}

{/let}

The {set} function requires that you have created the variable with {let} or {default} in advance.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.