Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Colegas,
andei pesquisando e vendo que o uso de frame está em desuso. Ocorre que estou criando uma intranet e o cliente quer a funcionalidade que, ao meu ver só o frame ofereçe.Criar o frame e suas chamadas não é o problema. Mas todas as páginas em php apareçe somente o código e não o visual em sí? Como trabalhar com isso?
Assim
Este é meu frame:
<frameset rows="80,*" frameborder="yes" border="0" framespacing="0">
<frame src="top.php" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frame src="corpo.php" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>
Na página topframe existe um link:
<a href="../Antena/cad_antena.php" target="mainFrame">teste</a>
Quando eu clico no link ao invés de abrir a página em si, abre o código fonte da página.
troca todos os < por < e todos os > por >
;D faz isso com uma função php...
Mas você está testando onde?
Se for no Windows, ele ou vai te exibir código, ou o arquivo pra Download, o mais comum é o arquivo pra Download.
Se for no servidor, acho que está tendo algum erro com o seu arquivo.
Tem como mostrar pra gente o código da página mesmo, da página "corpo.php" e da página "top.php"?
bem.... estou fazendo uns testes. e o código php que estou chamando é "grande", gerado no DW, mesmo assim to mandando ele completo, ok?
frametotal.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">'>[http://www.w3.org/1999/xhtml"](http://www.w3.org/1999/xhtml)>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<frameset rows="80,*" frameborder="yes" border="0" framespacing="0">
<frame src="top.php" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frame src="corpo.php" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>
corpo.html
<!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">'>[http://www.w3.org/1999/xhtml"](http://www.w3.org/1999/xhtml)>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html><!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">'>[http://www.w3.org/1999/xhtml"](http://www.w3.org/1999/xhtml)>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<a href="../Antena/cad_antena.php" target="mainFrame">teste</a>
</body>
</html>
cad_antena.php
<?php require_once('../Connections/conn.php'); ?>
<?php
//MX Widgets3 include
require_once('../includes/wdg/WDG.php');
?>
<?php require_once('../Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="fun_exist.php";
$loginUsername = $_POST['ipmac'];
$LoginRS__query = sprintf("SELECT ipmac FROM ipmac WHERE ipmac=%s", GetSQLValueString($loginUsername, "text"));
mysql_select_db($database_conn, $conn);
$LoginRS=mysql_query($LoginRS__query, $conn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO ipmac (idcliente, cpf, transmissora, ipmac, mac, link, antena, compartilhado) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['idcliente'], "int"),
GetSQLValueString($_POST['cpf'], "text"),
GetSQLValueString($_POST['transmissora'], "text"),
GetSQLValueString($_POST['ipmac'], "text"),
GetSQLValueString($_POST['mac'], "text"),
GetSQLValueString($_POST['link'], "text"),
GetSQLValueString($_POST['antena'], "text"),
GetSQLValueString($_POST['compartilhado'], "text"));
mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($insertSQL, $conn) or die(mysql_error());
$insertGoTo = "cad_antena.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_conn, $conn);
$query_buscanome = "SELECT id, nome,cpf FROM cliente ORDER BY nome ASC";
$buscanome = mysql_query($query_buscanome, $conn) or die(mysql_error());
$row_buscanome = mysql_fetch_assoc($buscanome);
$totalRows_buscanome = mysql_num_rows($buscanome);
$colname_Recordset1 = "-1";
if (isset($_GET['idcliente'])) {
$colname_Recordset1 = $_GET['idcliente'];
}
mysql_select_db($database_conn, $conn);
$query_Recordset1 = sprintf("SELECT id_ipmac, idcliente FROM ipmac WHERE idcliente = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_conn, $conn);
$query_RSid_cpf = " SELECT c.* , i. * AS ipmac FROM cliente AS c INNER JOIN ipmac AS i ON i.cpf = c.cpf ";
$RSid_cpf = mysql_query($query_RSid_cpf, $conn) or die(mysql_error());
$row_RSid_cpf = mysql_fetch_assoc($RSid_cpf);
$totalRows_RSid_cpf = mysql_num_rows($RSid_cpf);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)
<html xmlns="[http://www.w3.org/1999/xhtml"](http://www.w3.org/1999/xhtml) xmlns:wdg="[http://ns.adobe.com/addt">](http://ns.adobe.com/addt)
<script type="text/javascript" language="javascript">function txtBoxFormat(objeto, sMask, evtKeyPress) {
var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
if(document.all) { // Internet Explorer
nTecla = evtKeyPress.keyCode;
} else if(document.layers) { // Nestcape
nTecla = evtKeyPress.which;
} else {
nTecla = evtKeyPress.which;
if (nTecla == 8) {
return true;
}
}
sValue = objeto.value;
// Limpa todos os caracteres de formatação que
// já estiverem no campo.
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( ":", "" );
sValue = sValue.toString().replace( ":", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( " ", "" );
sValue = sValue.toString().replace( " ", "" );
fldLen = sValue.length;
mskLen = sMask.length;
i = 0;
nCount = 0;
sCod = "";
mskLen = fldLen;
while (i <= mskLen) {
bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))
bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
if (bolMask) {
sCod += sMask.charAt(i);
mskLen++; }
else {
sCod += sValue.charAt(nCount);
nCount++;
}
i++;
}
objeto.value = sCod;
if (nTecla != 8) { // backspace
if (sMask.charAt(i-1) == "9") { // apenas números...
return ((nTecla > 47) && (nTecla < 58)); }
else { // qualquer caracter...
return true;
}
}
else {
return true;
}
}
function MM_effectAppearFade(targetElement, duration, from, to, toggle) Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}
</script>
<script type="text/javascript">
function formatar_mascara(src, mascara) {
var campo = src.value.length;
var saida = mascara.substring(0,1);
var texto = mascara.substring(campo);
if(texto.substring(0,1) != saida) {
src.value += texto.substring(0,1);
}
}
</script>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Dados técnicos de antenas - Cadastro</title>
<style type="text/css"> background-image: url(../imagens/bg.png);
}</style>
<link href="../css/padrao.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../includes/common/js/sigslot_core.js"></script>
<script src="../includes/common/js/base.js" type="text/javascript"></script>
<script src="../includes/common/js/utility.js" type="text/javascript"></script>
<script type="text/javascript" src="../includes/wdg/classes/MXWidgets.js"></script>
<script type="text/javascript" src="../includes/wdg/classes/MXWidgets.js.php"></script>
<script type="text/javascript" src="../includes/wdg/classes/JSRecordset.js"></script>
<script type="text/javascript" src="../includes/wdg/classes/DependentDropdown.js"></script>
<?php$jsObject_buscanome = new WDG_JsRecordset("buscanome");
echo $jsObject_buscanome->getOutput();?>
<link href="../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="../includes/wdg/classes/N1DependentField.js"></script>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p align="center">
<input type="hidden" name="MM_insert2" value="form1" />
<a href="lst_cadastros.php" target="_blank">Listar cadastros </a></p>
<form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Idcliente:</td>
<td><select name="linkcpf" size="1" id="linkcpf">
<?php?>
<option value="<?php echo $row_buscanome['id']?>"><?php echo $row_buscanome['nome']?></option>
<?php
} while ($row_buscanome = mysql_fetch_assoc($buscanome));
$rows = mysql_num_rows($buscanome);
if($rows > 0) {
mysql_data_seek($buscanome, 0);
$row_buscanome = mysql_fetch_assoc($buscanome);
}
?>
</select>
<input name="idcliente" type="text" id="idcliente" value="<?php echo $row_buscanome['id']; ?>" size="5" wdg:subtype="N1DependentField" wdg:type="widget" wdg:recordset="buscanome" wdg:valuefield="id" wdg:pkey="id" wdg:triggerobject="linkcpf" readonly="readonly" /></td>
</tr>
<tr> </tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Cpf:</td>
<td><input name="cpf" type="text" id="cpf" value="<?php echo $row_buscanome['cpf']; ?>" wdg:subtype="N1DependentField" wdg:type="widget" wdg:recordset="buscanome" wdg:valuefield="cpf" wdg:pkey="id" wdg:triggerobject="linkcpf" readonly="readonly" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Transmissora:</td>
<td><select name="transmissora">
<option value="america" <?php if (!(strcmp("america", ""))) {echo "SELECTED";} ?>>América</option>
<option value="Guarani" <?php if (!(strcmp("Guarani", ""))) {echo "SELECTED";} ?>>Guarani</option>
<option value="central" <?php if (!(strcmp("central", ""))) {echo "SELECTED";} ?>>Central</option>
<option value="palmeiras" <?php if (!(strcmp("Palmeiras", ""))) {echo "SELECTED";} ?>>Palmeiras</option>
<option value="mursa" <?php if (!(strcmp("mursa", ""))) {echo "SELECTED";} ?>>Mursa</option>
<option value="bertioga" <?php if (!(strcmp("bertioga", ""))) {echo "SELECTED";} ?>>Bertioga</option>
<option value="felicidade" <?php if (!(strcmp("felicidade", ""))) {echo "SELECTED";} ?>>Felicidade</option>
</select> </td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Ipmac:</td>
<td><span id="sprytextfield1">
<input type="text" name="ipmac" value="" size="32" />
<span class="textfieldRequiredMsg">Campo obrigatório.</span></span></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Mac:</td>
<td><span id="sprytextfield2">
<input type="text" name="mac" value="" size="32" onkeypress="formatar_mascara(this, 'xx-xx-xx-xx-xx-xx')"/>
<span class="textfieldRequiredMsg">Campo obrigatório.</span></span></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Link:</td>
<td><span id="sprytextfield3">
<input type="text" name="link" value="" size="32" />
<span class="textfieldRequiredMsg">Campo obrigatório.</span></span></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Antena:</td>
<td><select name="antena">
<option value="2.4" <?php if (!(strcmp(2.4, ""))) {echo "SELECTED";} ?>>2.4</option>
<option value="5.8" <?php if (!(strcmp(5.8, ""))) {echo "SELECTED";} ?>>5.8</option>
</select> </td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Compartilhado:</td>
<td><select name="compartilhado" size="0">
<option value="sim" <?php if (!(strcmp("sim", ""))) {echo "SELECTED";} ?>>Sim</option>
<option value="nao" <?php if (!(strcmp("nao", ""))) {echo "SELECTED";} ?>>Não</option>
</select> </td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Inserir Registro" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2" />
</form>
<p><iframe src="lst_cadastros.php" height="600px" width="100%"></iframe> </p>
<p> </p>
<p> </p>
<script type="text/javascript">var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");</script>
</body>
</html>
<?php
mysql_free_result($buscanome);
mysql_free_result($Recordset1);
mysql_free_result($RSid_cpf);
?>
>
Mas você está testando onde?
Se for no Windows, ele ou vai te exibir código, ou o arquivo pra Download, o mais comum é o arquivo pra Download.
Se for no servidor, acho que está tendo algum erro com o seu arquivo.
Tem como mostrar pra gente o código da página mesmo, da página "corpo.php" e da página "top.php"?
Que fora......
Realmente eu não havia testado no server. e depois do seu toque publiquei e funcionou perfeitamente. Pode me explicar a razão disso? Se eu tiver que trabalhar com frame, terei que fazer os testes todos online?
Desde ja muito grato
Pessoal,
Valeu pelas dicas
A dica do Marcus resolveu meu problema.
té+
Scripts PHP só são processados em tempo de execução. Se você tiver um servidor local instalado, deve testar suas aplicações via http://127.0.0.1 para que os scripts funcionem corretamente.
Como só o código?
Cole ai o código então para poder entender!