Forum Moderators: coopster

Message Too Old, No Replies

Pass page file variable to include

         

duganji

2:23 pm on Mar 27, 2006 (gmt 0)



Hey, my first post.... yah.

Im trying to create a template system kind of like smarty without using smarty.

I want to create a php page which includes frame.html within each folder group of my directory structure.

frame.html contains an include that calls that pages content.

Example.

/admin/events/add_event.php

includes ("/admin/events/templates/frame.html")

frame.html is broken up into header, footer, nav, content.

problem is, i want to use the same frame.html for all the pages in this folder such as add_event.php, delete_event.php, veiw_events.php

im using the include ("/admin/events/templates/content.html") but i want the content.html part to be a variable that is passed from the /admin/events/add_event.php page

example: $content = "add_event.html"

and then used

("/admin/events/templates/$content"), didnt work.

Im totally new to php so if this is like way out there and cant be done let me know, if it can, please help me out.

thanks.

chriswragg

5:01 pm on Mar 27, 2006 (gmt 0)

10+ Year Member



You're almost there!

include("/admin/events/templates/$content");

Should actually be...

include("/admin/events/templates/".$content);

That should work.

Chris