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
Post a Comment