Question

Eh bien, je suis d'ADM, mais je suis incapable d'apprendre comment obtenir le code HTML généré \ Markdown code .... je veux l'envoyer à la DB ... thats pourquoi je suis en utilisant PHP ....

<script src='wmd.js'></script>

<form name="formname" method='POST'>

<textarea id="myTextarea" style="width: 500px; height: 200px;">
*This* example sets WMD's options programmatically.
</textarea>

<input type="submit" name="sub" value="submit">

</form>

<!--Preview Can Be Seen Here-->
<div class="wmd-preview" id="wmd"></div>

<?php
if( isset( $_POST['sub'] ) )
{
       $generated_HTML = "How to get it here";
}
?>

peut-on s'il vous plaît me dire comment obtenir le code HTML généré ...

Était-ce utile?

La solution

L'éditeur de destruction massive est juste un éditeur de texte côté client qui supporte l'entrée de texte démarquage formaté. Pour convertir démarquage en HTML, vous aurez besoin d'un analyseur de démarquage.

Un rapide Google me dit qu'il ya au moins un disponible: http://michelf.com/projects / php-markdown /

Autres conseils

obtenir ces fichiers wmd.js & markdown.php

et utiliser le code follwing

<script src="wmd.js"></script>
<script type="text/javascript">

wmd_options = {output: "HTML",lineLength: 40,buttons: "bold italic | link image | ol ul heading hr",autostart: true};

</script>

<form name="formname" method="post" action="">
<textarea id="myTextarea" style="width: 500px; height: 200px;" name="TA"></textarea>
<br><input type="submit" name="KILL"     value="Submit">
</form>

<?php
if(  isset( $_POST['kil'] ) )
{
    $my_text = $_POST['tr'];
    include ('markdown.php');
    $my_html = Markdown($my_text);
    echo $my_html;
        //$send $myhtml to database or do something with
}
?>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top