473,324 Members | 2,511 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,324 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 6506
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.