File loop and logic in controller of view header
The way you are scanning the directory is going to get all files. If this is intentional thats cool, but if you are really just looking
for js &amp; css files, use glob and scan for them directly. This will be much better in performance, and you can avoid the directory check.
It seems like its a brittle idea to have the paths mapped to a specific class name. There has to be an easier way to associate views
and view resources rather than referencing $this.
This does not belong in the controller unless you are assigning the view data there. In frameworks like Zend, there are action helpers
which take care of this for you. If you don't have access to that, create a base controller class and do a magic helper method to keep the
functionality the same across all pages. This will allow you to maintain this functionality closer, and you can still use the $this if needed.
Is this really a good idea to just scan a directory and include all files? What happens if a new developer comes along and dumps a js file
they were testing something in, in the directory and it got included by accident? If there are very few includes, try to just manually put them in;
either through a layout or just hardcoding them in there. If you really have that much js and css being included in.... maybe there is a more
fundamental problem.


Better Scandir w/ Glob:

$jsGlob = Vs.get_class($this).'/js/*.js';
foreach (glob($jsGlob) as $js)
{
    echo '&lt;script type="text/javascript" src="$js"&gt;&lt;/script&gt;' ;
}

$cssGlob = Vs.get_class($this).'/css/*.css';
foreach (glob($cssGlob) as $css)
{
    echo '&lt;link type="text/css" href="$css" rel="stylesheet"/&gt;' ;
}