Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

60 users online



Alternative to an iframe?

Alternative to an iframe?

Currently viewing this thread: 1 (0 members and 1 guests)


justlivetolive

justlivetolive

What do u want to know? Ummm.....I own a site, blah blah blah blah blah, and here I am now.
Status: Offline!

Alternative to an iframe?

Well, I'm looking for an alternative to an iframe. I've tried an ilayer and an object, but they aren't what I'm looking for either. Is there anything else that acts like an iframe?

___________________

Imortal until I die...

sparky

sparky

I need a haircut
Status: Offline!

You can tagteam PHP's include function (to include different content) with CSS's overflow: auto (to put it inside a neat scrolly box) to more or less emulate iframes.

Your CSS:

Code:

div#scroller{ width: 300px;
height: 400px;
overflow: auto; }

And your PHP:

PHP:

<div id="scroller">

<?php include("somefile.inc"); ?>

</div>

Then, somefile.inc (for INClude) contains the HTML of your content less all the <body> and <head> tags. Includes are a savior, good man for switching to better practices. Post back if you need some more explanation.

___________________

Jon Culver Chia Pets

DigitalDream

DigitalDream

ruby on weapon
Status: Offline!

yep i use that method too. well explained Cool

___________________

digitalDream // complete Webdesign solution //
- - - - - - [ end signature ] - - - - - -

bleedwithme

bleedwithme

i do my crosswords in pen
Status: Offline!
Originally posted by sparky:

You can tagteam PHP's include function (to include different content) with CSS's overflow: auto (to put it inside a neat scrolly box) to more or less emulate iframes.

Your CSS:

Code:

div#scroller{ width: 300px;
height: 400px;
overflow: auto; }

And your PHP:

PHP:

<div id="scroller">

<?php include("somefile.inc"); ?>

</div>

Then, somefile.inc (for INClude) contains the HTML of your content less all the <body> and <head> tags. Includes are a savior, good man for switching to better practices. Post back if you need some more explanation.


Wow, excellent explanation. rep++;

riah

riah

now with more lambda
Status: Offline!

if you wanted to be hip/trendy, you could modify that to use XMLHttpRequest and load content dynamicaly, sort of like an iframe would.

a quick Ajax snippet:

Code:

<script type="text/javascript">

// little fix for IE
if(typeof XMLHttpRequest=='undefined' || !XMLHttpRequest){
function XMLHttpRequest() {// creates a new XMLHttpRequest object
var xmlhttp = null;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@else
 xmlhttp = false;
@end @*/
return xmlhttp;
}
}

//create new XMLHttpRequest
var ajaxLoader =  new XMLHttpRequest();

// loads contents of url into element with the ID
function loadfile(url, elementID) {
 ajaxLoader.open("GET", url,true);
 ajaxLoader.onreadystatechange=function() {
  if (ajaxLoader.readyState==4) {
   document.getElementById(elementID).innerHTML = ajaxLoader.responseText;
  }
 }
 xmlhttp.send(null)
}

</script>

<a href="javascript: loadfile('somefile.inc', 'scroller');">Load include</a>

<div id="scroller">

</div>

That should load the file 'somefile.inc' into the 'scroller' element when the link is clicked.

___________________

http://codetch.com/skin/sig.png

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0082 seconds.