Yii Framework Forum: Cmenu manage list - Yii Framework Forum

Jump to content

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

Cmenu manage list Rate Topic: -----

#1 User is offline   jackass 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 05-January 09

Posted 13 April 2010 - 07:50 AM

Ther's a way to manage the Cmenu output list, I wanto to obtain this kind of list
<ul>
<li>
<ol>
<li>
</li>
</ol>
</li>
</ul>
thanks all.
0

#2 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 13 April 2010 - 08:43 AM

Looking at the CMenu.php widget class i noticed that it hardcodes the ul/li tags so the by default you won't be able to do that without overriding that class. But if you do override this should be simple enough to implement.
Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
0

#3 User is offline   bas_vdl 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 215
  • Joined: 01-April 09

Posted 13 April 2010 - 08:57 AM

View PostVince., on 13 April 2010 - 08:43 AM, said:

Looking at the CMenu.php widget class i noticed that it hardcodes the ul/li tags so the by default you won't be able to do that without overriding that class. But if you do override this should be simple enough to implement.


how to extend this class? because i need to move the class='active' from the li to the a tag
0

#4 User is offline   jackass 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 05-January 09

Posted 13 April 2010 - 11:02 AM

Thanks but i already solved the problem thanx all
0

#5 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 13 April 2010 - 01:53 PM

View Postbas_vdl, on 13 April 2010 - 08:57 AM, said:

how to extend this class? because i need to move the class='active' from the li to the a tag


You simple create a new class with a new like 'MyCMenu' that extends the defualt CMenu class. And you override the methods you need to change their behavior.

But before you run ahead and extend the class you might want to check the linkOptions attribute in the items element.
http://www.yiiframew...nu#items-detail
Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
0

#6 User is offline   bas_vdl 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 215
  • Joined: 01-April 09

Posted 14 April 2010 - 01:38 AM

i got this: YiiBase::include(CMenu.php) [<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory

framework\zii\widgets\MyCMenu.php
<?php

class MyCMenu extends CMenu
{
	//just testing
	public function run()
	{
		echo 'bas';
	}

}

0

#7 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 14 April 2010 - 02:20 AM

Since the CMenu located under the Zii library you need to import it by adding this line to the top of you class file


Yii::import('system.zii.widgets.CMenu');



So it looks like this:

<?php

Yii::import('system.zii.widgets.CMenu');

class MyCMenu extends CMenu
{
        //just testing
        public function run()
        {
                echo 'bas';
        }

}


That should work.
Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
0

#8 User is offline   jackass 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 05-January 09

Posted 14 April 2010 - 03:59 PM

another question how I can set a css class to link Cmenu generated class?
0

#9 User is offline   jackass 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 05-January 09

Posted 14 April 2010 - 04:15 PM

I find sorry.
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