Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Zend

Exemplo de menu com querystring

Recommended Posts

Alguem teria um exemplo de como se usa query string?tipo assim:uma index com menu, e uma include no centro....quando clicar no menu, alterar apenas a pagina do centro!Alguem pode me ajudar???

Compartilhar este post


Link para o post
Compartilhar em outros sites

Po tem varios exemplos de querystring que agora eu naum tenho no pc pq to numa lan house...que é só colocar a querystring onde você deseja aparecer...po é facil... depois eu volto e mando um script pra você vê!!vlw

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tem que usar Javascript. Exemplo:

 

<html><head><title>Teste</title><script>function Trocar(id){	if(id == 1) 	{	  document.getElementById("centro").innerHTML = "Texto um.";	} else {	  document.getElementById("centro").innerHTML = "Texto dois.";	}}</script></head><body><a href="javascript:Trocar(1)">Trcocar para texto 1</a><br /><a href="javascript:Trocar(2)">Trocar para texto 2</a><br /><br /><table border="2" width="60%"><tr>  <td>Primeira parte</td>  <td><div id="centro">Texto inicial</div></td>  <td>Terceira parte</td></tr></table>

Ai no meio vocÊ coloca PHP pra processar. Mas pra trocar so "a parte do meio" é assim.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Aqui vai 2 exemplos:

 

1°exemplo Externo:

 

<!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=iso-8859-1" /><title>1° Exemplo de Query String # Externa # By: Diki</title><style type="text/css"><!--.style5 {color: #FFFFFF}.style6 {	font-family: Arial, Helvetica, sans-serif;	font-size: 14px;	font-weight: bold;	color: #000000;}.style7 {font-family: Arial, Helvetica, sans-serif}a:link {	color: #000000;	text-decoration: none;}a:visited {	text-decoration: none;	color: #000000;}a:hover {	text-decoration: underline;}a:active {	text-decoration: none;}.style8 {	font-family: Arial, Helvetica, sans-serif;	font-size: 14px;	color: #FF0000;	font-weight: bold;}--></style></head><body><table width="100" align="left" cellpadding="0" cellspacing="1" style="border:#FF9900 1px solid;">   <tr>	<td height="14" align="center" class="style5" bgcolor="#FF9900"><span class="style6">Links</span></td>  </tr>  <tr>	<td align="center" class="style7" style="cursor:pointer;background:#FFCC00;; font-size: 12px;" onmouseover="this.style.background='#FF9900';" onmouseout="this.style.background='#FFCC00';"><a href="?action=http://www.imasters.com.br">Imasters</a></td>  </tr>  <tr>	<td align="center" class="style7" style="cursor:pointer;background:#FFCC00;; font-size: 12px;" onmouseover="this.style.background='#FF9900';" onmouseout="this.style.background='#FFCC00';"><a href="?action=http://www.phpbrasil.com">PHP Brasil  </a></td>  </tr>  <tr>	<td align="center" class="style7" style="cursor:pointer;background:#FFCC00;; font-size: 12px;" onmouseover="this.style.background='#FF9900';" onmouseout="this.style.background='#FFCC00';"><a href="?action=http://forum.imasters.com.br">Forum Imasters </a></td>  </tr></table><table width="652" align="center">  <tr>	<td width="644" height="20"><div align="center" class="style8">		<? if(isset($_GET["action"]) && $_GET["action"]!="" && $pag=$_GET["action"]){include($pag);}else{echo "<center>Escolha um item do Link</center>";}?></div></td>  </tr></table></body></html>

2° exemplo Interno:

 

<!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=iso-8859-1" /><title>1° Exemplo de Query String # Interna # By: Diki</title><style type="text/css"><!--.style5 {color: #FFFFFF}.style6 {	font-family: Arial, Helvetica, sans-serif;	font-size: 14px;	font-weight: bold;	color: #000000;}.style7 {font-family: Arial, Helvetica, sans-serif}a:link {	color: #000000;	text-decoration: none;}a:visited {	text-decoration: none;	color: #000000;}a:hover {	text-decoration: underline;}a:active {	text-decoration: none;}.style8 {	font-family: Arial, Helvetica, sans-serif;	font-size: 14px;	color: #FF0000;	font-weight: bold;}--></style></head><body><table width="100" align="left" cellpadding="0" cellspacing="1" style="border:#FF9900 1px solid;">   <tr>	<td height="14" align="center" class="style5" bgcolor="#FF9900"><span class="style6">Links</span></td>  </tr>  <tr>	<td align="center" class="style7" style="cursor:pointer;background:#FFCC00;; font-size: 12px;" onmouseover="this.style.background='#FF9900';" onmouseout="this.style.background='#FFCC00';"><a href="?action=pagina1">Pagina1</a></td>  </tr>  <tr>	<td align="center" class="style7" style="cursor:pointer;background:#FFCC00;; font-size: 12px;" onmouseover="this.style.background='#FF9900';" onmouseout="this.style.background='#FFCC00';"><a href="?action=pagina2">Pagina2</a></td>  </tr>  <tr>	<td align="center" class="style7" style="cursor:pointer;background:#FFCC00;; font-size: 12px;" onmouseover="this.style.background='#FF9900';" onmouseout="this.style.background='#FFCC00';"><a href="?action=pagina3">Pagina3 </a></td>  </tr></table><table width="652" align="center">  <tr>	<td width="644" height="20"><div align="center" class="style8">		<? if(isset($_GET["action"]) && $_GET["action"]!="" && $pag=$_GET["action"]){		if(!file_exists($pag.".php")){echo "Pagina não encontrada";		}else{		include($pag.".php");		}		}else{echo "<center>Escolha um item do Link</center>";}?></div></td>  </tr></table></body></html>

Qual quer coisa posta ai!!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.