I have a question about markItUp!'s preview function.
Inside jquery.markitup.js i have these settings:
previewTemplatePath:'~/templates/preview.php',
previewParserPath:'~/templates/preview.php',
previewParserVar:'data'
I'm not sure what to do with previewParserPath and previewParserVar. Is it possible to grab the content sent by markItUp in preview.php with PHP?
// preview.php
<body>
<!-- content -->
</body>
You only need to set the previewParserPath and optionally the previewParserVar.
If you use this:
previewParserPath: '~/preview.php'
then markitup will look for a preview.php script to run in the same directory as the markitup jquery script--that's what the ~ character means.
If instead you set the preview path to something like this:
previewParserPath: '/preview.php'
then it will be relative to your web server root directory, as usual.
The implementation of the script it up to you; this is perhaps the most basic example:
echo htmlentities($_POST['data']);
The "data" there corresponds to the value of the previewParserVar setting; the default is "data".
In your app, you're probably going to want to do something useful with $_POST['data'] before you display it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With