Foros del Web » Programando para Internet » PHP »

Ayuda con el codigo

Estas en el tema de Ayuda con el codigo en el foro de PHP en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 21/04/2003, 22:57
 
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.
  #2 (permalink)  
Antiguo 22/04/2003, 11:24
 
Fecha de Ingreso: mayo-2002
Mensajes: 132
Antigüedad: 21 años, 11 meses
Puntos: 0
.
  #3 (permalink)  
Antiguo 22/04/2003, 12:26
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Yared ...

Esa práctica de responder tu mensaje con un simple caracter para que suba tu pregunta a las primeras posiciones del listado de hoy es MUYYYY feo ...

Insiste aportando nuevos datos o intentando explicar tu problema de otra forma si ves que no obtienes respuesta ... Ademas, NO pasó ni 30 minutos desde que lo publicastes. Así que paciencia o pregunta en las web's oficiales de php-nuke.

Un saludo,
__________________
Por motivos personales ya no puedo estar con Uds. Fue grato haber compartido todos estos años. Igualmente los seguiré leyendo.
  #4 (permalink)  
Antiguo 22/04/2003, 12:44
 
Fecha de Ingreso: mayo-2002
Mensajes: 132
Antigüedad: 21 años, 11 meses
Puntos: 0
Disculpa.
Y si paso mas de 30 minutos paso 12 horas 27 minutos. :)
Y como menciono no es para phpnuke aunque es un script de esos.
Lo que quiero hacer es hacer que tome los valores el iframe de la página que se va a cargar.

Pero al quitar lo mucho que no sirve de este codigo me falla. Por eso pido su ayuda. Gracias.
  #5 (permalink)  
Antiguo 22/04/2003, 12:53
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Ops .. no vi el am/pm ..

Pero, lo que dices es que ese código PROPIO de PHP-Nuke ahora no lo quieres usar para el "Nuke" ...

¿Te has fijado que usa un monton de configuración o chekeos que son propios de que ese código ha de funcionar como módulo de esa aplicación PHP-Nuke?

¿Que problemas tienes al ejecutar ese código por separado? .. (yo a simple vista veo que para empezar tendras que quitar:

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

Por el resto .. buff .. tendras que mirar todas esas variables de configuración ...

QUe tal si te buscas ese "modulo" como una aplicación independinete por otro sitio .. por ejemplo en: www.hotscripts.com ? o te lo intentas programar tu mismo?.

Un saludo,
__________________
Por motivos personales ya no puedo estar con Uds. Fue grato haber compartido todos estos años. Igualmente los seguiré leyendo.
  #6 (permalink)  
Antiguo 22/04/2003, 12:56
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Otro detalle .. has probado en preguntar el en foro HTML o javascript como se pasan valores a una página que llamas a un iframe? ...

Un saludo,
__________________
Por motivos personales ya no puedo estar con Uds. Fue grato haber compartido todos estos años. Igualmente los seguiré leyendo.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:24.