Solved

Make 2 pages show on 1 page

Posted on 2004-05-01
14
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
14 Comments
 
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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.
Suggested Courses

623 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