hmmm, i know i can do this with jquery but i'm trying no to use javascript and instead use php. also to learn from.
I have a folder hierarchy like this
modules
|-navagation
|-js
|-nav.js
and I want to find a way to append that .js to the
<head></head>
like this
<html>
<title></title>
<head>
<script scr="jquery.js"></script>
<script src="nav.js"></script>
</head>
</html>
My goal is that I want to upload modules to my modules folders and have the php automatically pick it up and load up the resources from the modules.
One thing that I'm struggling with is that I'm loading my files via Smarty using .tpl to display my markup. Thats the only berrier i'm dealing with.
my original method was this but because I'm doing it with template files i'm at a loss.
ob_start();
include(THEME_PATH . "/index.html");
$content = ob_get_contents();
ob_end_clean();
// Scripts to include
$scripts = BaseHelper::include_script("http://code.jquery.com/jquery-1.4.2.min.js");
$scripts .= BaseHelper::include_script("js/jquery.sound.js");
$scripts .= BaseHelper::include_script("js/jquery.jblock.js");
$scripts .= BaseHelper::include_script("js/init.js");
// Add scripts to theme
echo str_replace("</head>", $scripts . "\n</head>", $content);