CPG with iframe CPG with iframe
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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