Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

php conceptual Q?

php conceptual Q?

php conceptual Q?

Working on a project with another developer. He has developed a tabular menuing facility and when any tab is clicked it triggers an invocation to another program. The other program (my part) delivers the content. The user can enter/change any data fields and then clicks to save. The result is that the same page is redisplayed. To navigate to a different page the user clicks on another tab. Simple.

Here's my conceptual question: as my part (the content portion) does not output any heading information it simply writes to the data stream picking up where the headers end. While that works for the initial display, is there any way to redisplay without reoutputting the headers? Or, as I surmise, must the headers again be first to start/setup the new page?

I've been doing this for many moons and I just can't get my head around this (yet). Any suggestions/guidance/ideas appreciated.
Thanks dazed

RE: php conceptual Q?


...is there any way to redisplay without reoutputting the headers?

Not with PHP alone. PHP runs on the server, for that to happen a call to the server must occur, and as such the page must load or reload. Once the page has finished loading PHP is no longer running and cannot be made to run until another server call is made.

Without any supporting tech, the only way to make a call to the server is to refresh the page and as such reload / output headers.

The way to get PHP to be run without having to reload the page, i.e output headers is to use an AJAX call via Javascript. So the PHP script is called by the JS code without having to reload the page. Returns the data to the JS code which then decides what it's going to with it, including clearing existing content, and outputting whatever it got from the PHP code.

Phil AKA Vacunita
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: php conceptual Q?

What Vacunita says is perfectly correct.

To make sense of this, you therefore may prepare your scripts to alternatively output just the html snippet of the content or a whole HTML page via parameter.
Javascript may use that, also a template engine might put together a whole page from parts it puts together or (more often) a whole template has placeholders where the missing html parts are injected.

Anyway, without any helper code working clientside (and javascript is the norm here) the usual request from the browser to the server via clicking a link renders the full page in either the same window/tab or a new target and needs a full html page returned.

One way out is iFrames, where page parts are their own full html page. While iFrames are not removed from html - even in html5 (actually here it really became a standard first time and framesets/frames were deprecated - they are avoided for different reasons also valid for framesets and frames - the term is cross site scripting and security issues of that) and a clean approach without iFrames and JS is returning full html pages, despite of the repeated parts of it. When you think about saving traffic, you have a thought of the previous decade if not century. You can already save much traffic by caching images and other stuff apart of the html.

Bye, Olaf.

RE: php conceptual Q?

Thanks all.
I'm quite familiar with ajax and even iframes and that's what I was thinking as well. The different situation is that the design was done by another developer who was not thinking for the whole. I wanted to get other opinions and you've supplied those. THANKS!

RE: php conceptual Q?

You're welcome.

Phil AKA Vacunita
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close