简体   繁体   English

如何在浏览器中将HTML代码转换为模板输出

[英]How to convert Html code to template output in browser

I need to convert HTML in template. 我需要在模板中转换HTML As seen in image content should show as a template. 如图所示, 内容应显示为模板。 I am using table to show . 我正在用table展示。 but now i need to show it in template output 但是现在我需要在模板输出中显示它

Here is my Code: 这是我的代码:

<table id="datatable" class="tablesorter"> 
    <span id='errfrmMsg'></span>
    <thead>
        <tr>        
            <th scope="col" id="">Name</th>
            <th scope="col" id="">Content</th>
        </tr>
    </thead>

    <tbody>
        <?php
            $templ_id = $_REQUEST['templ_id'];
            $getTemplateQuery = mysql_query("select * from templates where id = $templ_id");
            $getTemplateRow = mysql_fetch_array($getTemplateQuery);
        ?>
        <tr>
            <td valign="top" width="125"><?php echo $getTemplateRow['templ_name'];?></td>
            <td valign="top" width="319">
            <?php
                echo $templContent = $getTemplateRow['templ_content'];
?>
        </tr>
    </tbody>
</table>

Here is an Output: 这是输出:

在此处输入图片说明

From what I can gather from your question, try outputting with: 从您的问题中可以得出的结论中,尝试输出:

$html = htmlspecialchars_decode($content)

EDIT: 编辑:

echo $templContent = htmlspecialchars_decode($getTemplateRow['templ_content']);

Try this this will help You 试试这个,这对您有帮助

<?php

echo $htmlContent = htmlspecialchars_decode($getTemplateRow['templ_content']) 

?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM