Re: CakePHP and Twitter Bootstrap
On Friday, 18 January 2013 11:51:23 UTC+1, Anis Ghabri wrote:
Good. But to me I'm creating a CMS so I'm trying to keep the markup as much compatible as possible with CakePHP's markup.
What you should be doing, is generating all of the relevant markup with a helper - if you want different markup to come out of the helper you configure it to give you want you want or replace it using aliasing - which is what this is doing (from https://github.com/slywalker/TwitterBootstrap#usage):
<?php class AppController extends Controller { public $helpers = array( 'Session', 'Html' => array('className' => 'TwitterBootstrap.BootstrapHtml'), 'Form' => array('className' => 'TwitterBootstrap.BootstrapForm'), 'Paginator' => array('className' => 'TwitterBootstrap.BootstrapPaginator'), ); }
In this way you have the same view code e.g.:
echo $this->Form->create(); echo $this->Form->inputs(); echo $this->Form->submit();
and the markup that comes out is configurable. If you do not alias the Form helper, you get cake's own Form helper and standard markup. If you use sllywaker's plugin you get a BootstrapForm instance and bootstrap markup etc.
For any of your own markup - make a helper to output the structure so that it's possible to change the result by configuration or again by aliasing the helper class to be used.
If your views are mostly hand written html (not saying they are - *IF*) - you are not going to be able to easily change markup - as such that is not a way to achieve what you say is your goal.
AD
-- Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home