0

Hi everyone, I've created a function for calling .js files in <head> but it's not working properly. The reason why is this function necessary is that I want to include different .js files in different pages or remove some If I don't need them.

function get_scripts($array, $dir)
{
	$count = count($array);

	for($i = 0; $i < $count; $i++)
	{
		print("<script type=\"text/javascript\" src=\"$dir/js/".$array[$i].".js\"></script>\n");
	}
}

array and function

$scripts = array("jquery", "tabs", "contentslider");
get_scripts($scripts);

So, files are called as it should be but none of them are making impact on the page


Regards

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pritaeas
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.