TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

July 01, 2024, 08:17:07 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,283
  • Total Topics: 21,227
  • Online today: 93
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 106
  • Total: 106

Iframes... an easy question

Started by Halfhidden, March 02, 2009, 08:44:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Inny

Quote from: Halfhidden on March 02, 2009, 09:51:28 PM

Inny... I like the way this is done and I'll give it a go. It's just a pity about the dynamic resizing of frames as there can be a huge void between pictures if the script only adjusts the first call.
Wouldn't it be nice to call it as SSI's ;D (still I can dream on)

Yeah tell me about it. Im suffering a bit from this and dying a bit inside when i have to scroll up.

Maybe you should try to find if theres a script or something to convert from coppermine to SMF Gallery. Im currently using SMF gallery PRO and you dont need to mess up with iframes and as far as i know SMF gallery is fully supported and will fit you fine if you decide to go with TP and SMF.

I dont have my SMF Gallery viewable for non-members but if you wanna check it out send me a PM to make you a temporary account.

Lesmond

Thanks Inny I will have to look into trying that out too!

@ Halfhidden lets us know how you get on with that, will try and help if you get stuck

Ken.

I didn't compare the code below to the one posted by Lesmondâ„¢ so it could very well be the same... in any case, it is the code currently in use for my cpg/iframe page in a TinyPortal HTML article.
You can see my page HERE.

From everything that I've read over the past couple of years iFrames seem to always be problematic because of scroll issues (even with an 'auto-adjusting' script like this one) and also sometimes cause display issues in various browsers... my personal experience bears that out.
<script type="text/javascript">

/***********************************************
* IFrame SSI script II- ? Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids)
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids] : document.getElementById(iframeids)
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>  <iframe frameborder="0" scrolling="yes" style="width: 100%; display: none;" hspace="0" vspace="0" marginheight="0" marginwidth="0" src="http://www.FULL_PATH_TO)YOUR_CPG/index.php" id="myframe"></iframe>
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

ZarPrime

Quote from: Halfhidden on March 02, 2009, 09:51:28 PM
Thanks ZarPrime I appreciate your input 8)

Inny... I like the way this is done and I'll give it a go. It's just a pity about the dynamic resizing of frames as there can be a huge void between pictures if the script only adjusts the first call.
Wouldn't it be nice to call it as SSI's ;D (still I can dream on)

Unfortunately, this is a well known limitation when working with iframes.  Even if the iframe is set to auto-adjust, it only detects the height when the page is first accessed.  Perhaps, someday, somebody will find a way to use some sort of Ajax function to dynamically adjust an iframe as different pages are accessed.  As you say, we can all dream on. ;) :'(

ZarPrime

Ken.

Quote from: Inny on March 02, 2009, 10:04:07 PM
Quote from: Halfhidden on March 02, 2009, 09:51:28 PM

Inny... I like the way this is done and I'll give it a go. It's just a pity about the dynamic resizing of frames as there can be a huge void between pictures if the script only adjusts the first call.
Wouldn't it be nice to call it as SSI's ;D (still I can dream on)

Yeah tell me about it. Im suffering a bit from this and dying a bit inside when i have to scroll up.

Maybe you should try to find if theres a script or something to convert from coppermine to SMF Gallery.
Im currently using SMF gallery PRO and you dont need to mess up with iframes and as far as i know SMF gallery is fully supported and will fit you fine if you decide to go with TP and SMF.

I dont have my SMF Gallery viewable for non-members but if you wanna check it out send me a PM to make you a temporary account.

SMFHacks has a converter for cpg, but it currently is not working correctly. He has said that he is going to update/fix it at some point, but I don't know when that's to happen.
Dragooon has a very nice gallery as well and his is free. He has posted a converter for cpg (and for SMF Gallery) but I haven't tried it so don't know if it's completed or current.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

Halfhidden

Thanks for the replies everyone.
@inny I have considered changing galleries but I have Stramm mod installed in Coppermine and this give members PM's within the gallery, avatars on comments, buddies list within the gallery, watermarks, instant notification of comments and much more. I've also invested in a guess game script.... so it's hard to find an act to follow Coppermine. The MKPortal port is absolutely fantastic and no scrolls are needed as the script calls SSI. But I'm the only one at the moment who is bothering to update the port with the latest versions of Coppermine. My fear is that if I stop the port will be abused and exploited as the Coppermine script will be out of date.


Halfhidden

@Ken I looked at Dragons and noticed that it was about 12 versions behind the current build. I liked the way it was ported, but I worried about vulnerable scripts from CPG.

Ken.

#17
For a long time I thought that cpg was THE best gallery available and in some ways still do think so, but for someone who is running SMF/TP I don't think that really holds up... not because of cpg, but because there is just no good way to include it in a SMF forum. Yes, I know that the bridge function offers a great way to tie the member base of SMF and cpg together, but after that it just will not work together well.

Although my cpg iFrame is still there I've stopped using it and even removed the links from my other pages.
Currently my forum uses SMF Gallery Pro, but I'll likely move to Dragooon's SMF Media Gallery soon.

On the versions for smg... he has only been working on it for a few months and has some more work to go on it, but it's also true that he has made tremendous progress and so I have no worries about changing over to use it sometime within the next couple of months.

EDIT: for spelling.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

Halfhidden

@Ken I stand corrected. I thought you meant a different dragon who ported coppermine and hasn't updated his port or the coppermine scripts since version 1.3X... roughly 2006.
I can see the link you showed has promising features.
I agree that Coppermine are hell bent on fighting off any kind off port or integration.... its a real pity :(