• 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  [ 14 posts ] 
Author Message
 Post subject: (solved) Dynamically show/hide submenu
PostPosted: Thu Jun 19, 2008 8:51 pm 
Offline
Forum Members
Forum Members

Joined: Thu Jun 19, 2008 5:59 pm
Posts: 76
Hello all!

I've successfully implemented CMSMS on my new site...thanks to a couple of postings :)

I'm hoping somebody can help me with one last piece...

I'd like to have the submenu block only appear IF there are pages under the parent. I can always create a template for each section but this obviously would be very clunky and not dynamic.

As an example, please view one of my site sections - http://executivedesigns.com/orange-prot ... =project-2

This works great, however, if there weren't any projects in this area, I would want the submenu in the lower right - along with it's header - to NOT appear.

I've included the code for this block below if it helps.

Any ideas would be most appreciated...thank you!

Len



Last edited by lprintz on Fri Jun 20, 2008 7:58 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 12:43 am 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 12674
Location: Arizona
Seems to work or are you using 2 diff. templates?...

You can make a second content block and add h1 and menu call in it...

Why mix table and div?.. if you don't mind my asking?...

_________________
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/
$1


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 12:30 pm 
Offline
Forum Members
Forum Members

Joined: Thu Jun 19, 2008 5:59 pm
Posts: 76
Thanks Mark!

Right now I am using 2 templates...the home page doesn't show the submenu as I've hid the code...I'd love for this to by dynamic though so this block will appear if there are pages under the home parent.

I know about the table :(  This was to be my first, fully W3C compliant, tableless site but I needed to get the top navigation vertically centered. I found fixes and hacks that worked in IE but, unfortunately, it didn't work in Firefox. I finally gave up :)

Len


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 12:42 pm 
Offline
Forum Members
Forum Members

Joined: Thu Jun 19, 2008 5:59 pm
Posts: 76
One other thing...I figured what you meant by it 'working'

The menu does appear only if there are subpages HOWEVER I'd like a unique and dynamic header for the menu. This can simply be pulled from the page alias. Can this be built into the menu function?

Thanks again!

Len


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 5:15 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 12674
Location: Arizona
Yes you have to make a new menu template and use some smarty in it, you have to install CGSimpleSmarty so the smarty calls in menu template work, it has no admin I looked after install and thought something was wrong  ;)

Here is a site using it...

http://touareg.websitewelcome.com/~milesfin/  then go to about us, services is not a menu but anchor links even tho it goes no where...

Top of menu template, if no children then no menu, you can put a {content block="new block"} below where the menu tag goes so if page has no menu/children you can put something there so it's not empty, this block was used to insert the image on her bio page under about us...

is used to make the root page alias show as a link to keep the style consistant...

{if $count > 0}

_________________
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/
$1


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 5:22 pm 
Offline
Forum Members
Forum Members

Joined: Thu Jun 19, 2008 5:59 pm
Posts: 76
Thanks so much...I'll give it a shot!

Len


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 6:00 pm 
Offline
Forum Members
Forum Members

Joined: Thu Jun 19, 2008 5:59 pm
Posts: 76
hmmm...still having issues...I know I'm close!

I installed the smarty module and here's my code for the submenu on the right:



I expected it to look like this page if there are 'children' - http://executivedesigns.com/orange-prot ... /project-1

But I get this - http://executivedesigns.com/orange-prot ... p/projects

Any thoughts?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 6:16 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 12674
Location: Arizona
Well I don't know about putting it in your template, since I used it in a "menu template" but you have {else}{/if} which I'm surprised didn't throw a smarty error, I would think you would need an opening {if} has children then the {else}{/if}...

But like I showed in the post it was pulling the root page alias bla bla bla...

_________________
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/
$1


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 6:28 pm 
Offline
Forum Members
Forum Members

Joined: Thu Jun 19, 2008 5:59 pm
Posts: 76
here's the method to my madness

I thought the logic below was 'if the page has children' then display menu or 'else' don't display anything.

{if $has_children}

project list

{menu start_level="2"}  {else}{/if}

If this should not be in the template, please explain where best to place this code.

Thanks again for your assistance. If I can't solve this it isn't a show-stopper, I'd just like to make this as easy as possible for my client to maintain.

Len


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 6:58 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 12674
Location: Arizona
I believe the {if $has_children} only works in the menu engine not the template, $has_children is part of the menu parameters so, iirc, it's the only one that knows what that means...

OK what I would do is make a new menu template, a copy of simple_navigation since it's what gets called when no template is called, and add the

project list

above the
    and have a content block on the side and call the menu in it on the parent/Projects page...

_________________
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/
$1


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 7:39 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Wed Nov 15, 2006 12:42 pm
Posts: 157
Location: London, UK
Len,

Try this in your template:
\$1:
{if $cgsimple->has_children()}<h1>project list</h1>{menu start_level="2"}{/if}


You do not need the else-statement, unless you want to print some "this page has no children"-text.
You can also use smarty to get the h1-text according to the parent you are using.

Cheers!
Z

_________________
“Coffee leads men to trifle away their time, scald their chops, and spend their money, all for a little base, black, thick, nasty, bitter, stinking nauseous puddle water.” - The Women's Petition Against Coffee (1674)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Jun 20, 2008 7:57 pm 
Offline
Forum Members
Forum Members

Joined: Thu Jun 19, 2008 5:59 pm
Posts: 76
Thanks Zoorlat and Mark!

I solved the issue and I was making it much more complicated than it needed to be.

I simply copied the simple menu template and changed the header (thanks Mark!)...didn't need the those conditional smarty statements at all.

Now to tackle the search module :)

Len


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Dynamically show/hide submenu
PostPosted: Fri Apr 30, 2010 7:37 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Sat Jan 24, 2009 3:12 pm
Posts: 183
lprintz \lprintz:
here's the method to my madness

I thought the logic below was 'if the page has children' then display menu or 'else' don't display anything.

{if $has_children}

project list

{menu start_level="2"}  {else}{/if}

If this should not be in the template, please explain where best to place this code.

Thanks again for your assistance. If I can't solve this it isn't a show-stopper, I'd just like to make this as easy as possible for my client to maintain.

Len


Hi, tell me.. how to do to be has_children and current_page? Some like this doesnt work:
\$1:
{if $has_children and $current}<h1>project list</h1>{menu start_level="2"}  {else}{/if}

please help.  ::)

_________________
CMS Made Simple! Best CMS! :)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: (solved) Dynamically show/hide submenu
PostPosted: Wed Sep 22, 2010 4:13 pm 
Offline
Power Poster
Power Poster

Joined: Sun Dec 28, 2008 12:15 pm
Posts: 448
Location: Roma, Italy
..a little bit late..
However:

\$1:
{$cgsimple->get_root_alias('','root_alias')}
{if ($cgsimple->has_children()) || ($cgsimple->has_children($root_alias))}
{$cgsimple->get_page_title($root_alias)}
{/if}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


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:  
Hosting Nation - Managed CMSMS Hosting