Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/04/2003, 22:57
Yared
 
Fecha de Ingreso: mayo-2002
Mensajes: 132
Antigüedad: 21 años, 11 meses
Puntos: 0
Ayuda con el codigo

Este es el codigo de un modulo llamado nukewrap que sirve para meter paginas en tu web ajustandose al tamaño de la página padre.

Ahora lo que busco es que ese codigo sea simple y que directamente se pueda poner la página en el codigo a cargar en el iframe pues no es para el nuke.

Me podrian ayudar porfavor? pues me pierdo en el intento.

Código PHP:
<?php

// ----------------------------------------------------------------------
// Based on:
// ShowInMain for phpWebSite by Jim Flowers ([email protected])
// ----------------------------------------------------------------------
// Filename: index.php
// Original Author of file:    Shawn McKenzie (AbraCadaver)
// Purpose of file: Incorporate external sites or apps
// ----------------------------------------------------------------------

if (!eregi("modules.php"$PHP_SELF)) {
    die (
"You can't access this file directly...");
}

$module_name basename(dirname(__FILE__));
get_lang($module_name);

include(
"header.php");
include(
dirname(__FILE__)."/nukewrap.cfg");

if(
$general['url-security']) {
    foreach(
$authorized_url as $url => $innerarray) {
        
// Check if URL is in array
        
if (($innerarray['alias'] == $page) || ($url == $page) || ($url == "http://".$page)) {
            
$checked true;
            
$page $url;
            
// Override global settings
            
foreach($general as $key => $new) {
                if(isset(
$innerarray[$key])) {
                    
$newval[$key] = $innerarray[$key];
                } else {
                    
$newval[$key] = $new;
                }
            }
            if(
$newval) {
                
$general $newval;
                unset(
$newval);
            }
        }
    }        
    
// Nope - display a message and quit
    
if(!isset($checked)) {
        
$title = (_NOTAUTHHOSTMSG);
        
no_display($title);
    }
}

// Assign settings to vars to be used
$allow_local_only $general['local-pages-only'];
$use_buffering $general['use-buffering'];
$use_compression $general['use-compression'];
$reg_user_only $general['registered-users-only'];
$user_entry $general['address-bar-entry'];
$open_direct $general['open-direct-msg'];
$use_fixed_title $general['use-fixed-title'];
$auto_resize $general['auto-resize'];
$vsize $general['height'];
$hsize $general['width'];

// Store URL parts in array
    
$url_parts parse_url($page);

// Check that a page was specified
    
if(!isset($page) || ($page=="")) {
        
$title _NOPAGEMSG;
        
no_display($title);
    }
    
// Check for not entered in browser location window if set
    
if(!$HTTP_SERVER_VARS["HTTP_REFERER"] && !$user_entry) {
        
$title _NOUSERENTRYMSG;
        
no_display($title);
    }
    
// Check for not local page if set
    
if($allow_local_only &&
        (
$url_parts['host'] != $HTTP_SERVER_VARS["SERVER_NAME"]) && 
        (
$url_parts['host'] != $HTTP_SERVER_VARS["HTTP_HOST"])) {
        
        
$title _NOTLOCALMSG;
        
no_display($title);
    }
    
// Check that user is registered and logged in if set
    
if(!$username && ($reg_user_only)) {
        
$title _NOTSERMSG;
        
no_display($title);
    }
    
// Everything is good - ready to display

// Use compression if set
    
if($use_compression) {
        
ob_start("ob_gzhandler");
    }
    elseif(
$use_buffering) {
        
ob_start();
    }
    
// Check for fixed title and use it 
    // Check if title was passed in URL
    
if(!$title) {
        if(
$use_fixed_title) {
            
$title = (_TITLEMSG);
            
$end_title = (_TITLEMSGEND);
        } else {
            
$title "";
            
$end_title "";
        }
    } else {
        
$end_title "";
    }
    
// Add the Open Direct link if set 
    
if($open_direct) {
        if(
$use_fixed_title) {
            
$title .= "<br />[ <a href=\"$page\" target=\"_blank\">"._OPENDIRECTMSG."</a> ]";
            
$end_title .= "<br />[ <a href=\"$page\" target=\"_blank\">"._OPENDIRECTMSG."</a> ]";
        } else {
            
$title .= "[ <a href=\"$page\" target=\"_blank\">"._OPENDIRECTMSG."</a> ]";
            
$end_title .= "[ <a href=\"$page\" target=\"_blank\">"._OPENDIRECTMSG."</a> ]";
        }
    }
    
    
// Check if height, width or resize were passed in URL
    
if($height) {
        
$vsize $height;
        
$auto_resize false;
    }
    if(
$width) {
        
$hsize $width;
    }
    elseif(!
$hsize) {
        
$hsize "100%";
    }
    if(
$resize == 1) {
        
$auto_resize true;
    }
    
// If auto_resize set vsize = 0 and build javascript content
    
if($auto_resize) {
        
$jscontent "\n\n<!-- Begin NukeWrap Auto Resize -->\n"
            
."<script language=\"javascript\" type=\"text/javascript\" src=\"modules/$module_name/javascript/nukewrap.js\">\n"
            
."</script>\n"
            
."<!-- End NukeWrap Auto Resize -->\n\n";
        
$vsize 0;        
    }

// Build and display title and content    
    
$content "\n\n<!-- Begin NukeWrap Content -->\n"
        
."<div class=\"title\" align=\"center\">".$title."</div>\n"
        
."<iframe id=\"NukeWrap\" src=\"$page\" width=\"$hsize\" height=\"$vsize\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\">\n"
        
."  <br />"._SORRYBROWSER."<a class=\"pn-pagetitle\" href=\"$page\" target=\"_blank\">"._LINKYOU."</a>"._SORRYBROWSER1."<br /><br />\n"
        
."</iframe>\n"
        
."<div class=\"title\" align=\"center\">".$end_title."</div>\n"
        
."<!-- End NukeWrap Content -->\n\n";
            
    echo 
$content;

// Finish up
    
include("footer.php");
    
    echo 
$jscontent;
    
    if(
$use_buffering) {
        
ob_end_flush();
    }
    
// Function called if something is not right and we need to display a message and quit
function no_display($title)
{
    
$content =  "\n<div class=\"title\">".$title."</div>\n";
    echo 
$content;
    include(
"footer.php");
    die();
}

?>
y el java script es este:

// Get all TDs in document
var docTD = document.getElementsByTagName('TD');

// Define the IFRAME
var theIframe = document.getElementById('NukeWrap');

// Find the TD with the greatest height
var i = 0;
var theHeight = 0;

while(i != docTD.length)
{
theTD = docTD[i];

if(theTD.offsetHeight > theHeight)
{
var theHeight = theTD.offsetHeight;
}

i++;

}

// Size the IFRAME
if(theHeight != 0)
{
theIframe.height = theHeight;
}

Muchas Gracias por su ayuda.