I am very new to PHP, so I suspect a stupid mistake. I was looking for someone with a similar problem, but could not find.
So, I have a PHP file that should output some HTML from a template (via Smarty ). Instead of viewing the HTML presented in Chrome, I see the HTML text itself. Here is the PHP code I'm using:
<?php header("Content-type: text/html; charset=utf-8"); ob_start(); include_once '../api/get_article.php'; $a_json = ob_get_clean(); $data = json_decode($a_json, true); require('./libs/Smarty.class.php'); $smarty = new Smarty(); $smarty->template_dir = './templates/'; $smarty->compile_dir = './templates_c'; $smarty->assign("title_text",$data['title']); $smarty->display('content.tpl'); ?>
I thought this was an encoding problem, but I made sure everything uses UTF-8 (i.e. MYSQL, HTTP header and template file). What else could be?
source share