Log in

View Full Version : warning in include



davelf
03-04-2010, 07:10 AM
i'm kind of new in PHP, but i'm quite good in JS so this is my problem:

Warning: include(about.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\imax\indexTree.php on line 238

Warning: include() [function.include]: Failed opening 'about.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\imax\indexTree.php on line 238

i'm trying to combine my JS with php, it works in basic html, but when i make it into PHP that error show, is there any rule that i should know, before combining JS with PHP?

all master thx for your attention, hehe.:)

djr33
03-04-2010, 09:59 AM
PHP cannot be combined with JS [directly]. PHP is processed as code into text output, so it can generate pure text which can be html or include Javascript, CSS, etc. Then the output is sent to the browser and it can operate there as HTML, Javascript, CSS, etc.
But again the two never will interact directly.

Likewise Javascript cannot "do" PHP, aside from using Ajax which just simulates a behind the scenes page load.


That aside, if you are using Javascript to generate info like the path to include the file, then later trying to use that in PHP, you should validate any input that is not secure on the server. This includes anything from Javascript because the user can modify it (intentionally or otherwise).


The error above means that the path you used for the include is wrong, simple as that. Make sure the file exists then figure out why the path is wrong if it does. Should be simple to fix, but if it involves layers of using Javascript, it may be hard to fix it but at least you know what the problem is.

davelf
03-04-2010, 01:32 PM
hmm, i see.. That's the explanation why it's error in PHP.

i use this code from dynamicdrive:

http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm

it's work perfectly in HTML, here is the result
http://www.imaxxo.com/imaxxo02/indexTree.html

But all of the content should be put in one page html right? It's true there's no problem if i do that. I just try something new, so i put the glider content into another page PHP, and i call it using



<?php include("");?>


but it doesn't work like i hope, haha. I think i need to learn more about PHP...

Another question:

how the contentGlider work actually?
1. load all of the content when we open the page, or it load only when we call it?

2. which one more efficient put all the content of glider into one page or put it in another page and call it using include(php)?

thx a lot for your explanation djr33...:)