The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> HTML Programming
|
Page 2 -
Is it OK to use FRAMES for a site?
Page 2 - Discuss Is it OK to use FRAMES for a site? in the HTML Programming forum on Dev Shed. Is it OK to use FRAMES for a site? HTML Programming forum covering discussions of HTML and XHTML, as well as HTML-related issues such as writing W3C Compliant code. Use HyperText Markup Language for building websites.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 17th, 2005, 12:08 AM
|
|
Contributing User
|
|
Join Date: Oct 2004
Posts: 556
Time spent in forums: 2 Days 12 h 9 sec
Reputation Power: 0
|
|
|
I DID IT!!!!!!!!!!!!! YAY
HAHA
This rocks. Thank you guys SO MUCH for all the help. I figured out the rest, about making my own IF statement for the main index.php load cuzz $page has no value upon first load.
THen the links use kravvitz' think and it works.
THANKS!
|

January 17th, 2005, 03:59 PM
|
 |
(retired)
|
|
Join Date: Dec 2003
Location: The Laboratory
|
|
|
MasterMinds - make sure you limit the possible page values. Don't let any page request go through. There are a number of php worms taking advantage of sites that do that.
|

January 17th, 2005, 04:12 PM
|
|
Contributing User
|
|
Join Date: Oct 2004
Posts: 556
Time spent in forums: 2 Days 12 h 9 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by SimonGreenhill MasterMinds - make sure you limit the possible page values. Don't let any page request go through. There are a number of php worms taking advantage of sites that do that. |
Hi. Let me see if I get this right.
Ok basically, upon the original index page load $page has NO value at all. I used an IF statement to say that if page has no value, then use $page = page1.php
Then what happens is, if page does have a value (from the url obviously) it uses that value.
Here is my original IF then - done out of the blue just from guessing, since I don't do PHP - although I guess now thanks to this thread I sort of do
Code:
<?php
if($page == '')
{
$page = "page1.php";
}
?>
Ok. So now I need to tell it firstly that I allow other values, and say that if it has this other value send it here, so far I offer values page1.php and page2.php
Code:
<?php
if($page == '')
{
$page = "page1.php";
}
if($page == 'page1.php')
{
$page == "page1php";
}
if($page == 'page2.php')
{
$page == "page2.php};
}
else()
{
$page == "goawayhacker.php"
}
?>
Ok that is my wild guess. It allows only the values i put in the function - and will redirect to tubgirl if someone tries to mess with it
ok anyways - I am guessing the shorter way is to use some statement that sasy "if $page does equal this, or this, or this etc.. then..."
I just dunno that syntax since I'm not a programmer
Lemme know the critique Simon thanks!
|

January 17th, 2005, 04:22 PM
|
 |
|<.+#f@#+.&.|
|
|
Join Date: Mar 2002
Location: norway
|
|
__________________
|

January 17th, 2005, 04:29 PM
|
 |
(retired)
|
|
Join Date: Dec 2003
Location: The Laboratory
|
|
That's going to get so painful when you get lots of pages. It's probably better to use a switch statement as Akh said - and have a default: entry to just direct somewhere safe. You can also use in_array(), which I discussed in this thread.
Cheers,
Simon
|

January 17th, 2005, 05:18 PM
|
|
Contributing User
|
|
Join Date: Oct 2004
Posts: 556
Time spent in forums: 2 Days 12 h 9 sec
Reputation Power: 0
|
|
|
EDIT: Learned how to use switch and got it to work. THANK YOU GUYS! I learned a lot from this thread, damn.
|

January 17th, 2005, 05:30 PM
|
|
Registered User
|
|
Join Date: Jan 2005
Posts: 16
Time spent in forums: 3 h 3 m 12 sec
Reputation Power: 0
|
|
Hello,
I highly recommend using PHP includes for this type of site. I have multiple sites running in this fashion. Create a main index.php page that will hold your menu and then create a table that will serve as a container for your information. When the user selects things from the menu pass them back to the index.php page with HTTP variables liek this.
index.php?pageID=news
The news will be able to load in the 'main table' table of your site without having to reload the rest of the index.php page (i.e. headers, footers, menus, copyright info, etc)
Here is a sample of the code used on the index.php page to include the rest:
Code:
<?php
$id = $HTTP_GET_VARS["id"];
if($id==null)
{
@include'PHP/news.php';
}
else
{
if(file_exists('PHP/'.$id.'.php'))
{
$page = "PHP/$id.php";
@include($page);
}
else
echo"Error: Could not include Page.";
}
?>
|

January 17th, 2005, 05:37 PM
|
 |
CSS & JS/DOM Adept
|
|
Join Date: Jul 2004
Location: USA
|
|
|
MCowboyE19, you are mistaken about how it works. It reloads the entire page, it just has the other files in cache so those don't have to be downloaded again.
Their is no requirement to use tables. Tableless layouts can work fine with includes as well.
Wouldn't it be easier to use TheJim01's solution?
|

January 17th, 2005, 05:38 PM
|
|
Contributing User
|
|
Join Date: Oct 2004
Posts: 556
Time spent in forums: 2 Days 12 h 9 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by MCowboyE19 Hello,
I highly recommend using PHP includes for this type of site. I have multiple sites running in this fashion. Create a main index.php page that will hold your menu and then create a table that will serve as a container for your information. When the user selects things from the menu pass them back to the index.php page with HTTP variables liek this.
index.php?pageID=news
The news will be able to load in the 'main table' table of your site without having to reload the rest of the index.php page (i.e. headers, footers, menus, copyright info, etc)
Here is a sample of the code used on the index.php page to include the rest:
Code:
<?php
$id = $HTTP_GET_VARS["id"];
if($id==null)
{
@include'PHP/news.php';
}
else
{
if(file_exists('PHP/'.$id.'.php'))
{
$page = "PHP/$id.php";
@include($page);
}
else
echo"Error: Could not include Page.";
}
?>
|
cowboy - this is what I am doing, thanks to all the help in this htread. thank you for the suggestion, i love these php includes and vars.inc and template.inc and the switch thingie.
so much good stuff i can do from those now.
|

January 31st, 2005, 04:21 PM
|
|
Registered User
|
|
Join Date: Jan 2005
Posts: 1
Time spent in forums: 6 m 12 sec
Reputation Power: 0
|
|
|
Ive tried both, but still have errors when $page is blank
Ive tried this for my index.php:
<?
require('intro.html');
require('header.html');
require('leftnav.html');
/********** Load Main Content **********/
$page = $HTTP_GET_VARS["page"];
if($page==null)
{
@include'body.html';
}
else
{
if(file_exists($page))
{
$page = "$page";
@include($page);
}
else
echo"Error: Could not include Page.";
}
/********** End Main Content **********/
require('footer.html');
?>
as well as this:
<?
require('intro.html');
require('header.html');
require('leftnav.html');
/********** Load Main Content **********/
if($page == '')
{
$page = "body.html";
}
$pagename = $_GET['page'];
//***** patching hole allowing external pages being loaded
//***** compatible with PHP 3, 4, & 5
$myfiles = array();
$ismine = false;
$thisdir = opendir('./');
while(($file = readdir($thisdir)) !== false){
if($file == $pagename){
$ismine = true;
}
}
closedir($thisdir);
//***** end patch
if($pagename == '' or $ismine == false){
$pagename = 'body.html';
}
require($pagename);
/********** End Main Content **********/
require('footer.html');
?>
But either way, if I address the URL without passing a $page variable, then I get an
Notice: Undefined index: page in c:\easyphp\www\index.php
error in the output, if I midify the URL with the variable, then there is no error???
Any ideas?
All help is greatly appreciated, thanks in advance...
|

January 31st, 2005, 04:44 PM
|
 |
Cunning Linguist
|
|
Join Date: Jul 2003
Location: I used to live at home, now I stay at the house
|
|
|
This is a php issue, please ask php questions in the PHP Develmpent forum...
|

January 31st, 2005, 08:57 PM
|
 |
Type Cast Exception
|
|
Join Date: Apr 2004
Location: OAKLAND CA | Adam's Point (Fairyland)
|
|
|
You got plenty of responses on implementing PHP or SSI includes, which is the way I'd go myself. Back to the question:
Q: Is it OK to use FRAMES for a site?
A: No. Here's why: when you use frames you load a file that in turn loads the framesets. However, when search engines bot the site they aren't necessarilly aware of the frames and therefore, if someone finds your site on a search they are likely to hit only that page, which won't load the frames, and thus your navigation is also lost.
I host a site for a friend of mine and despite my pointing this out to him he is reluctant to change it. I setup a dynamic site for him, but being not very savvy with things he wanted to just use his website designer tool (whatever he's using). When I look at his weblogs, it's painful. Thousands of hits to specific pages from searches which, of course, don't have the navigation to the rest of the site.
Presently I'm trying to talk him into figuring out how to turn those frames into includes with his program. *sigh*
__________________
medialint.com
“Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|