Forums / Setup & design / Section Id and Node Id

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.

eZ debug

Timing: Jan 18 2025 02:06:14
Script start
Timing: Jan 18 2025 02:06:14
Module start 'content'
Timing: Jan 18 2025 02:06:14
Module end 'content'
Timing: Jan 18 2025 02:06:14
Script end

Main resources:

Total runtime0.1563 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 588.8203180.8438
Module start 'content' 0.00640.0052 769.664197.8516
Module end 'content' 0.01160.1446 867.5156526.5000
Script end 0.1562  1,394.0156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00332.0797200.0002
Check MTime0.00130.8218200.0001
Mysql Total
Database connection0.00110.699310.0011
Mysqli_queries0.112271.79851410.0008
Looping result0.00120.73961390.0000
Template Total0.144192.210.1441
Template load0.00090.590710.0009
Template processing0.143291.627110.1432
Override
Cache load0.00070.424110.0007
Sytem overhead
Fetch class attribute can translate value0.00080.540010.0008
XML
Image XML parsing0.00020.122210.0002
General
dbfile0.00382.4265200.0002
String conversion0.00000.003830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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