Forum Moderators: open

Message Too Old, No Replies

Framed layout

How to align content

         

allandal

9:38 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



Hi,

Does anyone know how to code a fixed width centered framed page? I want the framed page to be 700 pixels wide and centered.

It would be a simple top and main frame.

I can fix the width and center align the top frame in the coding for page top.html but the problem arises when I introduce the main page which is from a merchants site. This element of the page aligns to the left.

The coding I am using is as follows:
<frameset rows="130,*" frameborder="NO" border="0" framespacing="0">
<frame src="top.html" name="topFrame" scrolling="NO" noresize>
<frame src="http://www.companyname.com/pagename.html" name="mainFrame">
</frameset>

Is there something I can put in the frameset coding to do this?

cmarshall

9:44 pm on Dec 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What you want is iframes [cs.tut.fi], but...ick.

You may want to see if you have other alternatives. I consider frames to be a last resort.

allandal

11:07 am on Dec 23, 2006 (gmt 0)

10+ Year Member



iframes would be fine but I don't want to have a fixed length. I want the page to fill out with whatever the length of the main frame is as it changes from page to page.

cmarshall

2:24 pm on Dec 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oh, in that case, you may have better luck with a PHP include:

<div class="standard_css_stuff"><table style="width:100%"><tr><td><?php include ( "http://www.somewebpage.com/" );?></td></tr></table></div>

The <div> reacts to the context, and makes sure that your setting is correct in regards to the page, and the <table> reacts to the content, and makes sure that the entire page is included.

That will give you what you need. That's what I do for almost exactly the same thing.

However, you may need to get fancy and strip out page header information. It doesn't give you a real frame, so the page won't render in a real frame manner.

You pretty much have to use PHP. There's not really any other way to do it.

allow_url_fopen [us3.php.net] needs to be enabled, but I think it is by default in >4.0.3 PHP installs. It works on every server I've tried.

Achernar

3:53 pm on Dec 24, 2006 (gmt 0)

10+ Year Member Top Contributors Of The Month



If you include an external valid html page with php, you'll end up creating an invalid html structure. Probably with duplicated <html><head><body> tags.

cmarshall

7:09 pm on Dec 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you include an external valid html page with php, you'll end up creating an invalid html structure. Probably with duplicated <html><head><body> tags.

Yup. That's why I indicated you may need to get fancy.

I use this in a similar manner to my AJAX calls. I have PHP files that return incomplete content.

I'm not sure if you have a real answer available. I'll keep an eye out on this thread.

Achernar

11:30 pm on Dec 24, 2006 (gmt 0)

10+ Year Member Top Contributors Of The Month



if you want to set "mainFrame" width, modify your code to look like this:

<frameset rows="130,700,*" frameborder="NO" border="0" framespacing="0">
<frame src="top.html" name="topFrame" scrolling="NO" noresize>
<frame src="http://www.companyname.com/pagename.html" name="mainFrame">
<frame>
</frameset>