SitePoint Sponsor |
|
User Tag List
Results 1 to 11 of 11
Thread: PHP includes & iFRAME
-
May 25, 2003, 17:48 #1
PHP includes & iFRAME
hey guys,
im trying to find an alternative solution to iFRAME as most browers do not like iFRAME.
now i was trying to use PHP and tried the following...
PHP Code:<?php
if ($show == "") {
include ("main.php");
} else {
include ("$show.php");
}
?>
any ideas?rIGO
-
May 25, 2003, 18:00 #2
- Join Date
- Sep 2002
- Location
- Canada
- Posts
- 2,087
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
Try
<?php
if ($_GET['show'] == "" ) {
include 'main.php';
} else {
include $show.'.php';
}
?>"A nerd who gets contacts
and a trendy hair cut is still a nerd"
- Stephen Colbert on Apple Users
-
May 26, 2003, 02:42 #3
tried it.... didnt work.
rIGO
-
May 26, 2003, 03:14 #4
- Join Date
- Apr 2001
- Location
- Canada
- Posts
- 5,458
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
PHP Code:<?php
$show = addslashes( strip_tags( $_GET['show'] ) );
if (empty($show))
{
include('main.php');
}
else
{
include($show . '.php');
}
?>Mike
It's not who I am underneath, but what I do that defines me.
-
May 26, 2003, 04:37 #5
ok now it works.... but i have another problem... in news i want restricted access so i have created a session. obviously when i call index.php?show=news this error comes up
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
any ideas...how i can arrange it?rIGO
-
May 26, 2003, 08:18 #6
- Join Date
- Sep 2002
- Location
- Canada
- Posts
- 2,087
- Mentioned
- 1 Post(s)
- Tagged
- 1 Thread(s)
You have to put session_start() before any info is sent to the browser. IE
<?php
session_start();
$show = addslashes( strip_tags( $_GET['show'] ) );
if (empty($show))
{
include('main.php');
}
else
{
include($show . '.php');
}
?>"A nerd who gets contacts
and a trendy hair cut is still a nerd"
- Stephen Colbert on Apple Users
-
May 26, 2003, 14:20 #7
Originally Posted by The New Guy
rIGO
-
May 26, 2003, 14:23 #8
- Join Date
- Dec 2001
- Location
- UK
- Posts
- 105
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It doesn't matter when you start the session. Also, unless you use output buffering you don't have choice because, as The New Guy says, you cannot start a session after any characters have been sent to the client's browser.
-
May 26, 2003, 17:06 #9
ok...i got news.php working with that... but now i get the following error for main.php (main.php does not need session_start):
session_start() [function.session-start]: Cannot send session cookie - headers already sentrIGO
-
May 26, 2003, 17:08 #10
sorry news.php doesnt work with this method... the error comes again.
session_start() must be specified somewhere else...i guess...before the actual headers. right?rIGO
-
May 27, 2003, 00:10 #11
- Join Date
- Dec 2001
- Location
- UK
- Posts
- 105
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
In a nutshell, session_start() should be specified before any headers are sent to the client's browser. Stick it at the top of the page.
Bookmarks