Hello, I don't know if any of you have heard of this before, but when I include my PHP file on the same page where I have a jQuery script running, the jQuery scripts on the page stop working. Once I remove the file again, they work fine. If you have heard of this before or have any idea how I might be able to fix it, let me know! Thanks!
For sure. This is the head of my index.php file, where the jQuery code is called and the jQuery code is located. As you can see, the file that is being included on top (functions.php) is the one causing the problem. The source for that will be below. Index.php Header: <?php include('functions.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Kuddle.net</title> <!-- STYLESHEETS --> <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="default" charset="utf-8" /> <link rel="stylesheet" type="text/css" href="jquery.lightbox-0.5.css" media="screen" /> <!-- JQUERY FILES --> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js" ></script> <!-- SCRIPTS SPECIFIC TO THIS PAGE --> <script type="text/javascript" src="js/jquery.tweetable.js"></script> <script type="text/javascript" src="js/jcarousellite.js"></script> <script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script> <script type="text/javascript"> $(function() { // LIGHTBOX - Select all links that contains lightbox in the attribute rel $('a[@rel*=lightbox]').lightBox(); // Client Showcase slider $("#client_slider").jCarouselLite({ btnNext: ".next", btnPrev: ".prev" }); //Latest Work Slider $("#latest_work > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true); // Twitter Feed $('#tweet_feed').tweetable({username: 'peteravey', time: true, limit: 2}); }); </script> <!--[if IE 6]> <link rel="stylesheet" href="ie6.css" type="text/css" media="screen" title="default" charset="utf-8" /> <script type='text/javascript' src="js/ie6_pngfix.js"></script> <script> DD_belatedPNG.fix('*'); </script> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" href="ie7.css" type="text/css" media="screen" title="default" charset="utf-8" /> <![endif]--> </head> Code (markup): Functions.php: <?php function create_excerpt($string, $wordsreturned) /* Returns the first $wordsreturned out of $string. If string contains fewer words than $wordsreturned, the entire string is returned. */ { $retval = $string; // Just in case of a problem $array = explode(" ", $string); if (count($array)==$wordsreturned) /* Already short enough, return the whole thing */ { $retval = $string; } else /* Need to chop of some words */ { array_splice($array, $wordsreturned); $retval = implode(" ", $array); } return $retval; } ?> Code (markup): Thanks for the help guys!
If the PHP file which you are including has Any javascript includes or stylesheets which may interupt or overwrite the previous , this would be the reason. The problem you are having is the file you are including ... not PHP itself
Could you please try removing the php end statement "?>" in the Functions.php and make sure there are no spaces at the top of your html DOC-TYPE. Also I would suggest you to include the functions.php file after the <head> tag to avoid this issue.
I have tried that. Doesn't make any difference. I will try out all of the suggestions that you guys are giving...
The file I'm including does not include any javascript or stylesheets.. It is simply a php file with one function I use to connect to my database and also create an excerpt for my wordpress DB... Anything else that this might be? I am having the same problem on another project I am working on. The file i'm including has the same name, but not much similarity.. Hmm..
I just did. Unfortunately, this solution did not help either. Whenever I remove the include my problem disappears! Annoying....
Try to include the function.php after "</head>" Pls. The information you gave is too few.If my suggest is also cann't help you,you'd better to send the php log or give more information later.
a lightboxc without javascript check here knowledge-transfers . com/graphic-design/cool-css-techniques-you-should-know remove the spaces for the link