Hi, I’m a newbie with Yii and Bootstrap widget. I need you help regarding my problem with BootMenu.
protected/views/layouts/main.php:
…
<?php $this->widget('bootstrap.widgets.BootNavbar', array(
'fixed'=>true,
'brand'=>'Sample Company',
'brandUrl'=>'http: //localhost/company/index.php',
'collapse'=>false, // requires bootstrap-responsive.css
'items'=>array(
array(
'class'=>'bootstrap.widgets.BootMenu',
'type'=>'pills',
'items'=>array(
array('label'=>'Home', 'url'=>'site/index'),
array('label'=>'Products', 'url'=>'item/index'),
array('label'=>'Inventory', 'url'=>'inventory/index'),
array('label'=>'Sales', 'url'=>'sale/index'),
array('label'=>'Admin', 'url'=>'branch/index'),
array('label'=>'Login', 'url'=>'site/login'),
),
...
?>
The code above displays fine on /localhost/company/index.php. Initial click on one of the menus e.g. "Sales" will go to sale/index without a problem. However, succeeding click will result to blank page because all menu links will now be prepended with "sale" i.e. /localhost/company/sale/site/index for "Home", /localhost/company/sale/inventory/index for "Inventory", etc.
To regain the display, I would type the base url (/localhost/company/index.php). If I click on "Inventory", the same thing happens. All menu links will be prepended with the current controller: …company/inventory/site/index for "Home", …company/inventory/sale/index for "Sales" resulting to blank pages.
My UrlManager config is:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
My apache rewrite module is "on" with the following settings:
[i]RewriteEngine On
RewriteBase /company/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA][/i]
Please help me correct the generated links on my BootMenu. Thank you in advance.
P.S. I cannot properly insert links because this is my first post.