Font Awesome css breaks

Hi,

I have the following code set up for a TBMenu. I am using YiiBooster 4.01 in Yii 1.1.15.

As you can see below I am using a glyphicon for the first menu item then a font-awesome icon for the second. Both of these are within the yiibooster extension.




$this->widget('booster.widgets.TbMenu',

	array(

		'type' => 'list',

		'items' => array(


			array(

				'label' => 'Website', 

				'icon' => 'glyphicon glyphicon-cloud',

				'url' => $forg->orgwebsite,

				'linkOptions' => array('target'=>'_blank'),

				'itemOptions' => array('class' => 'orgmenu', 'id' => 'orgwebsite'),

			),

			array(

				'label' => 'Facebook', 

				'icon' => 'fa fa-facebook-square',

				'url' => $forg->orgfacebook,

				'linkOptions' => array('target'=>'_blank'),

				'itemOptions' => array('class' => 'orgmenu', 'id' => 'orgfacebook'),

			),

		)

	)

);       



In my dev environment which is a WampServer on my Windows 7 PC, the menu item for facebook renders as expected and looks the same as the others. The html code generated is as follows:




<li class="orgmenu" id="orgwebsite">

    <a target="_blank" href="http://www.xxx.com.au">

        <i class='glyphicon glyphicon-cloud'></i>Website</a></li>

<li class="orgmenu" id="orgfacebook">

    <a target="_blank" href="https://www.facebook.com/blablabla">

        <i class='fa fa-facebook-square'></i>Facebook</a></li>



However, when I load up this version to my website which is hosted on a linux server, the css seems to go haywire - the facebook entry has a class called "nav-header" added to the "li" tag and the "a" tag is missing completely, see the generated html code below…




<li class="orgmenu" id="orgwebsite">

    <a target="_blank" href="http://www.xxx.com.au">

        <i class='glyphicon glyphicon-cloud'></i>Website</a></li>

<li class="orgmenu nav-header" id="orgfacebook">

    <i class='fa-facebook-square'></i>Facebook</li>



I have no idea where to start looking for this. to see the behaviour in test environment you can see it at http://www.test.poolstat.net.au, then click on organisations in the top menu.

It might be to do with the fact that windows systems are not case sensitive and linux is so could be a capitalised letter somewhere that shouldnt be.

Any advice would be greatly appreciated.

Regards

Greg J

TbBaseMenu shows that ‘nav-header’ is added to the classes if nor ‘url’ nor ‘items’ is set.

With that assumption it is likely that $forg->orgFacebook is not set. If that’s from the database, check the database (and you can check the value with a VarDump too).

It may also be that some file(s) that you are used on your server are not the same as those on your PC.

You could try renaming the files (one by one, start with most likely one(s)) that you think you are using (Linux & PC) and if there is no change, then the file you renamed is very likely not used.

Thanks for your response.

some records have a url, others are empty.

I have jquery behind the page to that enables or disables the menu item based on the url existing as data is retrieved via an ajax call.

This works as expected on DEV (just greys out the selection) but not in TEST.

So to sum up, dev works as expected if data exists or not, but TEST does not. TEST renders the same whether there is data or not.

Regards

Greg J

Can you try to specify the Url like this:




                                'url' => "{$forg->orgfacebook}",

// or

                                'url' => "".$forg->orgfacebook,



The test in the TbBaseMenus is "isset()" - so an empty string may be better than whatever you get now for missing urls.

genius!

that worked, thank you very much. I was thinking to myself, why would that work when it doesnt matter whether or not the field as a value. Ive only just realised that because all subsequent calls are set via ajax so its only gets loaded once when the page loads loads and because its value is blank it destroys the html.

I tested that if that first loaded record had a value it would have rendered as expected.

I went back to the dev machine and removed the value for the first loaded record but it rendered as expected so there is still something different between the two environments.

Many thanks for your perseverance.

Regards

Greg J