 |
|
June 1 '10, 12:54 AM (#1)
|
|
|
New Member!
Join Date: May 2010
Posts: 2
|
Frames: Good or Bad?
Hello all. I already know that frames aren't the best thing to use on web pages (search engine troubles, compatibility issues etc.) but I need to have a common navigation bar between all of my pages. I've had problems before with needing to change a link for a 1 day offer or something and having to change each page, just to change it back again. My solution was to have a 'header.htm' in the root of my web directory and put an iframe on each page that's source is set to "/header.htm" The rest of the page is done with tables. Is is okay to have this one frame on each page???
Cheers,
Phillid
|
|
June 1 '10, 08:52 AM (#2)
|
|
|
WDF Staff
Join Date: April 2004
Location: Cottage Grove, Minnesota
Posts: 3,405
|
That's why you use PHP.
Either change the extensions of your files from .htm to .php,
or command the server to process .htm files as PHP (using .htaccess).
You then have a single file (script) that is your navigation menu.
It only contains the menu part. Perhaps you call it "menu.php".
On every other page, you "include" that script ... where it becomes inserted
into the place where you have included it. Example, your menu is called "menu.php" ...
You then put this line where you want it to appear ...
<?php include("menu.php");?>
Here's the interesting part though ... within "menu.php", you can also do normal
PHP scripting, so you could have the links change depending on which page they
were included. Maybe the current link becomes highlighted? Or you display some
special sub-links for a certain page?
|
|
June 1 '10, 08:33 PM (#3)
|
|
|
New Member!
Join Date: May 2010
Posts: 2
|
Can I just put HTML in the PHP file??? I presume so. Do I only need to rename the menu file to PHP or the whole site??
Thanks!
|
|
June 1 '10, 10:15 PM (#4)
|
|
|
WDF Staff
Join Date: April 2004
Location: Cottage Grove, Minnesota
Posts: 3,405
|
You can include any file, .txt .html or .php
The file that contains <?php include("menu.htm")?> must be a PHP script
or a mix of HTML and PHP. The file extension has to be .php
If you feel like messing with .htaccess, you can command your webhost to
process all of your .htm files as PHP. Use Google to find out about .htaccess
That means you can put PHP scripting in your .htm files without changing the
file extension.
Your website could actually be one web page if you wanted it ... "index.php".
PHP would simply change the content for each "page". There are in fact, no other
pages, only the content changes. All of the content, images, etc. for each "page"
is stored in text files or a database.
For example, see this site: To view the link you have to Register
Scroll down the links on the left. Notice each link has a code .. ie. ?explore=4
Those codes tell the PHP script which text to insert into the content area and
which banners to use on the top. There is basically only one file, not separate HTML pages.
|
|
June 1 '10, 10:15 PM (#5)
|
|
|
<div id="learn"></div>
Join Date: February 2008
Location: Port Huron, Michigan
Posts: 988
|
Yes, the menu.php will actually be html code. No doctype or anything, just the code for your menu. Of course using divs for your code is almost a must.
Yes to your other question too. Any page that uses an "include" file needs to have the php extension.
|
|
June 3 '10, 10:06 AM (#6)
|
|
|
WDF Regular
Join Date: November 2008
Posts: 411
|
I don't like frames because it is difficult for me to modify them.
|
|
July 3 '10, 07:17 PM (#7)
|
|
|
WDF Member
Join Date: July 2010
Location: Winnipeg
Posts: 25
|
Frames are bad. Use a menu.inc.php. I use for my menu
<?php
if($page == "about") {
echo '<li><a href="about.php" id="current">about us</a></li>';
}
else {
echo '<li><a href="about.php">about us</a></li>';
}
?>
Its very easy to add, remove, change the link, change the title of the button, and it affects all pages
|
|
July 6 '10, 06:08 PM (#8)
|
|
|
WDF Member
Join Date: July 2010
Posts: 27
|
Sounds like you need to head over to w3school.org and check out the php learning page.
|
|
July 8 '10, 01:38 PM (#9)
|
|
|
New Member!
Join Date: July 2010
Posts: 6
|
I think that Frames are too old... It was good when Internet was too slow, but now, I think that they are inneccesary and looks old
|
|
July 10 '10, 02:52 AM (#10)
|
|
|
New Member!
Join Date: July 2010
Posts: 4
|
Well I think that frames are bad as far as search engine optimization is concerned. Regarding user experience I think its bad too.
|
|
July 14 '10, 04:17 PM (#11)
|
|
|
New Member!
Join Date: December 2008
Posts: 5
|
bad for sure, frames are lame
|
|
July 14 '10, 04:19 PM (#12)
|
|
|
New Member!
Join Date: April 2003
Location: Raleigh-Durham, NC
Posts: 7
|
Frames have been deprecated and should not be used under any circumstances. Try using includes- better yet try using a clean CMS.
|
|
July 16 '10, 01:48 AM (#13)
|
|
|
New Member!
Join Date: July 2010
Posts: 3
|
Yes, most of them are not preffered frames generally, ofCourse the use of frames doesn't know properly indepth.. will discuss later... but here you can also incorporate your navigation buttons [header page]without using frames and without using any php script.
You can use Javascript component by using 'getElementByTagName' with in the javascript page for each tags.
or
You can simply use dreamweaver template is the best, incase you know much about dreamweaver software.
Cheers
soori
|
|
July 18 '10, 04:47 AM (#14)
|
|
|
WDF Member
Join Date: July 2010
Posts: 62
|
Quote:
Originally Posted by manugarhoyos
I think that Frames are too old... It was good when Internet was too slow, but now, I think that they are inneccesary and looks old
|
its not about age, its about SEO and frames are a nono as google has does not index then properly
|
|
July 19 '10, 04:31 AM (#15)
|
|
|
WDF Member
Join Date: June 2010
Location: California
Posts: 37
|
You can use javascript if you would like the page to be interactive. When you click on a link, it may only change a portion of the website without reloading the page (almost like changing the frames.)
But you should avoid using frames for the reasons you've mentioned and there is usually a substitute that will work a lot better.
Take a look at AJAX.
|
|
July 20 '10, 03:49 AM (#16)
|
|
|
New Member!
Join Date: July 2010
Location: hyderabad
Posts: 11
|
Search engines have a hard time indexing a Web site that is stuck in a frameset
|
|
July 22 '10, 04:40 AM (#17)
|
|
|
New Member!
Join Date: July 2010
Posts: 3
|
frames are always bad.
|
|
July 30 '10, 03:50 AM (#18)
|
|
|
New Member!
Join Date: July 2010
Location: perth
Posts: 11
|
frames are soo 90's.. as the smart kids have already said, just use include techniques..
|
|
July 30 '10, 06:36 AM (#19)
|
|
|
New Member!
Join Date: July 2010
Posts: 13
|
Ask yourself what you want to do with the data... PHP includes are dynamic, but you can use AJAX for a WAY more effective website. Furthermore, does your hosting support PHP... if not, use AJAX... you could use PHP for including more advanced things like classes, and database communication... other than that i would use AJAX to refresh protions of a website.
Example. You have a basic website with a menu, and a DIV displaying the content... with PHP includes you would have te refresh the whole page, thus loading images and code into your memory all over again. with AJAX you just reload the content inside the DIV, making loading a whole lot faster.
If you want to take an even easier road, look into jQuery. that's javascript too, but it's a insanely easy and versatile library for making your website do all sorts of stuff.
So my advice, at least dump the frames, and look into AJAX/jQuery for the most effective solution.
|
|
August 2 '10, 08:28 AM (#20)
|
|
|
New Member!
Join Date: August 2010
Posts: 2
|
Frame is not good for SEO friendly. Mostly Experts are using frames bcoz it's have different address from live web page.
Thanks
|
|
August 2 '10, 09:31 AM (#21)
|
|
|
WDF Member
Join Date: July 2010
Posts: 22
|
Don't use Frames, it is really awful, use php as mlseim told you
|
|
August 4 '10, 05:30 AM (#22)
|
|
|
[insert witty comment here]
Join Date: June 2008
Location: Sydney, Australia
Posts: 500
|
A while ago I designed a site for my uncle, To view the link you have to Register. I know it's simple, but that's not the point. The five 'pages' are actually all just the index.html. Javascript and AJAX was used to switch the tabbed content. The script turns <h1> into the header for a particular tab. If you don't have a mega amount of content and a few pages, it's a cool idea. It works well and is really fast to switch the tabs.
But I did that before I knew about php includes. I think includes is a better way to go, but the javascript tabber idea is pretty cool as well IMO.
|
|
August 4 '10, 01:54 PM (#23)
|
|
|
New Member!
Join Date: August 2010
Location: Sheffield, UK
Posts: 3
|
AJAX and CSS all the way. As has been stated search engines can't index a frames based index page very easily so bad SEO. Frames also limit you in terms of design and layout whereas a well written CSS based site will allow dynamic areas of your page that can be controlled and manipulated in terms of layout and style / design.
Dave
|
|
August 5 '10, 01:33 AM (#24)
|
|
|
WDF Member
Join Date: June 2010
Posts: 27
|
frames are old school. there are better codings and ways right now for websites.
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
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
|
|
|
|
| Advertisement |
|
|
|