Solved

Make 2 pages show on 1 page

Posted on 2004-05-01
14
145 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
Comment Utility
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 105 total points
Comment Utility
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
Comment Utility
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
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
Comment Utility
me too...it's 1.am + in the UK...see ya later

macuser
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Glad we could help.  Thanks for the A. :^)

Cd&
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now