You can put simple configuration values in your config.yml:
# app/config/config.yml
parameters:
mybundle.site_name: domix.in
mybundle.site_blog: blog.domix.in
Retrieve them in your action from the container:
$siteName = $this->container->getParameter('mybundle.site_name');
$siteBlog = $this->container->getParameter('mybundle.site_blog');
Pass these to the template in the parameters array:
return $this->render('MyBundle:Default:index.html.twig',
array('site_name' => $siteName, 'site_blog' => $siteBlog));
In your twig template:
{{ site_name }}
{{ site_blog }}
http://docs.symfony-reloaded.org/guides/bundles/configuration.html
On Feb 21, 11:20 am, Haulyn Jason <[email protected]> wrote:
> Hi,
>
> Before I am Kohana user, I always define something like:
> <?php
> return Array( 'site_name'=>'domix.in',
> 'site_blog' = 'blog.domix.in'
> )
>
> Then I can use the property in template as <?php echo
> $kohana->config('web')->site_name ?>
>
> I wanna to know is there something I can do this in symfony 2.0?
>
> Thanks!
>
> http://domix.in
> Protect and Track your life and work
>
> Location:Room 807,QiLuRuanJianDaSha Qilu Software Park
> No. 1 Shunhua Rd High-Tech Development Zone
> Jinan, China 250101
> Mobile: +86 15854103759
>
> Haulyn Jason
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en