Switch to full style
Dynamic open source server-side web development
Post a reply

Beginner help on includes

Tue Jun 09, 2009 11:54 am

I’m new to PHP and am just learning. At the moment, I’m playing around with various ways of constructing a web page to see what can and can’t be done, and how I might go about it.

I’ve got the hang of using simple includes to use a header and footer file.

This is the next step I’m trying out, and just want to know if it can be done or not, and if so, a short explanation (if there is one) would be appreciated, or pointing me to a tutorial would be great.

There’s two ideas I had to take the header and footer thing a step further, both using a shell which instead of including a header and footer, it included the page content. So, for example, I’d have a table, and in a cell, it would have an include command to pull the content from a different html/php file.

What I’m wondering whether it can be done or not is to do this almost backwards. So the file which would have the page shell, and where the include file for the content would be, it would have some kind of marker. Then the file with the content would call (include?) the web page shell, and have the content within that file that the web page shell would then put in the right place.

So you might have shell.php and content.php.

Content.php would have the content html in it, and would include shell.php at the beginning, but have some kind of marker before the html for the content that would identify the content to shell.php. So shell.php, when included) would match it to a marker in its own code, and put the content in the right place when rendering the page.

Does that make sense?

Again, I don’t know if this can be done, or if it’s a long winded way of doing something simple, etc. As I say I’m learning and experimenting at the moment, so I’m open to all suggestions!

I’m also happy to Google for a tutorial and even search the forum, but as you can tell by the long winded explanation, I don’t really know what search terms I would need to use to find what I’m looking for! (Same reason the thread title was so vague, so apologies for that too!)



Re: Beginner help on includes

Tue Jun 09, 2009 4:48 pm

OK, took me a fair bit of experimentation and 'out of the box' thinking, but I think I've worked out how to accomplish the same effect.

Job done!

:gOOd:

Re: Beginner help on includes

Wed Jun 10, 2009 12:14 am

you are talking about the skeleton of your application .
Header
Content .
Footer

The most used it to create a template that include all in one page . and changing the content page depending on some parameter ( Path of the page :ex :viewbody.php ) .

thanks

Post a reply
  Related Posts  to : Beginner help on includes
 I NEED SOME HELP IN THE FOR LOOP PLZ .. IAM JUST A BEGINNER     -  
 Hi im a beginner in java im facing problem please help me     -  
 Beginner needs help- simple 'mail_to' contact form in PHP     -