I started using symfony a few weeks ago, and there are some things that are not clear for me.
My question is that how could I put a list of categories (for menu) in the main layout of an application? How can I pass a variable for this layout and where to put this variable? I don't want to put it in every module.
Thanks.
Did you read about components, slots and partials? Start here: http://www.symfony-project.org/gentle-introduction/1_4/en/07-Inside-the-View-Layer#chapter_07_code_fragments
And here's the best menu plugin ever: http://www.symfony-project.org/plugins/ioMenuPlugin
You can't pass variables for the layout. Instead you can use partials or components.
Related
They seem to be doing the same thing: they are passing layouts to a view.
I am new to Yii and I do not know what the difference is. Can anyone explain it?
renderPartial() - renders a named view without any layout. If you don't have any layout and want to render a named view (a view previously stored for reuse) you can use renderPartial().
beginContent() - is for managing nested layout. Inside a layout you can reuse a named view like a nested layout .
See this for a brief guide.
everyone.
I have to change the template of the FormHelper. Not for just 1 or 2 view, for ALL views. And i would like to do this without to have to write hundred of line in every view.
Is it possible to change the FormHelper default template ?
Where the default template is located ?
CakePHP documentation don't say anythings in order to change template of Whole Site, for FormHelper or Paginator, that's a real problem.
I'm not with CakePHP 3 but only CakePHP 2.6
If I understand correctly, you want to modify or use their own "bake" template, in order to avoid repetition of writing html and php code.
Here is what documentation say:
http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html#modify-default-html-produced-by-baked-templates
If you want to modify cake helper, copy from
\cakephp\lib\Cake\View\Helper
in the \cakephp\app\View\Helper
and then make modification.
Here is documentations for creating own helpers
http://book.cakephp.org/2.0/en/views/helpers.html#creating-helpers
Well...the file you are looking for is located in
/lib/Cake/View/Helper/FormHelper.php
You should search for example for:
function input(
or
function create(
that is the "template" you are looking for.
I think the easiest way to change the output is to update your $options array. There you can add classes or labels or whatever.
What is the difference between to these in cake php?
$this->fetch('title');
$this->extend('/Common/view');
$this->element('shop/cart.ctp');
fetch() is used mainly in layout file to output a block of content.
extend() is used to extend view. which allows you to wrap one view in
another.
element() is used to group an reusable piece of view.
You can learn lots from this online book/page:
http://book.cakephp.org/2.0/en/views.html
View Templates
Extending Views
Using view blocks
Displaying blocks
Using blocks for script and CSS files
Layouts
Using layouts from plugins
Elements
Passing Variables into an Element
Caching Elements
Requesting Elements from a Plugin
Creating your own view classes
View API
Hope it will help you!
Hi I am new to Zend Framework and using version 1.12 to start with. I am trying to build my first site and dont know which direction to take.
I have an HTML template that I set as my Zend Layout and the navigation menu has link structured in a
Should I just create my site structure by assigning links in the layout or use Zend Navigation.
What are the benefits of using Zend Navigation? At this point it seems much simpler to adapt the HTML to go to the controller/action than trying to format the menu created from zend navigation with css.
You can create an xml file with your structure so it'll be easy to edit and keep track of. It'll add the class .active automatically to your li's. You'll have a cleaner layout script.
I mainly use it with my ACL. There is probably more reasons.
I am thinking of running a website that sells Joomla template (similar like TemplateMonster). When I look at TemplateMonster, what come up into my mind is they have multiple instances of Joomla and they populate the content of every single of them depending on the template.
Is this the only way to achieve this? What if I have 100 templates, do I have to copy paste 100 Joomla?
These are the examples of two different contents:
http://www.templatemonster.com/demo/44048.html
http://www.templatemonster.com/demo/44129.html
Best Regards,
I think simplest way would be adding ?template=beez3 to the uri.
More complicated to use extension like Virtual Domains.
Current menu item (and so template) is set based on rules like current URI. Extension is little tricky to setup but could be exactly what you are looking for.