views:

39

answers:

1

Hi,

I have a subdirectory folder called /lefnav

It contains this files:

background.jpg
demo.html
heading_bg.jpg
jquery.js
navigation.jpg
sliding_effect.js
styles.css
tab_bg.jpg
Thumbs.db
Thumbs.db/encryptable

It actually contains al the elements of this tutorial:

http://net.tutsplus.com/tutorials/javascript-ajax/how-to-create-a-mootools-homepage-inspired-navigation-effect-using-jquery/

I want to include with php the whole folder so that the final result is (like this demo):

http://d2o0t5hpnwv4c1.cloudfront.net/004_Moo/tutorial/demo/demo.html

The best I´ve go so far is, but it is not working at all even if I add .css and .js:

<?php
foreach (glob("leftnav/*html") as $filename) {
    include($filename);
}
?>

I would have thought:

include("leftnav/demo.html");

Alone should work because it seams logical that when I include the and .html file it should call fot the .css etc but this is not the case for what I see.

EDIT:

I think I´ve sorted where the problem is:

When I include the .html it does call for the css but it calls for it in the wrong folder, it does not add "/leftnav/" how could I solve this?

Thanks in advance!!

Trufa

+2  A: 

WOW.

You must include your .js files like this:

<script type="text/javascript" src="path/to/your/file"></script>

Css files:

<link rel="stylesheet" type="text/css" href="path/to/your/css/file" />

All of this in a .php file.

Mario Cesar
I do understand that but I´m looking for a way to include my whole folder not the files one by one.
Trufa
I just don't get why are you trying to do so... The image files will, most likely, be "linked" by the css or the js files....
Mario Cesar
always use absolute paths, i.e. `/path/to/your/css/file` `/path/to/your/file`
Col. Shrapnel
@Mario Cesar I want to include the contents demo.html in another file which is higher folder. Better?
Trufa
@Trufa : are you want call whole folder? but in html you must call one by one file. that make a particular function works.one file for all same function.
klox
@klox Could you please expand a little bit? Some example code or seudo-code?? Thank you very much!
Trufa