I have the following in the header.php file which is included in all of my views:
$dh = opendir(Vs.get_class($this).'/js') ;
while($script = readdir($dh)) {
if(!is_dir($script))
{
echo '<script type="text/javascript" src="js/'.$script.'"></script>' ;
}
}
$dh = opendir(Vs.get_class($this).'/css') ;
while($css = readdir($dh)) {
if(!is_dir($css))
{
echo '<link type="text/css" href="css/'.$css.'" rel="stylesheet"/>' ;
}
}
It's purpose is to autoload all the CSS and JS files for a particular view (which has the same name as the controller, hence get_class
).
Should all this be a part of the associated controller or is how I have done it fine?