Script del editor BBcode
Código PHP:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<link rel="stylesheet" href="/autos/js/editor/minified/themes/default.min.css" type="text/css" media="all" />
<script type="text/javascript" src="funciones.js"></script>
<script type="text/javascript" src="/autos/js/editor/jquery.sceditor.bbcode.js?v=2"></script>
<script type="text/javascript" src="/autos/js/editor/jquery.sceditor.js?v=2"></script>
<script type="text/javascript" src="/autos/js/editor/languages/es.js?v=2"></script>
<script>$(document).ready(function() {
$("#descripcion").sceditorBBCodePlugin({
style: "/js/editor/minified/jquery.sceditor.default.min.css?v=3",
locale : "es",
width:"640px",
height:"100%",
resizeMinWidth:640,
resizeMaxWidth:640,
resizeMinHeight:350,
resizeEnabled:true,
toolbar:"bold,italic,underline|left,center,right,justify|font,size,color,removeformat|copy,paste|code,quote|image,link,unlink|emoticon,youtube,date|source",
emoticons:
{
dropdown: {
":)": "Smileys/default/icon_smile.png",
":D": "Smileys/default/icon_biggrin.png",
":???:": "Smileys/default/icon_confused.png",
":cool: ": "Smileys/default/icon_cool.png",
":cry: ": "Smileys/default/icon_cry.png",
">_< ": "Smileys/default/icon_vangry.png",
":evil:": "Smileys/default/icon_twisted.png",
":baba:": "Smileys/default/icon_baba.png",
":mad:": "Smileys/default/icon_mad.png",
":mrgreen:": "Smileys/default/icon_ojitos.png",
":|": "Smileys/default/icon_neutral.png",
":P": "Smileys/default/icon_razz.png",
":$": "Smileys/default/icon_redface.png",
":roll": "Smileys/default/icon_rolleyes.png",
":(": "Smileys/default/icon_sad.png",
":O": "Smileys/default/icon_surprised.png",
";)": "Smileys/default/icon_wink.png",
":love:": "Smileys/default/icon_love.png",
":asco:": "Smileys/default/icon_mrgreen.png",
":up:": "Smileys/default/icon_up.png",
":down:": "Smileys/default/icon_down.png",
},
more: {
},
hidden: {
}
},
});
});
</script>
Textarea
Código PHP:
<div style="height:400px;">
<textarea style="width:90%;height:400px" type="textbox" name="descripcion" id="descripcion" class="input big"></textarea>
</div>
Funcion que guarda los datos a la base.
Código PHP:
/* Agregar Post */
$(document).ready(function() {
$("#publicar").click(function() {
var name = $("input#titulo").val();
var portada = $("input#portada").val();
var comment = $("textarea#descripcion").val();
var pclaves = $("input#pclaves").val();
var categorias = $("input#categorias").val();
var now = new Date();
var date_show = now.getDate() + '-' + now.getMonth() + '-' + now.getFullYear() + ' ' + now.getHours() + ':' + + now.getMinutes() + ':' + + now.getSeconds();
var dataString = 'titulo=' + titulo.value + '&portada=' + portada + '&descripcion=' + descripcion.value + '&pclaves=' + pclaves.value + '&categorias=' + categorias;
$.ajax({
type: "POST",
url: "/autos/ajax/addpost.php",
data: dataString,
success: function (response) {
$("#newmessage").delay(2000).fadeIn("slow");
$("#newmessage").html(response);
$("#newmessage").delay(2000).fadeOut("slow");
}
});
return false;
});
});