Solved

Make 2 pages show on 1 page

Posted on 2004-05-01
14
147 Views
Last Modified: 2010-04-06
Hi

Sorry for the doddgy Q tiltle - i don't want frames.

What i meant was

I'm using a script that brings in results 10 at a time by whatever rank i specify (popular, alphabetical etc.)

the address bar shows something like

http://mydomain.com/cgi-bin/us.cgi?locale=us&mode=cat&node=2&sort_type=%2rank&page_num=1

 for the next 10 results you click next and get

http://mydoamiain.com/cgi-bin/us.cgi?locale=us&mode=cat&node=2&sort_type=%2rank&page_num=2


What i'd like to do is bring up page_num=1 and page_num=2 on the same page. And maybe page_num=(upto whatever) as well.

Thanks




0
Comment
Question by:macuser777
  • 7
  • 6
14 Comments
 
LVL 10

Expert Comment

by:eeBlueShadow
ID: 10969117
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 105 total points
ID: 10969161
Just use iframes:

<body>
<iframe src="http://mydomain.com/cgi-bin/us.cgi?locale=us&mode=cat&node=2&sort_type=%2rank&page_num=1">
</iframe>
<iframe src="http://mydoamiain.com/cgi-bin/us.cgi?locale=us&mode=cat&node=2&sort_type=%2rank&page_num=2".
</iframe>

You can use as many iframes as you want to bring in as many pages as you want.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10969331
Hi

The iframes is doing the job - but i've never used them before so can you help me format them a bit?

This test page

I'd like the 1-10 and 11-20 to show without scrolling
- no horizontal scroll bar
- AdSense to show up inbetween

http://www.amazoneasyview.com/cd.html

Eventually i want all this to show up as a left fram on another page with one vertical scroll for the whole lot.

0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10969356
TryL
<iframe src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=1 " style="height:auto">
</iframe>

If that does not work you may have set it dynamically using Javascript.  However you will have a better chance of getting thing to work reliably if you use valid html.  That page is incomplete there is only a body.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10969437
Hi

I should have put the proper head content in to test - sorry - bad habit.

The AdSense works with the proper head content.

Overall it kinda works ok now - i found some iframe width,height attribute stuff to add.
It would be much better with an auto height though.

I'll leave the q. for a bit in case any ideas on the height thing.

Otherwise - invaluable help as ever :) - thanks
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10969519
We still have something else we can try.  Give both the iframes an id.  id="IF1" and id="IF2" and a name:
name="NIF1" and name="NIF2"

Get rid of the height and then do the body of the page this way:
<body onload="setH('IF1','NIF1'); setH('IF2','NIF2');">

Then put this script in the head:

<script type="text/javascript">
function setH(frm,fname)
{
   obj=document.getElementById(frm);
   obj.style.height=top.frames[fname].document.body.scrollHeight+'px';
}
</script>

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10969588
Id didn't work but i might have coded it wrong...maybe left in some iframe attributes that should be edited out...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<script type="text/javascript">
function setH(frm,fname)
{
   obj=document.getElementById(frm);
   obj.style.height=top.frames[fname].document.body.scrollHeight+'px';
}
</script>



</head>

<body onload="setH('IF1','NIF1'); setH('IF2','NIF2');">

<Div align="center">

<iframe marginwidth="0" marginheight="0" width="190"  scrolling="no" frameborder ="0" id="IF1" name="NIF1"  src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=1 " > 
</iframe>


<BR><BR>

<iframe marginwidth="0" marginheight="0" width="190" id="IF2" name=" NIF2" scrolling="no" frameborder="0" src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=2 " >
</iframe>


<div>

</body>

</html>
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10969607
Okay, I'll take another look in the morning... I'm about to call it a night.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10969618
me too...it's 1.am + in the UK...see ya later

macuser
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10971672
Let's try it from the other direct and run a method inside the iframe window:

<script type="text/javascript">
function setH(frm,fname)
{
   H=top.frames[fname].document.body.scrollHeight;
   top.frames[fname].resizeTo(190,(H+10));
}
</script>

That should work as long as the pages are coming form th esame domain.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10973447
The pages are coming from the same domain in a sense.
It's my domain - but it picks up the info from an amazom XML feed which i just plug into.

Didn't work though.

When you say try and run a method from inside the iframe window
i'm assuming you didn't mean to put the code in the <iframe...

this is what i tried

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">
function setH(frm,fname)
{
   H=top.frames[fname].document.body.scrollHeight;
   top.frames[fname].resizeTo(190,(H+10));
}
</script>


</head>

<body onload="setH('IF1','NIF1'); setH('IF2','NIF2');">

<iframe marginwidth="0" marginheight="0" width="190"  scrolling="no" frameborder ="0" id="IF1" name="NIF1"  src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=1 " > 
</iframe>

<BR><BR>

<iframe marginwidth="0" marginheight="0" width="190" id="IF2" name= "NIF2" scrolling="no" frameborder="0" src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=2 " >
</iframe>

<BR>


</body>
</html>
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10973536
If the content is not coming from your domain it is not going to work, because that creates a security violation, and you can't access the element with the external content.  To get around it the content pages would have to set it themselves by doing the body tags as:

<body onload="resizeTo(document.body.scrollWidth, document.body.scrollHeight)">

If you have the capability of modifying the incoming page then that will take care of it, but if you cannot put the code right on the content pages you are out of luck.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 11216036
Thanks for all the input on the auto resizing - i've been playing with it but no joy. There's a new version of the script coming out soon - maybe it will be possible with that.

macuser
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 11216471
Glad we could help.  Thanks for the A. :^)

Cd&
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CSS display:none AND display:block on same element 3 93
replace quotes with UTF-8 character 38 97
Problem to file 3 75
Animated .jpg? 13 79
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question