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.

eZ debug

Timing: Jan 18 2025 05:21:43
Script start
Timing: Jan 18 2025 05:21:43
Module start 'layout'
Timing: Jan 18 2025 05:21:43
Module start 'content'
Timing: Jan 18 2025 05:21:43
Module end 'content'
Timing: Jan 18 2025 05:21:43
Script end

Main resources:

Total runtime0.0158 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0043 587.9063152.6250
Module start 'layout' 0.00430.0036 740.531339.4453
Module start 'content' 0.00790.0058 779.976693.3047
Module end 'content' 0.01360.0022 873.281334.3047
Script end 0.0158  907.5859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002717.1773140.0002
Check MTime0.00116.8348140.0001
Mysql Total
Database connection0.00052.892010.0005
Mysqli_queries0.002515.723030.0008
Looping result0.00000.152110.0000
Template Total0.001811.210.0018
Template load0.00106.395210.0010
Template processing0.00084.773810.0008
Override
Cache load0.00074.627810.0007
General
dbfile0.00021.449880.0000
String conversion0.00000.058740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs