Code to display children of current section

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
grimmus
Forum Members
Forum Members
Posts: 28
Joined: Sun Jan 11, 2009 7:17 am

Code to display children of current section

Post by grimmus »

Hi,

I would like to have a left sub menu that only shows the children of the current section. So, for example, if i am browsing the news section, the children of the news node only appear on the left.

Also, if there are no children of the current node i would like to display some news items. How can i check if the child count of the current node is 0 ?

Thanks again
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Code to display children of current section

Post by Dr.CSS »

I take it you know how to make the menu show children of current page, as for the put news in if no menu items to show thing you need some kind of {if} statement...

{if div !empty=1 show menu}
{else}
{news}
{/if}

Now keep in mind I'm not a programmer just a template builder, but I've seen enuf of this kind of code on this forum to make a guess at the syntax... ;)
JeremyBASS

Re: Code to display children of current section

Post by JeremyBASS »

you can also pipe news in to the menu... then you only need to worrie about the child menu in general...
this has blogs as an ex... but you can switch blogs for news...

http://forum.cmsmadesimple.org/index.ph ... #msg136822

My2Cents
cheers
Jeremy
szetlan
Forum Members
Forum Members
Posts: 13
Joined: Tue Feb 24, 2009 10:05 pm

Re: Code to display children of current section

Post by szetlan »

Having the same problem here: let's say I have three menu sections:

A -> child pages 1, 2, and 3

B -> child pages 4, 5, and 6

C -> child pages 7, 8, and 9


When I'm on page B, 4, 5, or 6 I'd like the submenu to include:

A
B
- 4
- 5
- 6
C

and when on A, 1, 2, or 3 I'd like to see:
A
- 1
- 2
- 3
B
C

Any thoughts?  News/blog doesn't really work in my case, since the pages in question aren't news or blog entries (and since those modules don't do what I need them to, anyway).

This is CMS Made Simple 1.5.3.
ysye
Forum Members
Forum Members
Posts: 11
Joined: Wed Feb 18, 2009 7:09 am

Re: Code to display children of current section

Post by ysye »

please tell me  how about it?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Code to display children of current section

Post by Dr.CSS »

Any chance you have looked at a default install, just asking as this is the exact menu type that is in most every page of the default install...
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: Code to display children of current section

Post by RonnyK »

Are you talking about News or about regular Content.

Because with content, you can put the {site_mapper} on the page, to show links to all child_pages, and have it automatically showing new pages, when put in the same "section".

Ronny
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Code to display children of current section

Post by Dr.CSS »

Actually RonnyK they just want to have the menu work like it does in the default installs first page, you know click on parent and it shows the children...
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: Code to display children of current section

Post by RonnyK »

maksbud,

your English is better then mine... I couldn't make that up from the information, I thought they just wanted the links showing on the section-pages.

Ronny
Post Reply

Return to “Developers Discussion”