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");

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


Check if your (absolute/relative) folders are correct in the output.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.