Click to See Complete Forum and Search --> : <iframe> resize problem should i be using asp?


lofi-pete
05-09-2005, 08:14 AM
Hi guys,

I've got a bit of a problem with my iframe - i have a page which contains an iframe and i need the iframe's height to automatically adjust to fit the contents. I've searched the javascript forum where there are a few threads relating to this but nothing that seems to solve my problem the way i would wish. I did however see a post that recommended using server side includes. So my question is, what does this involve and could someone point me in the right direction to getting the info i need. I'm totally new to this language but have done a bit with PHP, Javascript and of course HTML.

Any help would be greatly appreciated, Cheers folks!

simflex
05-09-2005, 12:02 PM
Let me make sure I understand you correctly.

When you say contents, do you mean title, header???

Like Home About Us Services, etc???


Since you know javascript, you are better off using javascript, if you ask me.

It is going to take a bit of work but you need to fake an image for each content, define the widht and height of each image and then put the contents of the header in a table within your iframe.

something similar to this:

<script src="fakedButtons.js">
</script>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" bgcolor="beige">
<table class="fakedButtons" border="1" cellpadding="0" style="border-collapse: collapse" width="600" id="table1" bgcolor="#CCCCFF" bordercolor="#800080" align="right">
<tr>
<td class="fakedButtons" align="center" width="80" nowrap><font size="2" color="#800080"><a target="_parent" href="yourFrame.asp?pn=<%=session("pn")%>&tab=1"><font size="2" color="#000000">Home</font></a></font></td>
<td class="fakedButtons" align="center" width="80" nowrap><font size="2" color="#800080"><a target="_parent" href="yourFrame.asp?pn=<%=session("pn")%>&tab=1"><font size="2" color="#000000">About US</font></a></font></td>

......
....
....
</tr>
</table>
</body>

This way, the height will automatically adjust. You will only need to adjust the width

But first, I need to make sure that I am not waaay off here.

lofi-pete
05-09-2005, 05:02 PM
Sorry, i didn't explain it very well. I'll try again. (thanks for replying so quickly anyhow!) Let me give you a broader idea of what i'm trying to do. (Also if you check out my website so far, it might help you to understand a bit better - www.loficriminal.co.uk (http://www.loficriminal.co.uk/shop.php) ).
try viewing a few different pages within the shop to illustrate the problem.

You may need to sit down for this!

I am building a website to sell music downloads and originally intended on building all of the content myself. I eventually decided I was being a tad optimistic, so I found a 'program' called zencart (www.zen-cart.com) which is basically a bucket load of php scripts that combine to produce a functioning e-commerce website. However, I still wanted to keep a lot of my original content and just have the zen cart stuff as a section of the site. So what I've done is put the whole of the zencart site within a page of my site using an <iframe>. The problem I have is that the content (or page) displayed within the <iframe> changes depending on what page is being viewed within zencart and hence the height of the page varies. So, I need to have the <iframe> resize automatically to fit whatever is being displayed within it. The thing which makes it more complicated is that, due to the structure of zencart, there aren't really any 'pages' as such that i can put code into. I think the page that you see is created dynamically by compiling a selection of php scripts. So, any script that I use to auto-resize the <iframe> must be in the main page rather than in each of the pages that are displayed within the <iframe>.

My experience with php was non existent until i started messing around with zencart, so I've learnt a bit but I'm still pretty much in the dark on this. I realise this is a lot to take in and I'm probably way out of my depth so any help you can offer would be really, really great. Cheers!

lofi-pete
05-10-2005, 02:08 PM
don't worry, i've sorted it! :D Thanks for your help anyway.