Yii Framework Forum: Cmenu Newline After Closing Tag - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cmenu Newline After Closing Tag Rate Topic: -----

#1 User is offline   jbo5112 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-April 13

Posted 25 April 2013 - 08:20 PM

Why is CMenu putting newlines in my lists? It adds a newline after closing every 'li' or 'ul' tag and newlines surrounding nearly every "<ul options... >" (first one only has a newline after)? The white space is injecting unwanted space into my menu system. I'm tempted to edit CMenu.php and take out the 5 "\n" pieces, but I don't want to maintain my own bug fixes to Yii or keep an extension up to date. If nothing else, it's slightly less efficient code producing slightly less efficient html.

I can work around this by floating the list items to the left, but that notoriously causes other CSS problems, which seem to cascade into a mess that I cannot fix. Conceptually, I think of the menu items as inline-block objects, not some floating block that I want everything to flow around.

Is there any other good fix, or should I just edit CMenu.php? I'm hoping there's something simple in Yii to prevent the spaces from being put there in the first place, but I'm not seeing anything from reading the code.
0

#2 User is offline   Fabrizio Caldarelli 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 306
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 26 April 2013 - 01:43 AM

What kind of problem could this new line charaters add to your code?

HTML skip \n charater.
0

#3 User is offline   jbo5112 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-April 13

Posted 26 April 2013 - 09:46 AM

The newline is white space, which renders as a space between my <li> elements when they're displayed as inline-block elements. Imagine placing a blue menu bar on a white background and having white gaps in the bar. My menus rely on previously set font sizes, so setting the size to 0 for the space won't work.

I'm not sure I understand your second line. Are you saying there's a way to stop Yii from outputting newline characters? I've looked at the code for CMenu, and I don't see anything. For now, the newlines have just been remove from my CMenu.php file.

There's a "text-space-collapse" property being discussed for CSS4, which will do the trick, but that doesn't do me much good now. (I would share a link, but the forums say I'm too new)
0

#4 User is offline   yii new expert 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 30-May 12
  • Location:pune, india

Posted 30 April 2013 - 08:24 AM

you can trim the titles content while adding into menu
0

#5 User is offline   jbo5112 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-April 13

Posted 07 May 2013 - 11:40 AM

It's not in the menu titles. It's a newline in between the <li> items; put there by echo statements in CMenu.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users