php - smarty include markdown file -


i want include markdown file in smarty template.

in php have this:

$smarty->assign('text', 'path_to_file/text.md'); 

in template use:

{include file=$text} 

but returns unformated block of text.

i tried using david scherer’s markdown plugin smarty:

{markdown text=$text}  

but returns file path stored in $text variable.

how smarty parse included file markdown?

you instead read file , assign contents variable, use markdown plugin.

$smarty->assign('text', file_get_contents('path_to_file/text.md')); 

manual page file_get_contents()


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -