Dont think this should be in base.php 

In fact you want to want to slim that fkin file down a lot. Seriously, base.php is cancer and should die. Put the scripts where they belong, into the template files.