PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Nov 13, 2018 4:19 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Wed Apr 13, 2011 1:47 pm 
Offline
Forum Newbie

Joined: Wed Apr 13, 2011 1:41 pm
Posts: 1
I have never used PHP.

Can PHP modify a page after it has been served so that the modified page will be served next time?


Top
 Profile  
 
PostPosted: Thu Apr 21, 2011 3:01 am 
Offline
Forum Commoner

Joined: Tue Apr 19, 2011 7:57 am
Posts: 28
In combination with AJAX, you might. http://w3schools.com/ajax/default.asp


Top
 Profile  
 
PostPosted: Thu Apr 21, 2011 11:05 am 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6445
Location: 53.01N x 112.48W
Not really.

When a URL is requested of PHP, PHP generates some output, passes that output to the web server, and the web server then returns that to the client. Often, before the page is even fully served up, PHP has finished executing. After that, there is no way to change what was sent to the client.

~elvind mentions AJAX, which allows you to use Javascript to dynamically load content into an existing webpage, without loading the webpage. That allows you to modify the page as it exists for the client, but it doesn't change the output a PHP file generates.

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
PostPosted: Thu Apr 21, 2011 12:28 pm 
Offline
Jack of Zircons
User avatar

Joined: Thu Nov 09, 2006 9:30 pm
Posts: 4484
Location: California, USA
Tell us what you want to do and we can give you a better answer.


Top
 Profile  
 
PostPosted: Thu May 19, 2011 5:00 pm 
Offline
DevNet Master

Joined: Wed Feb 11, 2004 4:23 pm
Posts: 4872
Location: Palm beach, Florida
Yes, the most simplistic example:

Syntax: [ Download ] [ Hide ]
echo rand(1,10);
 

each time (or roughly each time) it will serve different content (random number). Guys I don't think hes talking about AJAX, the question implies a subsequent http request should serve new content. Yes this is possible, and is usually done.


Top
 Profile  
 
PostPosted: Thu May 19, 2011 9:44 pm 
Offline
Jack of Zircons
User avatar

Joined: Thu Nov 09, 2006 9:30 pm
Posts: 4484
Location: California, USA
Doesn't seem like this was really very important to him in the first place, anyway.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group