Foros del Web » Programando para Internet » PHP »

direccionar archivos php

Estas en el tema de direccionar archivos php en el foro de PHP en Foros del Web. Tengo la suguiente estructura de directorios: /////Notacion: //dir=directorio o carpeta //arch=archivo ///// *dir over arch portada.php (archivo principal del sitio) **dir privado(Se encuentran estos directorios) ...
  #1 (permalink)  
Antiguo 13/07/2004, 11:23
Avatar de capuleto  
Fecha de Ingreso: octubre-2003
Ubicación: Cartagena
Mensajes: 219
Antigüedad: 20 años, 6 meses
Puntos: 0
direccionar archivos php

Tengo la suguiente estructura de directorios:

/////Notacion:
//dir=directorio o carpeta
//arch=archivo
/////

*dir over
arch portada.php (archivo principal del sitio)
**dir privado(Se encuentran estos directorios)
***dir css (contiene archivos de las .css)
***dir images (contiene archivos de imagenes)
***dir includes (contiene archivos .php)
**** arch header.php
**** arch contenido.php
**** arch footer.php
**** arch menu.php
***dir librerias (contiene archivos .inc)
**** arch lib_general.inc (aqui declaro variable globales)

El problema que pasa es que tengo un archivo portada.php,
que es quien llama al footer.php y al header.php asi como
las hojas de estilo, etc. pero no me muestra solo me muestra
el contenido y ese archivo se llama contenido.php

Mi pregunta es: Porque no me muestra todo, si estoy direccionando
bien??...ayudenme, me estoy volviendo loco...
estos son los php

portada.php
Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> ..::Viajes OVER Rabbit::.. </TITLE>
<META NAME="Author" CONTENT="Edward J. Guzman">
<LINK href="./privado/css/recuadros.css" type=text/css rel=stylesheet>
<LINK href="./privado/css/body.css" type=text/css rel=stylesheet>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<br>
<TABLE class=recuadro height=20 cellSpacing=0 cellPadding=0 width=762 align=center border=0>
  <TR>
    <TD>
       <?php include "./privado/includes/header.php";?>
       <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
      <TBODY>
        <TR>
          <TD align=middle>
    <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
            <TBODY>
              <TR>
         <?php include "./privado/includes/menu.php";?>
         <?php include "./privado/includes/contenido.php";?>
      </TR>
    </TBODY>
    </TABLE>
           </TD>
          </TR>
        </TBODY>
  </TABLE>
    </TD>
  </TR>
</TABLE>
<?php include "./privado/includes/footer.php";?>
</BODY>
</HTML>
header.php
Código PHP:
<?php
        
include_once "./privado/librerias/lib_general.inc";
        global 
$ruta_imagen;
      
?>
      <TABLE WIDTH=762 BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center">
        <TR> 
          <TD height="90" width="762" valign="top">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <TD width="162" height="18" valign="top"> <IMG SRC="$ruta_imagen/cabezeraover_01.gif" WIDTH=162 HEIGHT=18 ALT=""></TD>
                <TD width="156" valign="top"> <IMG SRC="$ruta_imagen/cabezeraover_02.gif" WIDTH=156 HEIGHT=18 ALT=""></TD>
                <TD width="97" valign="top"> <A HREF="quienessomos.htm"> <IMG SRC="$ruta_imagen/quienes_somos.gif" WIDTH=97 HEIGHT=18 BORDER=0 ALT="Quienes Somos"></A></TD>
                <TD width="77" valign="top"> <A HREF="servicios.htm"> <IMG SRC="$ruta_imagen/servicios.gif" WIDTH=77 HEIGHT=18 BORDER=0 ALT="Servicios"></A></TD>
                <TD width="75" valign="top"> <A HREF="productos.htm"> <IMG SRC="$ruta_imagen/productos.gif" WIDTH=75 HEIGHT=18 BORDER=0 ALT="Productos"></A></TD>
                <TD width="78" valign="top"> <A HREF="contacto.htm"> <IMG SRC="$ruta_imagen/contactenos.gif" WIDTH=78 HEIGHT=18 BORDER=0 ALT="Cont&aacute;ctenos"></A></TD>
                <TD width="117" valign="top"> <A HREF="index.htm"> <IMG SRC="$ruta_imagen/home.gif" WIDTH=117 HEIGHT=18 BORDER=0 ALT="Ir al Inicio"></A></TD>
              </tr>
              <tr>  
                <TD valign="top" height="72"> <IMG SRC="$ruta_imagen/logo_rabbit.gif" WIDTH=162 HEIGHT=72 ALT="Viajes Rabbit Ltda"></TD>
                <TD valign="top"> <IMG SRC="$ruta_imagen/logo_over.gif" WIDTH=156 HEIGHT=72 ALT="OVER Rabbit"></TD>
                <TD valign="top"> <IMG SRC="$ruta_imagen/cabezeraover_10.gif" WIDTH=97 HEIGHT=72 ALT=""></TD>
                <TD COLSPAN=3 valign="top"> <IMG SRC="$ruta_imagen/texto_rabbit.gif" WIDTH=230 HEIGHT=72 ALT=""></TD>
                <TD valign="top"> <IMG SRC="$ruta_imagen/cabezeraover_12.gif" WIDTH=117 HEIGHT=72 ALT=""></TD>
              </tr>
            </table>
          </TD>
        </TR>
      </TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TR>
          <TD>&nbsp;</TD>
        </TR>
      </TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" background=$ruta_imagen/linea_punteada.gif border=0>
      <TBODY>
            <TR>
              <TD><IMG height=1 src="" width=2></TD>
        </TR>
      </TBODY>
      </TABLE>
lib_general.inc
Código PHP:
<?php
////////////////////////////////////////////
//Variables Globales
///////////////////////////////////////////
$ruta_archivo="/privado";
$ruta_imagen="/privado/images";
?>
No funciona ni $ruta_imagen y no se porque, la incluyo en header.php??
menu.php
Código PHP:
<?php 
                
include "./privado/librerias/lib_general.inc";
                global 
$ruta_imagen;      
                
                <
TD class=contenido vAlign=top width="20%" height=400 bgColor=#f3f3f3>
                
<STYLE type=text/css>
                
A:link FONT-SIZE9pxCOLOR#000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none 
                
}
                .
titulo FONT-SIZE11pxCOLOR#af2f36; FONT-FAMILY: Verdana 
                
}
                .
verdanablack9 FONT-SIZE9pxCOLOR#000000; FONT-FAMILY: Verdana 
                
}
                </
STYLE>
                <
STYLE type=text/css>
                
A:hover FONT-SIZE9pxCOLOR#0793c7; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif 
                
}
                
FONT-SIZE9pxCOLOR#000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none 
                
}
                </
STYLE>
                  <
TABLE cellSpacing=0 cellPadding=7 width="100%" border=0>
                  <
TBODY>
                    <
TR>
                      <
TD class=contenido vAlign=top><SPAN class=rojo><STRONG>&nbsp;&nbsp;&nbsp;</STRONG></SPAN>
                      <
SPAN class=titulo><STRONG>Planes y Ofertas</STRONG></SPAN>
                        <
TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                        <
TBODY>
                          <
TR>
                            <
TD height=4></TD>
                          </
TR>
                        </
TBODY>
                        </
TABLE>
                        <
TABLE cellSpacing=0 cellPadding=0 width=130 border=0>
                        <
TBODY>
                          <
TR>
                            <
TD colSpan=2><IMG height=6 src="$ruta_imagen/spacer.gif" width=1></TD>
                          </
TR>
                          <
TR>
                            <
TD width=15><IMG height=9 src="$ruta_imagen/flecha.gif" width=9></TD>
                            <
TD><A href="construccion.htm">A San Andr&eacute;s</A></TD>
                          </
TR>
                          <
TR>
                            <
TD vAlign=top><IMG height=9 src="$ruta_imagen/flecha.gif" width=9 vspace=1></TD>
                            <
TD><A href="construccion.htm">A Santa Marta</A></TD>
                          </
TR>
                        </
TBODY>
                        </
TABLE>
                      </
TD>
                    </
TR>
                    <
TR>
                      <
TD class=contenido vAlign=top><SPAN class=rojo><STRONG>&nbsp;&nbsp;&nbsp;</STRONG></SPAN>
                      <
SPAN class=titulo><STRONG>Paquetes</STRONG></SPAN>
                        <
TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                        <
TBODY>
                          <
TR>
                            <
TD height=4></TD>
                          </
TR>
                        </
TBODY>
                        </
TABLE>
                        <
TABLE cellSpacing=0 cellPadding=0 width=130 border=0>
                        <
TBODY>
                          <
TR>
                            <
TD colSpan=2><IMG height=6 src="$ruta_imagen/spacer.gif" width=1></TD>
                          </
TR>
                          <
TR>
                            <
TD width=15><IMG height=9 src="$ruta_imagen/flecha.gif" width=9></TD>
                            <
TD><A href="construccion.htm">A San Andr&eacute;s</A></TD>
                          </
TR>
                          <
TR>
                            <
TD vAlign=top><IMG height=9 src="$ruta_imagen/flecha.gif" width=9 vspace=1></TD>
                            <
TD><A href="construccion.htm">A Cartagena la <BR>Heroica</A></TD>
                          </
TR>
                        </
TBODY>
                        </
TABLE>
                      </
TD>
                    </
TR>
                  </
TBODY>
                  </
TABLE>
                </
TD>
              
?>
espero que alguien me ayude..chao
__________________
...Definitivamente Soy Nadie entre los Sabios....*-*Capuleto*-*
  #2 (permalink)  
Antiguo 13/07/2004, 12:54
Avatar de capuleto  
Fecha de Ingreso: octubre-2003
Ubicación: Cartagena
Mensajes: 219
Antigüedad: 20 años, 6 meses
Puntos: 0
ayuda

Me gustaria que alguien me ayudara, como puedo arreglar eso...??
La idea es tener un archivo header.php que me sirva para todas las paginas y que lo pueda configurar para ubicar las imagenes, es decir variable $ruta_imagen, en algun archivo de configuracion, la cual quedaria asi
Código PHP:
$ruta_imagen=$ruta_imagen="/privado/images"
y en el header.php sria asi
Código PHP:
src="$ruta_imagen/milogo.gif" 
espero orientacion...
__________________
...Definitivamente Soy Nadie entre los Sabios....*-*Capuleto*-*
  #3 (permalink)  
Antiguo 13/07/2004, 13:07
Avatar de lado2mx
Colaborador
 
Fecha de Ingreso: agosto-2001
Ubicación: Veracruz
Mensajes: 3.720
Antigüedad: 22 años, 8 meses
Puntos: 9
checa muy bien:

Código PHP:
<?php 
include "./privado/librerias/lib_general.inc"
global 
$ruta_imagen?>
 
<TD class=contenido vAlign=top width="20%" height=400 bgColor=#f3f3f3> 
<STYLE type=text/css> 
A:link { FONT-SIZE: 9px; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none 

.titulo { FONT-SIZE: 11px; COLOR: #af2f36; FONT-FAMILY: Verdana 

.verdanablack9 { FONT-SIZE: 9px; COLOR: #000000; FONT-FAMILY: Verdana 

</STYLE> 
<STYLE type=text/css> 
A:hover { FONT-SIZE: 9px; COLOR: #0793c7; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif 

A { FONT-SIZE: 9px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none 

</STYLE> 
<TABLE cellSpacing=0 cellPadding=7 width="100%" border=0> 
<TBODY> 
<TR> 
<TD class=contenido vAlign=top><SPAN class=rojo><STRONG>&nbsp;&nbsp;&nbsp;</STRONG></SPAN> 
<SPAN class=titulo><STRONG>Planes y Ofertas</STRONG></SPAN> 
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> 
<TBODY> 
<TR> 
<TD height=4></TD> 
</TR> 
</TBODY> 
</TABLE> 
<TABLE cellSpacing=0 cellPadding=0 width=130 border=0> 
<TBODY> 
<TR> 
<TD colSpan=2><IMG height=6 src="<? echo $ruta_imagen?>/spacer.gif" width=1></TD> 
</TR> 
<TR> 
<TD width=15><IMG height=9 src="<? echo $ruta_imagen?>/flecha.gif" width=9></TD> 
<TD><A href="construccion.htm">A San Andr&eacute;s</A></TD> 
</TR> 
<TR> 
<TD vAlign=top><IMG height=9 src="<? echo $ruta_imagen?>/flecha.gif" width=9 vspace=1></TD> 
<TD><A href="construccion.htm">A Santa Marta</A></TD> 
</TR> 
</TBODY> 
</TABLE> 
</TD> 
</TR> 
<TR> 
<TD class=contenido vAlign=top><SPAN class=rojo><STRONG>&nbsp;&nbsp;&nbsp;</STRONG></SPAN> 
<SPAN class=titulo><STRONG>Paquetes</STRONG></SPAN> 
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> 
<TBODY> 
<TR> 
<TD height=4></TD> 
</TR> 
</TBODY> 
</TABLE> 
<TABLE cellSpacing=0 cellPadding=0 width=130 border=0> 
<TBODY> 
<TR> 
<TD colSpan=2><IMG height=6 src="<? echo $ruta_imagen?>/spacer.gif" width=1></TD> 
</TR> 
<TR> 
<TD width=15><IMG height=9 src="<? echo $ruta_imagen?>/flecha.gif" width=9></TD> 
<TD><A href="construccion.htm">A San Andr&eacute;s</A></TD> 
</TR> 
<TR> 
<TD vAlign=top><IMG height=9 src="<? echo $ruta_imagen?>/flecha.gif" width=9 vspace=1></TD> 
<TD><A href="construccion.htm">A Cartagena la <BR>Heroica</A></TD> 
</TR> 
</TBODY> 
</TABLE> 
</TD> 
</TR> 
</TBODY> 
</TABLE> 
</TD>
y creo que lo que planteas anteriormente es:

$ruta_imagen=$ruta_imagen."/privado/images";

es eso creo

Última edición por lado2mx; 13/07/2004 a las 13:10
  #4 (permalink)  
Antiguo 13/07/2004, 13:42
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Para tener un archivo en cualquier sitio de tu servidor y llamarlo sin problemas de "acordarse" si está una rama arriba según la estructura de donde es llamado .. puedes usar la variable de servidor: 'DOCUMENT_ROOT' que te devolverá la ruta absoluta de tu sito (si usas servidores virtuales o no) desde el raiz del servidor (del sistema de archivo de ese servidor).

así que podrías definir rutas absolutas tipo:

$ruta=$_SERVER['DOCUMENT_ROOT']."/privado/images";

quedando algo tipo (linux):
/var/www/sitio.com/public_html/privado/imagenes

ó

(windows)
c:\nose\babla\privado\imagenes

Eso sería para las rutas absolutas a archivos ..

Un saludo,
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 16:15.