In my app I have a simple form :
<div class='centered'><h1 style="margin-bottom: 20px;">Add an article</h1></div>
<?php
echo $this->Form->create('Post', array(
'class' => 'form',
'inputDefaults' => array(
'div' => 'control-group',
'label' => false,
'between' => '<div class="controls">',
'after' => '</div>',
'error' => array('attributes' => array('wrap' => 'div', 'class' => 'alert alert-error'))
) ));
echo $this->Form->input('title',array(
'style' => 'width:490px',
'before' => '<span class = \'control-label\'>Title</span>'));
echo $this->Form->input('body',array(
'style' => 'width:490px',
'rows' => '15',
'placeholder' => '<p>Please use HTML syntax</p>',
'before' => '<span class = \'control-label\'>Content</span>'));
echo $this->Form->input('format', array(
'options' => array('standard' => 'Standard post', 'link' => 'Link post')));
echo ("<input type='submit' class='btn' value='Publish'>"); ?>
<a class="btn btn-danger" href="<?php echo $this->Html->url('/'); ?>">Cancel</a>
I want the user to be able to enter body as markdown syntax, but to be converted to html and stored in the database.
I've downloaded it from http://michelf.com/projects/php-markdown/ and the help file says :
include_once "markdown.php";
$my_html = Markdown($my_text);
So I guess I have to use :
App::import('Vendor', 'markdown/markdown');
But where do I put this and how can I change my form so only the body input area is converted from Markdown to html ?
Thanks a lot !
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment