Jump to:

383 Posts in 211 Topics by 197 members

Connect With Other SilverStripe Members

SilverStripe Forums » Connect With Other SilverStripe Members » breaking menu title into two lines

For all SilverStripe-related topics that don't fit into any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1190 Views
  • Rishi
    Community Member
    97 Posts

    breaking menu title into two lines Link to this post

    i have menu link which i want to break into two lines after come i,e in my menu i have page with tile as teachers,& student and i want to break this title into two lines after coma i e

    i gota code and i have tried it but after inserting the code all my menu has disaapered.the code is

    in page.ss
    i have written a function as

    class Page_Controller extends ContentController {
       public function init() {

          // Note: you should use SS template require tags inside your templates
          // instead of putting Requirements calls here. However these are
          // included so that our older themes still work

    function MultiLineTitle($delimiter = ",") {
    $title = explode($delimiter, $this->MenuTitle);
    foreach($title as $key => $value)
    $title[$key] = Convert::raw2xml($value);
    return implode("<br />", $title);

    and in navigation.ss
       <% control Menu(1) %>   
          <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MultiLineTitle.XML</span></a></li>
       <% end_control %>

    //have changed $MenuTitle.XML to $MultiLineTitle.XML

    thanks you in advnace

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.