开发者

How do I make a custom markItUp preview page in PHP?

I have a question about markItUp!'s preview function.

Inside jquery.markitup.js i have these settings:

previewTemplatePath:'~/templates/preview.php',
previe开发者_开发百科wParserPath:'~/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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜