Foros del Web » Programando para Internet » PHP »

AYUDA - Integrando cfkeditor a PHP

Estas en el tema de AYUDA - Integrando cfkeditor a PHP en el foro de PHP en Foros del Web. saludos tengo un problema... ya que al integrar el cfkeditor a mis forms me sale justo en su lugar q la pagina no puede ser ...
  #1 (permalink)  
Antiguo 13/02/2008, 08:36
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 7 meses
Puntos: 28
AYUDA - Integrando cfkeditor a PHP

saludos tengo un problema... ya que al integrar el cfkeditor a mis forms me sale justo en su lugar q la pagina no puede ser encontrada...
Link de muestra

http://www.cersolve.com/sitepanel/adm_pro2.php
aqui les muestro...


Código PHP:
<?php require_once('../Connections/connect.php'); ?>
<?php
include_once("fckeditor/fckeditor.php") ;
?>

<?php

function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}
$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}


if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {

$ediciondir'../images2/';  
$uploaddir=$ediciondir;
if (!
is_dir($ediciondir)) {     mkdir($uploaddir0777);    }
move_uploaded_file($_FILES['imagen']['tmp_name'], $uploaddir $_FILES['imagen']['name']);    
$filename $_FILES['imagen']['name'];

$ediciondir'../ficha/';  
$uploaddir=$ediciondir;
if (!
is_dir($ediciondir)) {     mkdir($uploaddir0777);    }
move_uploaded_file($_FILES['ficha']['tmp_name'], $uploaddir $_FILES['ficha']['name']);    
$filename2 $_FILES['ficha']['name'];


$insertSQL sprintf("INSERT INTO producto (Id_categoria, Id_marca, nombre, codigo, uso, descripcion, tipo, especificaciones, imagen, ficha, status) VALUES (%s, %s, %s, %s %s, %s, %s, %s, %s, %s, %s,)",
                       
GetSQLValueString($_POST['Id_categoria'], "int"),
                       
GetSQLValueString($_POST['Id_marca'], "int"),
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['codigo'], "text"),
                       
GetSQLValueString($_POST['uso'], "text"),
                       
GetSQLValueString($_POST['descripcion'], "text"),
                       
GetSQLValueString($_POST['tipo'], "text"),
                       
GetSQLValueString($_POST['especificaciones'], "text"),
                       
GetSQLValueString($filename"text"),
                       
GetSQLValueString($filename2"text"),
                       
GetSQLValueString($_POST['status'], "text"));

  
mysql_select_db($database_connect$connect);
  
$Result1 mysql_query($insertSQL$connect) or die(mysql_error());

  
$insertGoTo "adm_pro.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
 
header(sprintf("Location: %s"$insertGoTo));
}

mysql_select_db($database_connect$connect);
$query_Recordset1 "SELECT * FROM categoria";
$Recordset1 mysql_query($query_Recordset1$connect) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);

mysql_select_db($database_connect$connect);
$query_Recordset2 "SELECT * FROM marca";
$Recordset2 mysql_query($query_Recordset2$connect) or die(mysql_error());
$row_Recordset2 mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 mysql_num_rows($Recordset2);

?>
El form

Código PHP:
<form action="<?php echo $editFormAction?>" method="post" enctype="multipart/form-data" name="form1" onSubmit="MM_validateForm('descripcion','','R');return document.MM_returnValue">
              <table width="414" align="center">
                <tr valign="baseline">
                  <td width="96" align="right" valign="middle" nowrap class="textoINDEX"><div align="left">Categoria: </div></td>
                  <td width="306" valign="middle" class="textoINDEX"><div align="left">
                      <select name="Id_categoria" class="todopanel" id="Id_categoria">
                        <?php
do {  
?>
                        <option value="<?php echo $row_Recordset1['Id_categoria']?>"><?php echo $row_Recordset1['nombre']?></option>
                        <?php
} while ($row_Recordset1 mysql_fetch_assoc($Recordset1));
  
$rows mysql_num_rows($Recordset1);
  if(
$rows 0) {
      
mysql_data_seek($Recordset10);
      
$row_Recordset1 mysql_fetch_assoc($Recordset1);
  }
?>
                      </select>
                  </div></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" valign="middle" nowrap class="textoINDEX"><div align="left">Marca</div></td>
                  <td align="left" valign="middle" class="textoINDEX"><div align="left">
                      <select name="Id_marca" class="todopanel" id="Id_marca">
                        <?php
do {  
?>
                        <option value="<?php echo $row_Recordset2['Id_marca']?>"><?php echo $row_Recordset2['nombre']?></option>
                        <?php
} while ($row_Recordset2 mysql_fetch_assoc($Recordset2));
  
$rows mysql_num_rows($Recordset2);
  if(
$rows 0) {
      
mysql_data_seek($Recordset20);
      
$row_Recordset2 mysql_fetch_assoc($Recordset2);
  }
?>
                      </select>
                  </div></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" valign="middle" nowrap class="textoINDEX"><div align="left">Nombre:</div></td>
                  <td valign="middle" class="textoINDEX"><div align="left">
                      <input name="nombre" type="text" class="todopanel">
                  </div></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" valign="middle" nowrap class="textoINDEX"><div align="left">Codigo</div></td>
                  <td align="left" valign="middle" class="textoINDEX"><input type="text" name="codigo" id="codigo">
                      </label></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" valign="middle" class="textoINDEX"><div align="left">Uso</div></td>
                  <td align="left" valign="middle" class="textoINDEX"><input type="text" name="uso" id="uso"></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" valign="middle" class="textoINDEX"><div align="left">Descripci&oacute;n</div></td>
                  <td align="left" valign="middle" class="textoINDEX"><?php
$oFCKeditor 
= new FCKeditor('descripcion') ;
$oFCKeditor->BasePath '/fckeditor/' ;
$oFCKeditor->Value '<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>' ;
$oFCKeditor->Create() ;
?>
</td>
                </tr>
                <tr valign="baseline">
                  <td align="right" valign="middle" nowrap class="textoINDEX"><div align="left">
                    <p>Tipo</p>
                    </div></td>
                  <td valign="middle" class="textoINDEX"><div align="left">
                    <input type="text" name="tipo" id="tipo">
                  </div></td>
                </tr>
                <tr valign="baseline">
                  <td align="left" valign="middle" nowrap class="textoINDEX">Especificaciones</td>
                  <td align="left" valign="middle" class="textoINDEX"><textarea name="especificaciones" id="especificaciones" cols="28" rows="5"></textarea></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" valign="middle" class="textoINDEX"><div align="left">Ficha</div></td>
                  <td valign="middle" class="textoINDEX"><div align="left">
                      <input name="ficha" type="file" class="todopanel" id="ficha"  enctype="multipart/form-data">
                  </div></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" valign="middle" class="textoINDEX"><div align="left">Imagen:</div></td>
                  <td valign="middle" class="textoINDEX"><div align="left">
                      <input name="imagen" type="file" class="todopanel"  enctype="multipart/form-data">
                  </div></td>
                </tr>
                <tr valign="baseline">
                  <td align="left" valign="middle" class="textoINDEX">Status</td>
                  <td valign="middle" class="textoINDEX"><label>
                    <select name="status" id="status">
                      <option>0</option>
                      <option value="Impresi&oacute;n una cara">1</option>
                      <option value="Impresi&oacute;n doble cara">2</option>
                      <option value="Laminado">3</option>
                                                                                </select>
                  </label></td>
                </tr>
                <tr valign="baseline">
                  <td align="right" valign="middle" class="Estilo6"><div align="left">
                      <input type="hidden" name="MM_insert" value="form1">
                  </div></td>
                  <td valign="middle"><div align="left"></div></td>
                </tr>
                <tr valign="baseline">
                  <td nowrap align="right">&nbsp;</td>
                  <td><div align="left">
                      <input name="submit" type="submit" class="todopanel" value="Insertar registro">
                  </div></td>
                </tr>
              </table>
          </form>
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #2 (permalink)  
Antiguo 13/02/2008, 09:13
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Re: AYUDA - Integrando cfkeditor a PHP

Si te sale un error 404, es porque tienes mal la ruta al fckeditor.

Saludos.
  #3 (permalink)  
Antiguo 13/02/2008, 09:24
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 7 meses
Puntos: 28
Re: AYUDA - Integrando cfkeditor a PHP

bueno mal el problema era este

Código PHP:
$oFCKeditor->BasePath '/fckeditor/' 
me estaba lanzando una carpeta arriba....

ahora bien ok... ya funciona... pero me sale todo cortado :S:S

y como le asigno para q ingrese en la base de datos???
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #4 (permalink)  
Antiguo 13/02/2008, 09:51
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Re: AYUDA - Integrando cfkeditor a PHP

¿A que te refieres con cortado?.

Para insertar a la base de datos solo es necesario que recojas el valor con la variable $_POST que te da, por ejemplo si tu editor se llama "editor1", lo recoges con $_POST['editor1'].

Saludos.
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

SíEste tema le ha gustado a 1 personas




La zona horaria es GMT -6. Ahora son las 20:33.