CPG with iframe CPG with iframe
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

CPG with iframe

Started by fareforce, August 19, 2006, 08:55:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fareforce

***Only tested in IE6. Does not work with Firefox***

This is more of a coding thing instead of cpg thing, but I was looking to iframe cpg into my website, and did a quick search to see if there was an easy way to do it. All of the threads I came accross people were using width="100% height="100%". Well we all know that this doesn't work very well with a php driven script. Resulting in a small window that scrolls up and down. So, next people were trying height="400", etc. This still doesn't work well as CPG can grow and shrink in height. So, I present you with my solotion:

In your website between your head tags add:

<script language="javascript">
<!--
function iFrameHeight() {
if(document.getElementById && !(document.all)) {
h = document.getElementById('iframename').contentDocument.body.scrollHeight;
document.getElementById('iframename').style.height = h;
}
else if(document.all) {
h = document.frames('iframename').document.body.scrollHeight;
document.all.iframename.style.height = h;
}
}
//-->
</script>


Next where you want your iframe to start add:


<iframe onLoad="iFrameHeight();"
src="http://www.yoursitehere.com"
scrolling="no" scroll="auto"
id="iframename" name="iframename"
marginwidth="0" marginheight="0" frameborder="0"
style="width:100%;" height="100px">
</iframe>


You need to replace the "http://www.yoursitehere.com" with path to CPG. This can be a relitive path (ie. "/cpg/index.php"). I recommend using relitive paths to help speed things up.

Like I said I know it is 100% coppermine related, but I saw a lot of people looking for this, and thought I would help out in the way I know how. The only spot you might run into a few problems is the admin control panel which you can just go to your cpg install using the full path.
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com