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

Recent

Welcome to TinyPortal. Please login or sign up.

July 03, 2024, 07:59:32 AM

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

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.

Halfhidden

OK... I'm new to Tiny Portal.... you'll guess by the style of my question :uglystupid2:
I've been looking through the forum and docs for a couple of days now and despite finding lots of information on the subject, I haven't actually been able to achieve a successful Iframe.
This is what I've been doing and hopefully after you've stopped laughing you can tell me where I've gone wrong. Before I start I should say that I'm very familiar with smf and coppermine (the reason for the iframe... I'm hoping to use G6's version) and right now I'm looking to abandon MKPortal in favour of Tiny.
I created an article (html) Pasted in G6's iframe code, named it and saved it to a previously created category. I activated the the article and then tested it but all I saw was a blank block on the front page. So thinking that I did that wrong I took the url from the magnifying glass in the category and pasted that into my browser but got the same.
Clearly I have no idea where or what I need to do to be able to wrap coppermine into Tiny Portal.... A lot of the instructions I've seen assume that you already have a good grasp of the portal...... I haven't yet and it's a little embarrassing to say the least.... as I pride myself on my ability to learn quickly.
Is anyone kind enough to guide me on this please? I am really impressed with what I see from TP... I only wish that I hadn't gone around the world looking at so many portals before trying this fantastic portal out.... its great!

Lesmond

I use the same code on my old site, but in a custom action, using the custom action mod from smf, I could never get it to work right in a article  :o here is my gallery

<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[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
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 id="myframe" src="http://www.your-site/cpg/index.php" marginwidth="0" marginheight="0" vspace="0" hspace="0" style="width: 100%; display: none;" frameborder="0" scrolling="no"></iframe>


Inny

#2
Quote from: Lesmondâ„¢ on March 02, 2009, 08:59:33 PM
I use the same code on my old site, but in a custom action, using the custom action mod from smf, I could never get it to work right in a article  :o here is my gallery

Weird, im using that script in every single article in my page that uses an iframe, i have around 30-40 articles like that. Can check it here.

All my articles had it before the <iframe> but i got fed up on copy/pasting the script so i decided to make it a proper .js file and call it from them index.template.

Both ways were working fine for me.

Lesmond

Quote from: Inny on March 02, 2009, 09:06:01 PM

All my articles had it before the <iframe> but i got fed up on copy/pasting the script so i decided to make it a proper .js file and call it from them index.template.

Interesting I would like to know how you done it that way?

Halfhidden

Thanks guys... but I'm still none the wiser... how do I achieve this.

ZarPrime

Lesmonds script works good for Coppermine since it will be located in your domain.  I think that one of the problems with iframes is that if the site you are calling into the frame is external to your site, it's hard to get it to show without scrollbars if height of the site you're calling can change dynamically, even if the height is set for the maximum size of the page.  If it's no problem to show the scrollbars, you can generally just use the iframe without the script.

Looke here ---> http://talesofthehavenexpanse.com/SMF-1/index.php/page,17.html

This is a test page I just created on one of my sites using a iframe in a php article, with all visual options unchecked (set to show with the Phobos theme).

The code to do it is here ...

echo '<iframe src="http://google.com/"
height="800" width="100%" Scrolling="yes"></iframe>';

Does this help to answer your question?

ZarPrime

Halfhidden

Thanks ZarPrime but the dynamic iframe is needed for my gallery as we have hundreds of comments placed under pictures. The problem so far is when a member goes from one picture to another they are left with massive amounts of scrolling up and down to cope with the comments. At the moment I have the Coppermine gallery ported to MKPortal, but this isn't supported by Coppermine and updates are difficult and time consuming.
I'm sure G6's code still works but I simply don't know enough of Tiny Portal to get it working at all :uglystupid2:

ZarPrime

Well, Lesmond may be able to better help you get it sorted out since he is certainly more familiar with using Coppermine in an iframe.

Sorry I wasn't of much help on this.

ZarPrime

Inny

Quote from: Lesmondâ„¢ on March 02, 2009, 09:15:58 PM
Quote from: Inny on March 02, 2009, 09:06:01 PM

All my articles had it before the <iframe> but i got fed up on copy/pasting the script so i decided to make it a proper .js file and call it from them index.template.

Interesting I would like to know how you done it that way?

Im sure you have notepadd++ or something similar. Copy the script, create new in notepad++, paste the sript there and save it as Javascript File(.Js). Upload the file in your server in a directory you like.

Open your index.template file and find:


<script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . '/smooth.js?fin11"></script>'), '


Add after:


<script src="path_to_the_script" type="text/javascript"></script>


The code you should use after that in the HTML should just be:


<iframe id="myframe" src="externalpage.htm" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0"></iframe>


Quote from: Halfhidden on March 02, 2009, 09:29:56 PM
Thanks ZarPrime but the dynamic iframe is needed for my gallery as we have hundreds of comments placed under pictures. The problem so far is when a member goes from one picture to another they are left with massive amounts of scrolling up and down to cope with the comments. At the moment I have the Coppermine gallery ported to MKPortal, but this isn't supported by Coppermine and updates are difficult and time consuming.
I'm sure G6's code still works but I simply don't know enough of Tiny Portal to get it working at all :uglystupid2:

Unfortunately i have that aswell because the iframe script will just get the height of the page that will first load. If you have links in the iframe, then the follow up page will just give you a big scrolling bar if the content is less.

Halfhidden

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)