Показаны сообщения с ярлыком Symfony2. Показать все сообщения
Показаны сообщения с ярлыком Symfony2. Показать все сообщения

четверг, 6 сентября 2012 г.

KnpMenuBundle and Twitter Bootstrap styles

Params:
Symfony2.1 RC2 and appropriate KnpMenuBundle
Twitter Bootstrap 2.1

Problem:
Need to customize Menu by Bootstrap css classes.
For example, I need to add attribute class="nav" to <ul> element of generated menu.

Solution:
Using methods setAttribute(), setChildrenAttributes(), ...
Example:
$menu = $factory->createItem('root');
$menu->setChildrenAttributes(array('class' => 'nav'));
$menu->addChild('Home', array('route' => 'bst_app_homepage'));
...
The output will be:
<ul class="nav">
   <li>...</li>
</ul>

пятница, 31 августа 2012 г.

Symfony2 composer install error

Params:
PHP 5.3.10-1ubuntu3.2
Symfony 2.1 RC2

Problem:
After command
> php composer.phar install
I have error:
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Installation request for jms/security-extra-bundle == 1.2.9999999.9999999-dev -> satisfiable by jms/security-extra-bundle 1.2.x-dev.
    - Can only install one of: jms/security-extra-bundle dev-master, jms/security-extra-bundle 1.2.x-dev.
    - Installation request for jms/security-extra-bundle == 9999999-dev -> satisfiable by jms/security-extra-bundle dev-master.

Solution:
1) Remove composer.lock file from your project directory
   > rm composer.lock
2) Re-install all packages again, run command:
   > php composer.phar install

It will take some time, but the problem will be solved.