Tema: FckEditor
Ver Mensaje Individual
  #5 (permalink)  
Antiguo 19/09/2008, 15:33
Avatar de masterojitos
masterojitos
 
Fecha de Ingreso: julio-2008
Ubicación: Lima Callao Chucuito
Mensajes: 1.931
Antigüedad: 15 años, 9 meses
Puntos: 105
Respuesta: FckEditor

BUENO PS COMO TE PUSE..... Y YA BUENO A LOS BEBITOS HAY QUE DARLE DE COMER EN LA BOCA.... JAJA, AYI TE VA EL CODIGO PUES....

Código PHP:
<?php
// incluimos el archivo de conexion
include ('db-cnx.php');
// recibimos el formulario
if(isset($_POST['enviar']) && $_POST['enviar'] == 'Enviar'){
// comprobamos que el formulario no envie campos vacios
if(!empty($_POST['notTitulo']) && $_POST['notTexto'] &&
$_POST['notCategoriaID']){
// creamos las variables y les asignamos los valores a insertar
$notTitulo $_POST['notTitulo'];
$notTexto $_POST['notTexto'];
$notCategoriaID $_POST['notCategoriaID'];
// hacemos el INSERT en la BD
$sqlInsertNot mysql_query("INSERT INTO sn_noticias
(notTitulo, notTexto, notCategoriaID)
VALUES ('$notTitulo', '$notTexto', '$notCategoriaID')"
,
$db_link) or die(mysql_error());
// enviamos un mensaje de exito
echo "Los datos fueron gurdados correctamente";
}else{
// si el formulario envia algun campo vacio
// enviamos un mensaje de error
echo "Debe llenar todos los campos del formulario";
}
}
?>
<!– el formulario –>
<form name="noticia" action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<p>
Título de la Noticia<br />
<input type="text" name="notTitulo" size="50" />
</p>
<p>
Texto de la Noticia<br />
<?php
$oFCKeditor 
= new FCKeditor('notTexto') ;//nombre del editor (reemplaza a tu textarea ps)
$oFCKeditor->BasePath '../fckeditor/'//lugar donde esta el fckeditor (la carpeta)
$oFCKeditor->Width  '100%'//ancho del fckeditor
$oFCKeditor->Height '400';//alto del fckeditor
$oFCKeditor->Create();//creamos el fckeditor
?>
</p>
<p>
Categoría<br />
<select name="notCategoriaID">
<option value="">Escoger de la Lista</option>
<?php
// asignamos una categoria a la noticia
// mediante un select
$sqlQueryCat mysql_query("SELECT * FROM sn_categorias"$db_link)
or die(
mysql_error());
// creamos un bucle while
// que nos muestre todas las categorias
// que tenemos guardadas en la BD
while($rowCat mysql_fetch_array($sqlQueryCat)){
echo 
"<option value=’$rowCat[cat_ID]‘>$rowCat[catCategoria]</option>";
}
?>
</select>
</p>
<p>
<input type="submit" name="enviar" value="Enviar" />
</p>
</form>
y punto, luego recuperas su contenido al igual como lo haces con el textarea, ya sea con $_POST[notTexto] o con $_REQUEST[notTexto]..... suerte.
__________________
Atte. MasterOjitos :ojotes:
Todo sobre Programación Web
Las ultimas tendencias en Efectos y Recursos Web: MasterOjitos Blog