473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

alternative to frames in php?

everywhere I go, i get told "don't use frames, use php instead"

ok... so how do i go about it?

I want a top banner that doesn't move, and a "contents" type list on the
left (that may have a scroll bar)
and the rest of the window is the main page (obviously)

now, I dont want all 3 areas to be loaded/repainted when i click a link on
the contents, just the "main area"

Is this achievable in php?

Thanks in adavance
Jul 17 '05 #1
12 6514
David <lo********@yahoo.co.uk> wrote:
everywhere I go, i get told "don't use frames, use php instead"

ok... so how do i go about it?
Why not ask the people that tell you to use php instead of frames? They
surely have done that themselves!
I want a top banner that doesn't move, and a "contents" type list on the
left (that may have a scroll bar)
and the rest of the window is the main page (obviously)

now, I dont want all 3 areas to be loaded/repainted when i click a link on
the contents, just the "main area"

Is this achievable in php?


Not without using (i)frames.

Use frames, what you want is what they can be used for. You just have to
remember the limitations imposed by frames. Ask the people who say that
you shouldn't use frames to explain these to you.

Jul 17 '05 #2
"don't use frames, use php instead" ?

That's like saying, don't drive, use gasoline instead.
What you're asking to do can't be done in php (repainting a single
section) since that isn't what php does. Look into CSS or Javascript
if you really want to repaint individual sections. The main problem is
that you don't want the menu and banner repainted even tho they'll be
cached...

Ben
dq5studios.com

Jul 17 '05 #3
David wrote:
everywhere I go, i get told "don't use frames, use php instead"

ok... so how do i go about it?

I want a top banner that doesn't move, and a "contents" type list on the
left (that may have a scroll bar)
and the rest of the window is the main page (obviously)
The CSS property "overflow" can be set to "scroll" to get scroll bars on
any block-level HTML element. As usual, this doesn't work on old
browsers such as IE.


now, I dont want all 3 areas to be loaded/repainted when i click a link on
the contents, just the "main area"
You can use XMLHttpRequest to update only a certain section of an HTML
document with Javascript. I found useful information on this here:
<http://jibbering.com/2002/4/httprequest.html>

Is this achievable in php?
No. PHP is server-side, but loading/repainting HTML pages is a
client-side thing.

Thanks in adavance

Jul 17 '05 #4
David wrote:
everywhere I go, i get told "don't use frames, use php instead"

ok... so how do i go about it?

I want a top banner that doesn't move, and a "contents" type list on the
left (that may have a scroll bar)
and the rest of the window is the main page (obviously)

now, I dont want all 3 areas to be loaded/repainted when i click a link on
the contents, just the "main area"

Is this achievable in php?

Thanks in adavance


Hi David,

Frames is a CLIENT side solution.
PHP only delivers the HTML the CLIENT uses.
Of course PHP does a lot more, but from the client's point of view (a
browser) this is all.
The browser doesn't see the difference between a flat HTML-page, or a very
sofisticated PHP-script that delivers the HTML.

So the advise to use PHP instead of frames doesn't make too much sense,
since PHP is typically SERVERside.

That said: Have a look at Javascript and CCS, since that technologies can
help you more with banners and such.

To show you the difference:
for example: You can easily let Javascript change a image (banner) every 30
seconds.
Where PHP comes into picture if for example: If you have 200 banners to
choose from, you can use PHP to deliver a random image:
<img src="myrandompict.php">

myrandompict.php is a simple script that returns an image from the server.

Hope that helps a bit.
Regards,
Erwin Moller
Jul 17 '05 #5
What I recommend is a trick using the php include() function

Let's say you have a layout and you have a default content area. Use
the php include function.

<?php

// Let's do this just in case there is no variable
if(!$page) include("home.php");

// Include File Based on Variable
if($page == "home") include("home.php");
if($page == "about") include("about.php");

?>

Now, make each of these files, without anything other than the content.
When linking to these pages, just type index.php?page=about, for
example to include the about page.

Hope this helps.

Jul 17 '05 #6
What I recommend is a trick using the php include() function

Let's say you have a layout and you have a default content area. Use
the php include function.

<?php

// Let's do this just in case there is no variable
if(!$page) include("home.php");

// Include File Based on Variable
if($page == "home") include("home.php");
if($page == "about") include("about.php");

?>

Now, make each of these files, without anything other than the content.
When linking to these pages, just type index.php?page=about, for
example to include the about page.

Hope this helps.

Jul 17 '05 #7
Thanks for the advice guys.
much appreciated
Jul 17 '05 #8
.oO(in************@gmail.com)
What I recommend is a trick using the php include() function

Let's say you have a layout and you have a default content area. Use
the php include function.

<?php

// Let's do this just in case there is no variable
if(!$page) include("home.php");
This line will cause a notice (set error_reporting to E_ALL on your
development machine). You should check with isset() instead.
Additionally the above relies on register_globals. Better use the
superglobal arrays $_GET, $_POST etc:

if (!isset($_GET['page'])) {
include 'home.php';
}
// Include File Based on Variable
if($page == "home") include("home.php");
if($page == "about") include("about.php");
For 10 pages you would need 10 if-statements. Consider something like
this:

$pages = array('home', 'about', ...);
if (isset($_GET['page']) && in_array($_GET['page'], $pages)) {
include $_GET['page'].'.php';
} else {
include 'home.php';
}

Also think about what will hapen if a user calls the pages directly
without your index script:

www.example.com/about.php

Will they still work as expected? Better store such files outside the
server's document root if you don't want them to be accessible directly
by an URL.
Now, make each of these files, without anything other than the content.
When linking to these pages, just type index.php?page=about, for
example to include the about page.


You should have a look at mod_rewrite to make the URLs better readable
and more search engine-friendly:

www.example.com/about/

can then be rewritten server-internally to

www.example.com/?page=about

Micha
Jul 17 '05 #9
"David" <lo********@yahoo.co.uk> wrote in message
news:41********@clear.net.nz...
everywhere I go, i get told "don't use frames, use php instead"

ok... so how do i go about it?

I want a top banner that doesn't move, and a "contents" type list on the
left (that may have a scroll bar)
and the rest of the window is the main page (obviously)

now, I dont want all 3 areas to be loaded/repainted when i click a link on
the contents, just the "main area"
That's what frames are for.
Is this achievable in php?


No.
Jul 17 '05 #10
In addition ot the PHP suggestions so far, I would also recommend
learning CSS2. These are good places to start:

http://glish.com/css/
http://www.meyerweb.com/eric/css/edge/

bblackmoor
2005-01-12
Jul 17 '05 #11
David wrote:
everywhere I go, i get told "don't use frames, use php instead"
They would have told "don't use frames, use div instead" which is a
valid point in terms of CSS based design--you can position the
container anywhere (fixed or scrollable) by just controlling the
stylesheet.
ok... so how do i go about it?

I want a top banner that doesn't move, and a "contents" type list on the left (that may have a scroll bar)
and the rest of the window is the main page (obviously)

now, I dont want all 3 areas to be loaded/repainted when i click a link on the contents, just the "main area"

Is this achievable in php?


PHP can spits out HTML or JS or anything you specify. So, PHP can do
nothing here. You cannot achieve what you wanted without using frames
or XMLHttpRequest (JS). But, usually you'll need to refresh or repaint
or rotate the banner. If your concern is about loading time and
efficiency you should use div/CSS based design instead of frames.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #12
Thanks, I'll take a look at this.
In the meantime, I am using a start page that gives the user the option of
frames.
But I am keen to try it in CSS due to other benefits
or rotate the banner. If your concern is about loading time and
efficiency you should use div/CSS based design instead of frames.

Jul 17 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: McKirahan | last post by:
I said I wouldn't use "eval()" anymore but I need help to do it. Below is some stripped-down code (4 lines; watch for word-wrap) extracted from USGA.COM that preloads images: main_nav_home_F1...
5
by: Peter N | last post by:
How to I eliminate the gap between frames without using the 'framespacing' attribute in the <frameset> tag? (I'm using IE 6) Can I use CSS do this? Thanks Peter (Please remove the...
6
by: Eric Bodden | last post by:
Hi! I would like to use alternative stylesheets in combination with frames. Is that doable? My problem ist that when I - as the user - switch the stylesheet of the framset page, then the...
1
by: SpamProof | last post by:
I have a frameset that breaks my page into 3 sections. Top, middle & bottom. My navigation is in the middle part. I use the following code to change my top & bottom page when a user clicks a...
20
by: Tammy | last post by:
What would be a good alternative to using frames? I need something that will section my webpage into two halves and can change both frames on a single click. Thanks in Advance, Tammy
10
by: ian | last post by:
Does anyone know what the best alternative to using frames? I've looked at Object but this doesn't seem to work in IE6... TIA Ian
2
by: C P | last post by:
I'm trying to build a custom web control and I know that frames aren't a great idea, but I'm not clear on how else to get what I'd like. I'd like a tree (for navigation) in a left hand pane, and...
9
by: DaveF | last post by:
I have an ASP site that has a frameset below. I am in the process of redesigning/coding in ASP.NET. What are my alternatives to framesets. The execute frame does most of the processing. This is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.