My layout.php calls include_javascripts() before my componet could call sfResponse::addJavascript(). Is there a "helper" or a "best practice" to handle this?
Do I have to Seperate the call sfResponse::addJavascript()? I were happy to avoid it.
Here ist my actual workaround:
<head>
<?php $nav = get_component('nav', 'nav') /* Please show me a better way. */ ?>
<?php include_javascripts() ?>
...
</head>
<body>
<?php /* include_component('nav', 'nav') */ ?>
<?php echo $nav ?>
...
</body>
Thanks
From: http://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer
File Inclusion Configuration
// In the view.yml
indexSuccess:
stylesheets: [mystyle1, mystyle2]
javascripts: [myscript]
// In the action
$this->getResponse()->addStylesheet('mystyle1');
$this->getResponse()->addStylesheet('mystyle2');
$this->getResponse()->addJavascript('myscript');
// In the Template
<?php use_stylesheet('mystyle1') ?>
<?php use_stylesheet('mystyle2') ?>
<?php use_javascript('myscript') ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With