• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Hierarchy Manager: Getting the root for each node
PostPosted: Tue May 09, 2006 3:10 pm 
Offline
Power Poster
Power Poster

Joined: Wed Sep 08, 2004 3:32 pm
Posts: 523
Hi there,

I am trying to change an image in the header by using a unique id on the body tag. Let's assume my structure looks like this:

  1. Home
  2. Services
  2.1. First
  2.2. Second
  3. Contact
  3.1. Address
  3.2. Form

Is it possible to assign if home is active and if either Services, First or Second are active and of course if Contact, Address or Form is active?

I thought about "abusing" MenuManger to achieve this, but I didn't get it right. Then I read about Hierarchy Manager which has been introduced in 0.12 but for this one I couldn't find any documentation. Any help would be highly appreciated.

Regards,
Nils


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Wed May 17, 2006 12:50 pm 
Offline
Power Poster
Power Poster

Joined: Wed Sep 08, 2004 3:32 pm
Posts: 523
Actually I did abuse the MenuMager for this one ... here is how it works:

Code:
{foreach from=$nodelist item=node}
{if $node->current == true}{$node->hierarchy|truncate:1:""}{/if}
{/foreach}


Just in case somebody needs it ...

Regards,
Nils


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Wed May 17, 2006 1:13 pm 
Offline
Power Poster
Power Poster

Joined: Tue Dec 13, 2005 10:50 pm
Posts: 1415
Location: Finland
Great find nils.

It might be better to collect these into wiki. just have to think for a place for these (maybe in the tips and trics section)


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Wed May 17, 2006 1:22 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Mon Apr 24, 2006 1:01 am
Posts: 811
Location: Deatsville, AL
nils73 wrote:
Actually I did abuse the MenuMager for this one ... here is how it works:

Code:
{foreach from=$nodelist item=node}
{if $node->current == true}{$node->hierarchy|truncate:1:""}{/if}
{/foreach}


Thanks Nils! I had been wondering how to get just the first digit of $node->hierarchy, but I didn't know about truncate. Thanks for showing me.

tsw wrote:
It might be better to collect these into wiki. just have to think for a place for these (maybe in the tips and trics section)

I've been adding mine to this page: http://wiki.cmsmadesimple.org/index.php ... nu_Manager
It would be cool it other people added theirs.  :)

_________________
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Wed May 17, 2006 1:27 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 10682
Location: Arizona
what does this render on page or HTML/view source?

  mark

_________________
Extensions » Modules/Tags click the name of the module/tag or Help to the right to get it's parameters.
Right click and view source is a great way to see what you have to work with.
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/

Image


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Thu May 18, 2006 1:19 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Mon Apr 24, 2006 1:01 am
Posts: 811
Location: Deatsville, AL
mark wrote:
what does this render on page or HTML/view source?

It would render the first digit of $node->hierarchy. For example if you have the following layout:
nils73 wrote:
  1. Home
  2. Services
  2.1. First
  2.2. Second
  3. Contact
  3.1. Address
  3.2. Form

and the current page is "Services", "First, or "Second" then a "2" would be outputted. If the current page is "Contact, Address, or Form" then a "3" would be outputted.

I'm guessing this is what it does based on the code. I haven't tried it.  ;)

_________________
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Thu May 18, 2006 4:50 am 
Offline
Power Poster
Power Poster

Joined: Wed Sep 08, 2004 3:32 pm
Posts: 523
Elijah,

right you are. It just outputs the first char of the node-elemente by truncating the whole string to 1 --- so it would not be suitable for websites with long main-menus but then Jacob Nielsen says you should not use more than 7 ... so truncate should do the trick almost every time.

In my case I needed it to have a CSS signature attached to the body so that it is like this in CMSMS-templates:

Code:
<body id="cat{cms_module module='menumanager' template='getSection'}">


Which means I have created a template called "getSection" in MenuManager which then renders as follows:

1. Home
2. Services
2.1. First
2.2. Second
3. Contact
3.1. Address
3.2. Form

By using CSS you can then specify a lot of thing, such as a different header-image for each section for example by using

Code:
#cat3 div.header { background: url(imageforsection3.jpg); }


which would then be a different image for all header-divs that have been assigned the CSS signature for cat3 (Contact, Address, Form). But I can think of many other cases where this turns out to be very handy ...

Regards,
Nils


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Thu May 18, 2006 9:56 am 
Offline
Administrator
Administrator
User avatar

Joined: Fri Jun 11, 2004 6:58 pm
Posts: 3334
Location: Fairless Hills, Pa USA
Untested, but this might help for situations where you do go over 10.

Code:
{$node->hierarchy|truncate:2:""|strip:"."}

_________________
http://about.me/tedkulp


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Sun Jan 07, 2007 6:33 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri May 05, 2006 7:55 pm
Posts: 293
Location: New Haven, CT
YES!!!!

this is basically
exactly
what i am looking for, except i need to give each main button it's own class

oh, please, someone, help :D

_________________
If I help you, please give good karma. If I'm rude, give me bad karma. I like to know where I balance out in the end :).


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Sun Jan 07, 2007 6:44 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 10682
Location: Arizona
In menu manager the template you are using add class="a{node->id}" which should output class="a15" for home page, you need a letter in front of it a it doesn't like numbers only...

_________________
Extensions » Modules/Tags click the name of the module/tag or Help to the right to get it's parameters.
Right click and view source is a great way to see what you have to work with.
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/

Image


Top
 Profile  
 
 Post subject: Re: Hierarchy Manager: Getting the root for each node
PostPosted: Sun Jan 07, 2007 7:30 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri May 05, 2006 7:55 pm
Posts: 293
Location: New Haven, CT
Hi Mark,

Thank you!!! Thank you!!!!

I was kind of thinking that, and just testing it... you saved me a lot of additional testing trying to figure out if it would work or not.

_________________
If I help you, please give good karma. If I'm rude, give me bad karma. I like to know where I balance out in the end :).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: goatee2905


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Arvixe - A CMSMS Partner