PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 2nd, 1999, 08:34 AM
Ulrik N
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Hi there!

If I'm in the middle of a script, and want's to load a new dokument. How do I do That?
ex.
.
.
.some code
if ($var==true) {
load("./new.html")
}
.
.some other code



------------------
regds..
-ulrik-


Reply With Quote
  #2  
Old December 2nd, 1999, 07:42 PM
jpenix
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
You'd send a HTML redirect header using PHP's header() function, but it can only be done before any output goes to the screen.

So you can check some conditions at the top of your script (but don't print/echo anything), and then send the appropriate header() command to move the user to the correct page.

Reply With Quote
  #3  
Old December 2nd, 1999, 08:18 PM
TheHawk
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
You could use:
if ($var == true){
include("/path_to_file/filename.txt");
}

Reply With Quote
  #4  
Old December 3rd, 1999, 03:40 AM
Ulrik N
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I know of these two methods, but I'm in the middle of a html dokument, then I escape the html code and do some stuff...
If $var returns true I have to load a "clean" dokument, not related to the one I'm working in....

------------------
regds..
-ulrik-


Reply With Quote
  #5  
Old December 3rd, 1999, 06:59 PM
jpenix
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
To the best of my knowledge, once that page is on its way to your browser, that's it. You have no more control...

Maybe there's something you can do in JavaScript...

I don't see why you can't put the PHP that "does some stuff" up top before you start outputting to the browser... just rearrange your page code.

Then there's always PHP4 with output buffering that gives you some more control over this stuff... but even with that, when you flush the buffer to the browser, that's it. You have no control to change anything...

Reply With Quote
  #6  
Old December 4th, 1999, 03:48 PM
SepodatiCreations
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
You can use javascript. the following will load up a new page when it is encountered:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
location.href="new_page.htm"
[/quote]
If you are within some PHP code, you'd have to get out and process (or echo) this javascript commands within some <script> tags. This example might be kind of long, but I know it works. you can adjust it as need be.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<?php
if ($var == true) {
?>
<script language="javascript">
location.href="new_page.htm";
</script>
<?php
}
?>
[/quote]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > load new document

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap