Foros del Web » Programando para Internet » Javascript »

Include php + menu Desplegable

Estas en el tema de Include php + menu Desplegable en el foro de Javascript en Foros del Web. Hola, soy nuevo en el foro! tengo dos consultas: 1 - Estoy por armar un sitio web donde el menu es incluido con "include". El ...
  #1 (permalink)  
Antiguo 23/04/2008, 10:20
 
Fecha de Ingreso: abril-2008
Mensajes: 11
Antigüedad: 16 años
Puntos: 0
Include php + menu Desplegable

Hola, soy nuevo en el foro!

tengo dos consultas:
1 - Estoy por armar un sitio web donde el menu es incluido con "include". El problema es que el menu es desplegable, entonces cuando despliego un submenu e ingreso en otra seccion, vuelve a cargar el menu pero sin dejarlo desplegado. como puedo hacer para que me quede desplegada la seccion?

2 - Como puedo hacer para ver el index.php y testear la web offline?

No soy programador, soy diseñador asi que pido disculpa por mi ignorancia.



-------------------------------------------------------------------

aqui les dejo el codigo del index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="791" border="0">
<tr>
<td width="351" height="537" align="left" valign="top"><?php
include("menu.htm");
?></td>
<td width="430" bgcolor="#CCCCCC">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>

-----------------------------------------------------------------------------------

Aqui el codigo del menu que seria incluido en todas las paginas:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
<style type="text/css">
body {
background-color: #FFFFFF;
margin-left: 2px;
margin-top: 2px;
margin-right: 2px;
margin-bottom: 2px;
}
.textos {
font-family: tahoma;
font-size: 12px;
}
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
color: #000000;
text-decoration: none;
}
a:hover {
color: #842029;
text-decoration: none;
}
a:active {
color: #842029;
text-decoration: none;
}td img {display: block;}
</style>
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>
<style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 3px;
width:182px;
text-align:left;/* */
font-family: Arial, Helvetica, sans-serif;
font-size: 1<;
background-color: #E6D6BB;
background-position: left;
font-size: 12px;
border: 0px solid #000000;
height: 14px;
text-decoration: none;
padding-top: 1px;
padding-right: 1px;
padding-bottom: 1px;
padding-left: 4px;
}

.submenu{
margin-bottom: 0.5em;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #CC0000;
text-decoration: none;
}
.style1 {color: #842029}
.style2 {color: #E6D6BB}
.menutitulo {
cursor:pointer;
margin-bottom: 3px;
width:165px;
text-align:left;/* */
font-family: tahoma;
font-size: 1<;
background-color: #CABCA5;
background-position: left;
font-size: 11px;
border: 0px solid #000000;
height: 25px;
text-decoration: none;
color: #7F1E27;
padding: 0px;
}
</style>

<script type="text/javascript">

/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsBy TagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display ="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display= ="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

</script>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top"><table width="2" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="63" colspan="3" align="center" valign="top">&nbsp;</td>
</tr>
<tr>
<td width="6">&nbsp;</td>
<td width="198" align="left" valign="top"><!-- Keep all menus within masterdiv-->
<div id="masterdiv"> <br>
<br>
<div class="menutitle"><br>
</div>
<div class="menutitle" onClick="SwitchMenu('sub1')"><a href="publi_01.html" target="visor">seccion 1 </a><br>
</div>
<div class="menutitle" onClick="SwitchMenu('sub1')"><a href="publi_02.html" target="visor">seccion 2 </a><br>
</div>
<div class="menutitle" onClick="SwitchMenu('sub1')"><a href="publi_03.html" target="visor">seccion 3</a></div>
<div class="menutitle" onClick="SwitchMenu('sub1')"><a href="publi_04.html" target="visor">seccion 4</a></div>
<div class="menutitle" onClick="SwitchMenu('sub2')"><a href="publi_05.html" target="visor">seccion 5</a></div>
<div class="menutitle" onClick="SwitchMenu('sub3')">seccion 6</div>
<span class="submenu" id="sub3">&middot; <a href="seccion6-1.php" target="visor">Nro. 1 </a><br>
&middot; Nro. 2 <br>
&middot; Nro. 3 <br>
&middot; Nro. 4 <br>
&middot; Nro. 5 <br>
&middot; Nro. 6 <br>
<br>
</span>
<div class="menutitle" onClick="SwitchMenu('sub6')">seccion 7</div>
<span class="submenu" id="sub6">
&middot; <a href="prisma_01.html" target="visor">Nro. 1 </a><br>
&middot; Nro. 2<br>
&middot; <a href="prisma_03.html" target="visor"> Nro. 3<br>
&middot; <a href="prisma_04.html" target="visor"> Nro. 4<br>
&middot; <a href="prisma_05.html" target="visor"> Nro. 5<br>
&middot; <a href="prisma_06.html" target="visor"> Nro. 6
<br>
<br>
</span>
<div class="menutitle"></div>
</div>&nbsp;</td>
<td width="664" align="right" valign="top">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
  #2 (permalink)  
Antiguo 23/04/2008, 10:36
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Re: Include php + menu Desplegable

es broma???

enserio piensas incluir un HTML completo ((con <html> y <body> y toda la cosa)) dentro de un simple TD???

eso es una aberracion del estandar.... :(

PDTA: descarga e instala EasyPHP 1.8 ((para testear PHP localmente))
  #3 (permalink)  
Antiguo 23/04/2008, 12:02
 
Fecha de Ingreso: abril-2008
Mensajes: 11
Antigüedad: 16 años
Puntos: 0
Re: Include php + menu Desplegable

Disculpa pateketrueke pero no soy programador, solo diseñador y trato de resolver algunas cosas que voy necesitando como esta, seguramente no va a ser asi y voy a separar las cosas. Lo que mas necesito ahora es lo que pregunte arriba.
Como hacer para mantener desplegado un submenu cuando cargo otra seccion.
  #4 (permalink)  
Antiguo 23/04/2008, 12:06
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Re: Include php + menu Desplegable

debes notar ke el menu se controla con Javascript, si necesitas ke se kede guardado

implementa pasar el evento despues de SwitchMenu() por Ajax a algun PHP, ke almacene el estado...

luego, intenta intervenir el Javascript, agregando una linea de ejecucion alfinal del mismo.... con el dato ke ya guardaste en PHP ¿vale?
  #5 (permalink)  
Antiguo 23/04/2008, 14:10
 
Fecha de Ingreso: abril-2008
Mensajes: 11
Antigüedad: 16 años
Puntos: 0
Re: Include php + menu Desplegable

creo entender lo que decis pero no se como aplicarlo.



por ejemplo todas las paginas de mi sitios serian de este formato con el include del menu:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="791" border="0">
<tr>
<td width="351" height="537" align="left" valign="top"><?php
include("menu.htm");
?></td>
<td width="430" bgcolor="#CCCCCC">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>




No hay alguna posibilidad de que cuando pongo el include en cada pagina tambien agrege una sentencia que indique que en esta pagina el boton x este desplegado?
  #6 (permalink)  
Antiguo 23/04/2008, 14:31
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: Include php + menu Desplegable

Tema trasladado a JavaScript.
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:44.