= sfCssTabs plugin = Plugin for the symfony framework that generates tabs dynamically depending on the module that this seeing itself, to the style Wordpress Admin (of 2 levels: main tabs & sub tabs), with valid XHTML. == Screenshot == [[Image(screenshot.jpg)]] == Instalation == Install the plugin {{{ $ php symfony plugin-install http://plugins.symfony-project.com/sfCssTabsPlugin }}} == Usage == 1. Opens to the file '''"layout.php"''', located in: <my_project>/apps/<myapp>/templates/layout.php 2. It places the following code within the tags <body></body> {{{ #!php <?php sfCssTabs::render() ?> }}} 3. Copy the example file called sfCssTabs.css that is in: <my_project>/web/sfCssTabsPlugin/css, to the folder css in: <my_project>/web/css 4. Opens to the file '''"view.yml"''', located in: <my_project>/apps/<myapp>/config/view.yml 5. Adds or modifies the corresponding line by this: {{{ #!yml stylesheets: [main, sfCssTabs] }}} 6. The following thing is to fill the configuration file: '''"siteTabs.php"'''. == Config == Open the file '''"siteTabs.php"''', located in: <my_project>/plugins/sfCssTabsPlugin/lib/siteTabs.php === $configTabs === 1. Some keys have the following prefix: '''"pt_"''' (the configuration is applied for the main tabs); and '''"st_"''' (it is applied for the sub tabs). 2. '''<properties>''': Within this array you can place all the properties that you please of the corresponding tag. This content works just as the one of the third parameter of helper link_to(). 3. The content of: '''pt_li''', '''pt_a''', '''st_li''', '''st_a'''; they are assigned to those tab that agree with the present module. It has the following format: {{{ #!php $configTabs = array( 'div' => array(<properties>), 'pt_ul' => array(<properties>), 'pt_li' => array(<properties>), 'pt_a' => array(<properties>), 'st_ul' => array(<properties>), 'st_li' => array(<properties>), 'st_a' => array(<properties>) ); }}} a. '''"div"'''. By empty default. Single if something is added to him, the tabs are surrounded between <div></div>. Example: {{{ #!php 'div' => array('id' => 'navcontainer', 'style' => 'padding:2px'), }}} b. '''"pt_ul"'''. By empty default. It is applied to the tags <ul></ul> of the main tabs. Example: {{{ #!php 'pt_ul' => array('id' => 'adminmenu') }}} c. '''"pt_li"'''. By empty default. It is applied to the tags <li></li> of the main tabs. Example: {{{ #!php 'pt_ul' => array('id' => 'adminmenu') }}} d. '''"pt_a"'''. By empty default. It is applied to the tags <a></a> of the main tabs. This part uses helper link_to(), and what you place within <properties> it is used within the third parameter of this helper. Example: {{{ #!php 'pt_a' => array('class' => 'current'), }}} e. '''"st_ul"'''. By empty default. It is applied to the tags <ul></ul> of the sub tabs. Example: {{{ #!php 'st_ul' => array('id' => 'submenu'), }}} f. '''"st_li"'''. By empty default. It is applied to the tags <li></li> of the sub tabs. Example: {{{ #!php 'st_li' => array('id' => 'activeII'), }}} g. '''"st_a"'''. By empty default. It is applied to the tags <a></a> of the sub tabs. This part uses helper link_to(), and what you place within <properties> it is used within the third parameter of this helper. Example: {{{ #!php 'st_a' => array('class' => 'current') }}} === $tabs === It represents a main tab that will be added. It has the following format: {{{ #!php $tabs[] = array( 'label' => '', 'module' => '', 'linkOptions' => array() ); }}} a. '''"label"'''. This value will be added in the first parameter of helper link_to(), and is the content of the tab. Example: {{{ #!php 'label' => 'Home', }}} b. '''"module"'''. The name of the module to which an tab belongs. Its value is added to the second parameter of helper link_to(). Example: {{{ #!php 'module' => 'index', }}} c. '''"linkOptions"'''. Its value is added to the third parameter of helper link_to(). It verifies not to such place data that you placed in "pt_a". Example: {{{ #!php 'linkOptions' => array('title' => 'My tab') }}} === $subTabs === It represents a sub tab that will be added under a "main tab" or "parent tab". It has the following format: {{{ #!php $subTabs[] = array( 'label' => '', 'module' => '', 'linkOptions' => array(), 'parentTab' => '' ); }}} a. '''"label"'''. This value will be added in the first parameter of helper link_to(), and is the content of the tab. Example: {{{ #!php 'label' => 'Index', }}} b. '''"module"'''. The name of the module to which an tab belongs. Its value is added to the second parameter of helper link_to(). {{{ '''Note''' In most of the cases, first sub tab has like Link to the module of his parent tab. }}} Example: {{{ #!php 'module' => 'index', }}} c. '''"linkOptions"'''. Its value is added to the third parameter of helper link_to(). It verifies not to such place data that you placed in "st_a". Example: {{{ #!php 'linkOptions' => array('title' => 'my tab 1'), }}} d. '''"parentTab'''". Parent tab to which sub tab belongs. Example: {{{ #!php 'parentTab' => 'index' }}} == Results == The XHTML code: {{{ #!text/html <div id="navcontainer" style="padding: 2px;"> <ul id="adminmenu"> <li id="active"> <a class="current" href="/edit">Manage</a> </li> <li> <a href="/comments">Comments</a> </li> <li> <a href="/blogroll">Blog Roll</a> </li> </ul> <ul id="submenu"> <li id="activeII"> <a class="current" href="/edit">Posts</a> </li> <li> <a href="/pages">Pages</a> </li> <li> <a href="/uploads">Uploads</a> </li> </ul> </div> }}} The image: [[Image(screenshot.jpg)]] == Contacts == * Pedro Hernández (phpleo [at] gmail [dot] com ), [http://blog.phpleo.com/ http://blog.phpleo.com/] == TODO == * Integration with AJAX. * Integration with Admin generation. == Changelog == === 2007-08-22 | 0.0.5 Alpha === * Corrected errors in the documentation. * Changed to the licenses of the archives *.php to the one of MIT. === 2007-08-22 | 0.0.4 Alpha === * Initial public release.