hi,<br><br>I'm surprised, i did not receive any response... while i am sure, the code below is not very nice ;-)<br><br>any idea to help me do that in a good and correct Drupal way please ?<br><br>Cédric<br><br><div class="gmail_quote">
---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Cédric Joubert</b> <span dir="ltr"><<a href="mailto:cedjoubert@gmail.com">cedjoubert@gmail.com</a>></span><br>Date: 2010/3/6<br>Subject: How to add comment under menu items<br>
To: <a href="mailto:development@drupal.org">development@drupal.org</a><br><br><br>
<div bgcolor="#ffffff">
<div><font face="Arial" size="2">Hi,</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">I'm new on Drupal and I would like to know how can
I make properly such comment on items Menu please ?</font></div>
<div><font face="Arial" size="2"> -> each first row is a link and each 2nd
row is a comment...</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">- Menu 1</font></div>
<div><font face="Arial" size="2"> (my explanation)</font></div>
<div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">- Menu 2</font></div>
<div><font face="Arial" size="2"> (other explanation ...)</font></div>
<div><font face="Arial" size="2">...</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">The only solution i've found is to do that
(below)... but i'm sure it's not a property way...</font></div>
<div><font face="Arial" size="2">- the only constraint i have is to have the
abbility to get the Description field in the underlying menu to display a
dynamic comment.</font></div>
<div><font face="Arial"><font size="2">but actually, the only trick I've found to
get the Description is to parse the HTML string to retrieve the "<span>title" tag to get my text.</span></font></font></div>
<div><font face="Arial"><font size="2"><span>Not very cool, i
think...</span></font></font></div>
<div><font face="Arial"><font size="2"><span>- actually, to
determine the underlying nodes menu, i'm testing her names... is there another
way to do that ?</span></font></font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Can you help me please ?</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Regards</font></div>
<div><font face="Arial" size="2">Cédric</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">function myTheme_menu_item(</font><font face="Arial" size="2">$link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class
= NULL) {<br> $class = ($menu ? 'expanded' : ($has_children ? 'collapsed'
: 'leaf'));<br> if (!empty($extra_class)) {<br> $class
.= ' '. $extra_class;<br> }<br> if ($in_active_trail)
{<br> $class .= ' active-trail';<br> }<br> $css_id
= strip_tags($link);<br> </font></div>
<div><font face="Arial" size="2"> // test the node for which i want to
add comment<br> if (stripos($link, 'MyMenu1') > 0 || stripos($link,
'MyMenu2') > 0) {<br> $rec =
'title="';<br> $i = stripos($link,
$rec);<br> if ($i > 0)
{<br> $j = strpos($link, '"',
$i+strlen($rec));<br> if ($j >
0)<br> $title = substr($link,
$i+strlen($rec), $j-$i-strlen($rec));<br> } <br>
}<br> <br> $title = ($title != "") ? '<div
class="views-field-created"><h0>&nbsp;&nbsp;&nbsp;&nbsp;['
. $title . ']</h0></div>' : '';<br> return '<li class="'.
$class .'">'. $link . $menu ."</li>\n" .
$title;<br>}<br></font></div></div></div>
</div><br>