21280 Posts in 5729 Topics by 2600 members
| Go to End | Next > | |
| Author | Topic: | 2262 Views |
-
how to display link in navigation in two lines

12 December 2009 at 8:17am
I have creating a website where few of my link in navigation have two or more words.I want to break the link in navigation into two lines.I am having a two layer drop down menu .Please help me out.My link are
-home
-about Us
--Student
--managment
-Branch
--Local Branch
--International Branch
-Student & managment SpeechesFor example I want to break Student & managment Speeches to be appeared as
Student &
managment Speechesin the navigation.
Thank you in advance -
Re: how to display link in navigation in two lines

14 December 2009 at 9:33am Last edited: 14 December 2009 9:34am
You'll need to use some custom PHP to break that line up.
I suggest you aim at getting something like this working:
class Page extends SiteTree {
...
public function getMenuTitleWithNewlines() {
return $this->addNewlines($this->obj('MenuTitle')->XML());
}function addNewlines($title) {
return /* $title with & replaced by <br> */;
}}
Then in your template, use $MenuTitleWithNewlines instead of $MenuTitle.
-
Re: how to display link in navigation in two lines

14 December 2009 at 12:29pm
Alternatively you can break up the top level menu page to be just SPEECHES and then the child pages to be Student & Management
So it will look like this:
|-Home
|-+About Us
|--Student
|--Management
|-+Branch
|--Local Branch
|--International Branch
|-+Speeches
|--Student
|--Management -
Re: how to display link in navigation in two lines

14 December 2009 at 12:52pm
An infinitely better way to go, assuming there's no reason why it isn't better.
-
Re: how to display link in navigation in two lines

14 December 2009 at 12:54pm
My suggestion is based on the KISS principle. Why create complicated logic, if you can re-organise the data.
-
Re: how to display link in navigation in two lines

14 December 2009 at 1:01pm
Indeed. I was assuming the poster had his reasons. But it did seem unlikely.
Well, I hope we'll find out.
-
Re: how to display link in navigation in two lines

19 December 2009 at 6:32am
Thank you for the reply
but i cant change the link structure,its a client requirement and he wants that way -
Re: how to display link in navigation in two lines

19 December 2009 at 6:33am
hello tobych
thanks for your reply,it is working great,
| 2262 Views | ||
| Go to Top | Next > |


