Page 1 of 1

link to css and js files

Posted: Tue Aug 04, 2009 2:17 am
by isaac_cm
Hello,
I have a php file and I need to call some js functions from this file , these functions are located in external js file and also I should link to CSS file

what I should do to link to CSS and js files from inside my php file and my php file doesnt have the html or head or body tags just php code

I tried that:

Code: Select all

<?php
echo '<link rel="stylesheet" href="colorpicker/css/colorpicker.css" type="text/css" />';
echo '<script type="text/javascript" src="colorpicker/js/colorpicker.js"></script>';
?>
and get this error:
Error: missing ; before statement
Source File: http://mysite.com/wp-admin/colorpicker/ ... rpicker.js
Line: 1, Column: 81
Source Code:
<link rel="stylesheet" href="colorpicker/css/colorpicker.css" type="text/css" /><script type="text/javascript" src="colorpicker/js/colorpicker.js"></script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xht
please advice

Thanks

Re: link to css and js files

Posted: Tue Aug 04, 2009 3:30 am
by cpetercarter
Well, where is the html that produces the web page? Put the links in the head section of whatever file it is.

Re: link to css and js files

Posted: Tue Aug 04, 2009 4:08 am
by isaac_cm
but no head section , this page called functions.php it used to add options to wordpress theme

Re: link to css and js files

Posted: Tue Aug 04, 2009 7:16 am
by jackpf
You're putting links before the doctype. I don't believe you can do that.