Iframe question

Posts from previous Beta sessions

Iframe question

Postby Gator81 » Tue Sep 18, 2007 3:00 pm

I have looked and tried but cannot get it to work, I am trying to use the post i found where I created a folder called roster and placed a index.php file in the folder and can load roster in an iframe. this seem to work in the older version but in the beta i am having no luck. It seems to try and load everything in a small box with scroll bar, and I am lossed.
I am using this that I have found
Code: Select all
<?php

/****************************************************************************/
/* ----> Module file used to load external URL's into an I-Frame            */
/*       Many thanks to forum users everywhere & specifically the           */
/*       wowroster team for inspiring me to figure this out!         <----  */
/****************************************************************************/

if (!defined('MODULE_FILE')) {
   die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

/****************************************************************************/
/* ----> change the site URL information that you wish to load here         */

$index=0;
$go_to_address1="./modules/wowroster/index.php";
$go_to_address=rawurldecode($go_to_address1);

/* end url input <---- */


?>

<script language="JavaScript">
<!--
function calcHeight()
{
  //Smallest the frame should ever be
  var min_height=0;
  //Largest the frame should ever be, 0 for no max
  var max_height=0;

  //find the height of the internal page
  var the_height = document.getElementById('roster_iframe').contentWindow.document.body.scrollHeight;
  if(the_height< min_height)
  {
     the_height = min_height;
  }
  else if(max_height != 0)
  {
     if(the_height > max_height)
     {
        the_height = max_height;
     }
  }
  //Pad it a bit so firefox doesn't show scrollbars
  the_height=the_height + 50;
  document.getElementById('roster_iframe').height=the_height;
}
//-->
</script>

<?php
include("header.php");
define('INDEX_FILE', true);
OpenTable();


/****************************************************************************/
/* ----> iframe code to load above URL                                      */

echo "<iframe id=\"roster_iframe\" SRC=\"".$go_to_address."\" width=\"100%\" onLoad=\"calcHeight()\"
framespacing=0 frameborder=no border=0 scrolling=auto></iframe>\n";

/* end iframe load <---- */

CloseTable();
include("footer.php");

?>


If you want to look, its a site I am playing with, and you should not need to llogin, just look at the left side under modules and click on roster to see what its doing
www.ktears.com

thanks for any info to figure this out
Gator81
WR.net Journeyman
WR.net Journeyman
 
Posts: 115
Joined: Fri Jun 01, 2007 4:44 am

Re: Iframe question

Postby Gator81 » Thu Sep 20, 2007 2:29 am

just to follow up to let anyone else know what I found out so far. From some more reading I tried this in the forums here.
Code: Select all
<?php

/****************************************************************************/
/* ----> Module file used to load external URL's into an I-Frame            */
/*       Many thanks to forum users everywhere & specifically the           */
/*       wowroster team for inspiring me to figure this out!         <----  */
/****************************************************************************/

if (!defined('MODULE_FILE')) {
   die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

/****************************************************************************/
/* ----> change the site URL information that you wish to load here         */

$index=0;
$go_to_address1="http://www.yoursitehere/roster/index.php";
$go_to_address=rawurldecode($go_to_address1);

/* end url input <---- */

include("header.php");
define('INDEX_FILE', true);
OpenTable();


/****************************************************************************/
/*  Modify the height= information to enlarge the i-frame if needed         */
/*  Default height=\"1200\"                                                 */
/* ----> iframe code to load above URL                                      */

echo "<iframe SRC=\"".$go_to_address."\" width=\"100%\" height=\"4800\"
framespacing=0 frameborder=no border=0 scrolling=auto></iframe>";

/* end iframe load <---- */

CloseTable();
include("footer.php");

?>




now this seems to work, but when someone loads a program that the hight is not the same seems to have alot of blank space, but it still works.
the first post worked with 1.7.3 fine, but will not work with the beta.
If anyone actually finds a way to get this to work with phpnuke with auto size it would be really great. I will keep looking and if I find something that works I will post my findings.
Gator81
WR.net Journeyman
WR.net Journeyman
 
Posts: 115
Joined: Fri Jun 01, 2007 4:44 am

Re: Iframe question

Postby Gator81 » Mon Oct 01, 2007 2:41 am

I know this is probally not an important question, but would someone please comment to let me know something please.
Gator81
WR.net Journeyman
WR.net Journeyman
 
Posts: 115
Joined: Fri Jun 01, 2007 4:44 am

Iframe question

Postby zanix » Mon Oct 01, 2007 3:38 am

By the looks of it, it should be good

The first one would be the best since it re-sizes the frame based on how big the contents are

What i would do is place this iframe code on a blank html page and see if it works there

Code: Select all
<html>
<head>
</head>
<body>
<script language="JavaScript">
<!--
function calcHeight()
{
  //Smallest the frame should ever be
  var min_height=0;
  //Largest the frame should ever be, 0 for no max
  var max_height=0;

  //find the height of the internal page
  var the_height = document.getElementById('roster_iframe').contentWindow.document.body.scrollHeight;
  if(the_height< min_height)
  {
     the_height = min_height;
  }
  else if(max_height != 0)
  {
     if(the_height > max_height)
     {
        the_height = max_height;
     }
  }
  //Pad it a bit so firefox doesn't show scrollbars
  the_height=the_height + 50;
  document.getElementById('roster_iframe').height=the_height;
}
//-->
</script>


<iframe id="roster_iframe" name="roster_iframe" src="http://www.yoursitehere/roster/index.php" width="100%" onload="calcHeight()"
framespacing="0" frameborder="no" border="0" scrolling="auto"></iframe>
</body>
</html>
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Re: Iframe question

Postby Gator81 » Mon Oct 01, 2007 7:09 am

I tried you suggestion and I kept getting errors....I even changed the index.php file to a index.html and it wouldnt load.

with the first one, it seems to load but it only loads with the a scroll bar that is only 2 inches high and the width is fine.

the second one, will work, but I had to change to hight to be large enough for the largest screen.

Is there something in the first one that can be changed enough for it to work?

I am running phpnuke 8.1
I installed roster in the modules folder
I created a folder in modules called roster and put index.php in the folder
I added it as a mod with nuke

the site is open right now for testing www.ktears.com and you can click on roster

Am I just blind and cannot see what I need to do?
Gator81
WR.net Journeyman
WR.net Journeyman
 
Posts: 115
Joined: Fri Jun 01, 2007 4:44 am

Iframe question

Postby zanix » Mon Oct 01, 2007 8:33 am

I just got it to work
http://svnroster.homeip.net/roster/

Now this is just a plain html file with the iframe code, not inside nuke, df, or anything

This is to test if the iframe code works, and it does
Last edited by zanix on Mon Oct 01, 2007 8:34 am, edited 1 time in total.
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Iframe question

Postby zanix » Mon Oct 01, 2007 8:51 am

Try this

Make sure you edit $go_to_address to point to your roster install
Remember that roster inside the frame has to fully load before the re-size code runs
Code: Select all
<?php

/****************************************************************************/
/* ----> Module file used to load external URL's into an I-Frame            */
/*       Many thanks to forum users everywhere & specifically the           */
/*       wowroster team for inspiring me to figure this out!         <----  */
/****************************************************************************/

if (!defined('MODULE_FILE')) {
   die (
"You can't access this file directly...");
}
require_once(
"mainfile.php");
$module_name basename(dirname(__FILE__));
get_lang($module_name);

/****************************************************************************/
/* ----> change the site URL information that you wish to load here         */

$index=0;
$go_to_address="./modules/wowroster/index.php";

/* end url input <---- */
$go_to_address=rawurldecode($go_to_address);


?>

<script language="JavaScript" type="text/javascript">
<!--
function calcHeight()
{
  //Smallest the frame should ever be
  var min_height=0;
  //Largest the frame should ever be, 0 for no max
  var max_height=0;

  //find the height of the internal page
  var the_height = document.getElementById('dynamic_iframe').contentWindow.document.body.scrollHeight;
  if(the_height< min_height)
  {
     the_height = min_height;
  }
  else if(max_height != 0)
  {
     if(the_height > max_height)
     {
        the_height = max_height;
     }
  }
  //Pad it a bit so firefox doesn't show scrollbars
  the_height=the_height + 50;
  document.getElementById('dynamic_iframe').height=the_height;
}
//-->
</script>

<?php
include("header.php");
define('INDEX_FILE'true);
OpenTable();


/****************************************************************************/
/* ----> iframe code to load above URL                                      */

echo '<iframe id="dynamic_iframe" name="dynamic_iframe" src="'.$go_to_address.'" width="100%" onload="calcHeight()" frameborder="0" scrolling="auto"></iframe>';

/* end iframe load <---- */

CloseTable();
include(
"footer.php");

?>
Last edited by zanix on Mon Oct 01, 2007 8:53 am, edited 1 time in total.
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Re: Iframe question

Postby Gator81 » Mon Oct 01, 2007 9:08 am

I was able to get it loaded, but it seem to load as a full page, everything I tried to do to get it to load in the frame that it was to load in it didnt work, it only loaded as a full page again. And the one that you have setup for an example loads as a full page too.
that is why i was asking if you may of known where the first one didnt want to work, but the second one would, you just had to set up the largest frame since it wouldnt do it auto.

I am sorry for the trouble, but I thank you much for at least responding.
Gator81
WR.net Journeyman
WR.net Journeyman
 
Posts: 115
Joined: Fri Jun 01, 2007 4:44 am

Iframe question

Postby Kelv » Tue Oct 02, 2007 2:03 am

Ok, perhaps I miss under stand the question but here goes, a couple of code snippets...

Code: Select all
<script type="text/javascript">
function resizeme(obj)
{
var browser=navigator.appName
if (browser == "Opera" || browser == "Microsoft Internet Explorer")
{
  docHeight = myIFrame.document.body.scrollHeight
  obj.style.height = docHeight + 30
}
else
{
  obj.height = obj.contentDocument.body.offsetHeight+16

}
}
</script>


Above is a java script that gets the frame size on the major browsers, Opera, IE, Firefox possibly others.

And here is how to use it:

Code: Select all
<iframe id="myIFrame" src="'.$url.'" onload="resizeme(this)" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%;">
If you can see this, your browser doesn\'t understand and use IFRAME\'s. </iframe>


Here is an example module:
Code: Select all

/*---------------------------------------------------------
  Description:
  iframe Module - 
  
  ---------------------------------------------------------*/

require_once('header.php');
echo 
'<script type="text/javascript">
function resizeme(obj)
{
var browser=navigator.appName
if (browser == "Opera" || browser == "Microsoft Internet Explorer")
{
  docHeight = myIFrame.document.body.scrollHeight
  obj.style.height = docHeight + 30
}
else

  obj.height = obj.contentDocument.body.offsetHeight+16

}
}
</script> '
;

switch(
$_GET['page'])
{
  default:
    
$pagetitle .= 'Roster2 beta';
    
$url '/roster2/index.php';
  break;
}

OpenTable();

echo 
'<center><iframe id="myIFrame" src="'.$url.'" onload="resizeme(this)" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%;">
If you can see this, your browser doesn\'t understand and use IFRAME\'s.</iframe><center>'
;  
    
CloseTable();
?>


call it with something like
Code: Select all
http://localhost/index.php?name=iframe

replacing the url with yours and the module name with whatever you call it.
There are probably reasons not to do it this way, but I use the same module with '&page=' for a number of other local sites.

Hope that helps.
Last edited by Kelv on Tue Oct 02, 2007 2:20 am, edited 2 times in total.
Kelv
WR.net Apprentice
WR.net Apprentice
 
Posts: 49
Joined: Fri Dec 08, 2006 8:52 pm

Re: Iframe question

Postby Gator81 » Tue Oct 02, 2007 3:10 am

well I can only think that phpnuke 8.1 has made a change in how it works with dynamic settings. When I use the dynamic settings, it will load in a iframe with a scroll bar and the iframe is 2 inches high. The roster is loaded, and its you can scroll and see the roster is in that 2 in high area.
Now if I use the second one, the one where you set the size, it works with no extra scroll bar as long as it does not grow higher then the setting. If it does then there is a second bar.

I am happy to try any other suggestions to set it dynamically.
Gator81
WR.net Journeyman
WR.net Journeyman
 
Posts: 115
Joined: Fri Jun 01, 2007 4:44 am

Re: Iframe question

Postby Gator81 » Tue Oct 02, 2007 11:22 am

with some personal help from Zanix we were able to get this to work. for anyone else that would like the same inforamtion that is what was used.

Code: Select all
<?php

/****************************************************************************/
/* ----> Module file used to load external URL's into an I-Frame            */
/*       Many thanks to forum users everywhere & specifically the           */
/*       wowroster team for inspiring me to figure this out!         <----  */
/****************************************************************************/

if (!defined('MODULE_FILE')) {
   die (
"You can't access this file directly...");
}
require_once(
"mainfile.php");
$module_name basename(dirname(__FILE__));
get_lang($module_name);

/****************************************************************************/
/* ----> change the site URL information that you wish to load here         */

$index=0;
$go_to_address="./modules/wowroster/index.php";



// this is the id of the iframe
// Change this if for some strange reason, there is another id with the same name
$iframe_id='dynamic_iframe';

/* end url input <---- */


$go_to_address=rawurldecode($go_to_address);


include(
"header.php");
define('INDEX_FILE'true);
OpenTable();


/****************************************************************************/
/* ----> iframe code to load above URL                                      */

echo '
<script language="JavaScript" type="text/javascript">
<!--
function calcHeight()
{
  //Smallest the frame should ever be
  var min_height=0;
  //Largest the frame should ever be, 0 for no max
  var max_height=0;

  //find the height of the internal page
  var the_height = document.getElementById(\'' 
$iframe_id '\').contentWindow.document.body.scrollHeight;
  if(the_height< min_height)
  {
     the_height = min_height;
  }
  else if(max_height != 0)
  {
     if(the_height > max_height)
     {
        the_height = max_height;
     }
  }
  //Pad it a bit so firefox doesn\'t show scrollbars
  the_height=the_height + 50;
  document.getElementById(\'' 
$iframe_id '\').height=the_height;
}
//-->
</script>

<iframe id="' 
$iframe_id '" name="' $iframe_id '" src="' $go_to_address '" width="100%" onload="calcHeight()" frameborder="0" scrolling="auto"></iframe>';

/* end iframe load <---- */

CloseTable();
include(
"footer.php");

?>

thanks alot zanix
Last edited by Gator81 on Tue Oct 02, 2007 1:02 pm, edited 1 time in total.
Gator81
WR.net Journeyman
WR.net Journeyman
 
Posts: 115
Joined: Fri Jun 01, 2007 4:44 am


Return to Archived

Who is online

Users browsing this forum: No registered users and 1 guest

cron