• 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  [ 9 posts ] 
Author Message
 Post subject: Section header link - how to?
PostPosted: Fri Apr 07, 2017 1:50 pm 
Offline
Forum Members
Forum Members

Joined: Thu Dec 13, 2012 2:54 pm
Posts: 182
Hello everyone!
I'm trying to do something with my navigation but I'm not very familiar with Smarty so I ended up 'in the middle of nowhere'. Maybe someone could help me out...
I'm using minimal_menu and I would like to change the behaviour of section headers to act like links to its own first child page. This is the part of the minimal_menu dedicated to section headers:

Code:
      <li class="sectionheader{if $node->parent} activeparent{/if}">
        {$node->menutext}
        {if isset($node->children)}
          {include file=$smarty.template nodes=$node->children depth=$depth+1}
        {/if}
      </li>

As far as I can understand, the second line - {$node->menutext} - should be altered and wrapped up in <a> tag which points to the desired child page (or something similar to that).
I can wrap it up in link tag but I have no ideas left what syntax to use to get what I need! And I have tried many, many solutions...

Thank you in advance for ideas or help of any kind!

Best regards,
jakovbak


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Section header link - how to?
PostPosted: Fri Apr 07, 2017 3:50 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 2754
Location: The Netherlands
You are aware that this functionality is built in already?

Add New Content -> Content type: Internal Page link.

But to set it up, you either need to create this Internal Page link first and point it to some existing page. Then create the children pages and finally change the link to one of those childs.

Or create the first 'child' page first, set it in the root. Then create the Internal Page link to this 'child' page. And finally change the parent setting of this childpage.

Clear? :-)

I like your idea of the automatic link thing though.

Quickly tested:

Code:
      <li class="sectionheader{if $node->parent} activeparent{/if}">
        {if isset($node->children)}
           {* <!-- {$node->children|print_r} --> *} {* <-- uncomment this to see what options you have (in html source) *}
           <a href="{$node->children.0->url}">{$node->menutext}</a>
        {else}   
          {$node->menutext}
         {/if}
        {if isset($node->children)}
          {include file=$smarty.template nodes=$node->children depth=$depth+1}
        {/if}
      </li>


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Section header link - how to?
PostPosted: Fri Apr 07, 2017 5:58 pm 
Offline
Forum Members
Forum Members

Joined: Thu Dec 13, 2012 2:54 pm
Posts: 182
Hello Velden!
I have tried Internal page link but not in the order you described, so obviously, in final step I wasn't able to point it to child page because it wasn't in the root! Maybe this option is less 'user friendly' as it should be... :-)
On the other hand, it did make think outside of the box and it's a good thing, right?
I'm not at computer right now but I'll give it a try when I get home along with the code you provided and get back to you with the results. And I won't close this topic yet because this menu should be responsive too (based on Bootstrap) and I expect more tweaking to make it look properly in responsive mode.
Thanks again and best regards!
Jakovbak


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Section header link - how to?
PostPosted: Fri Apr 07, 2017 7:02 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 2754
Location: The Netherlands
Changed the code a little.

Code:
<li class="sectionheader{if $node->parent} activeparent{/if}">
        {if isset($node->children)}
           {* <!-- {$node->children|print_r} --> *} {* <-- uncomment this to see what options you have (in html source) *}
           <a href="{$node->children.0->url}">{$node->menutext}</a>
          {include file=$smarty.template nodes=$node->children depth=$depth+1}
        {else}   
          {$node->menutext}
         {/if}
      </li>


Further note that the code doesn't check for the type of content of the first child. It could as well by another section header or whatever. Then things might go wrong.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Section header link - how to?
PostPosted: Fri Apr 07, 2017 7:12 pm 
Offline
Forum Members
Forum Members

Joined: Thu Dec 13, 2012 2:54 pm
Posts: 182
Good to know. However, in this particular case it would be used only as a link to the first child page. In other cases, I will use built-in option but in this one, I don't want to waste a good and clean piece of code...
;D
Regards,
Jakovbak


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Section header link - how to?
PostPosted: Fri Apr 07, 2017 9:16 pm 
Offline
Forum Members
Forum Members

Joined: Thu Dec 13, 2012 2:54 pm
Posts: 182
Hello again!
Unfortunately, it all went 'down south'... Everything was ok until third level came along and then the whole thing broke. Here's a quick sketch of the idea behind this menu:

(menu 1st row/level)
INT.PAGE LINK 1 - INT.PAGE LINK 2 - INT.PAGE LINK 3 - ... (visible)
(menu 2nd row/level)
IPL1 CHILD 1 - IPL1 CHILD 2 - IPL CHILD 3 - ... (visible)
(or IPL2 CHILD1 - IPL2 CHILD2 - ... if 'active page' is INT.PAGE LINK 2 etc)
(menu 3rd level)
CHILD1child1 - CHILD1child2 - CHILD1child3 - ... (dropdown)

So far I was very satisfied with Bootstrap's ability of integration with CMSMS and I have decided to stick with the platform in this case too. But if you Velden or anyone else comes up with a suggestion how to deal with this by using another responsive techniques and platforms - please, you're more than welcome!

Here is the rough draft of the menu (minimal_menu template is used with first <ul> commented out to fit Universal theme menu construction):

http://www.adriaticsolution.hr/index.php?page=marine

(second 'MARINE' is actually a first child of internal page link of the same name!)

Thank you in advance and have a nice weekend!
Best regards,
Jakovbak


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Section header link - how to?
PostPosted: Fri Apr 07, 2017 9:24 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 2754
Location: The Netherlands
Quote:
Here is the rough draft of the menu (minimal_menu template is used with first <ul> commented out to fit Universal theme menu construction):


That could very well be a/the problem. You can't do that because you will be using (probably) the same template for every level. So removing it from the template, will prevent it to set the second and third level <ul>

The Navigator module and templates are very flexible and I'm pretty sure they can create any logical menu structure needed for frameworks.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Section header link - how to?
PostPosted: Fri Apr 07, 2017 9:48 pm 
Offline
Forum Members
Forum Members

Joined: Thu Dec 13, 2012 2:54 pm
Posts: 182
Ok. I was unaware of the fact. Now the <ul> is back, what can I do next?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: [CLOSED] Re: Section header link - how to?
PostPosted: Wed Apr 19, 2017 9:32 am 
Offline
Forum Members
Forum Members

Joined: Thu Dec 13, 2012 2:54 pm
Posts: 182
Since there was no new suggestions and I had to move on with the site, I had to improvise a bit and to rethink the navigation. Didn't find the solution to this topic but at least my navigation looks like it was imagined for desktops and almost as it supposed to look like on small devices. It takes some work on CSS for small devices but you can check the rest of it on desktop if you are interested here:

http://www.adriaticsolution.hr/index.php?page=marine

Thank you once again and best regards!
Jakovbak


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  [ 9 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:  
cron
HostPapa CMS Made Simple hosting