Example Helper Css et Javascript
This commit is contained in:
parent
6a1201cebc
commit
513d6567de
15
application/views/default/helpers/CssHelper.php
Normal file
15
application/views/default/helpers/CssHelper.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
class Zend_View_Helper_CssHelper extends Zend_View_Helper_Abstract
|
||||
{
|
||||
function cssHelper() {
|
||||
$request = Zend_Controller_Front::getInstance()->getRequest();
|
||||
$file_uri = 'media/css/' . $request->getControllerName() . '/' . $request->getActionName() . '.css';
|
||||
|
||||
if (file_exists($file_uri)) {
|
||||
$this->view->headLink()->appendStylesheet('/' . $file_uri);
|
||||
}
|
||||
|
||||
return $this->view->headLink();
|
||||
|
||||
}
|
||||
}
|
12
application/views/default/helpers/JavascriptHelper.php
Normal file
12
application/views/default/helpers/JavascriptHelper.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class Zend_View_Helper_JavascriptHelper extends Zend_View_Helper_Abstract
|
||||
{
|
||||
function javascriptHelper() {
|
||||
$request = Zend_Controller_Front::getInstance()->getRequest();
|
||||
$file_uri = 'media/js/' . $request->getControllerName() . '/' . $request->getActionName() . '.js';
|
||||
|
||||
if (file_exists($file_uri)) {
|
||||
$this->view->headScript()->appendFile('/' . $file_uri);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user