[英]PHP how do I allow users to customize html for their blog design?
A certain blogsite allow its users to fully customize the entire html page of their blogg, change doctype and all, and they use tags for where they want the user to dipslay things like titlename and amount of comments etc. 某个博客网站允许其用户完全自定义其博客的整个html页面,更改doctype以及所有内容,并且在希望用户添加标题名称和评论数量等内容的位置使用标记。
ie this is code you can edit and submit under blog design settings: 即,这是您可以在博客设计设置下编辑和提交的代码:
<tag:archivelist>
<li><a href="${ArchiveLink}">${ArchiveName}</a></li>
</tag:archivelist>
</ul>
<tag:if test="${hasLinks == 'true'}">
<div class="navheader">Links</div>
<ul>
<tag:linklist>
<li><a href="${LinkURL}" title="${LinkDescription}">${LinkName}</a></li>
</tag:linklist>
</ul>
</tag:if>
<tag:if test="${hasBooks == 'true'}">
<div class="navheader">Books</div>
<ul>
<tag:booklist>
<li><a href="${BookUrl}"><img class="thumbnail" src="${BookImageSmall}" border="0" alt="${BookTitle}" title="${BookTitle}" /></a><br /><a href="${BookUrl}">${BookTitle}</a></li>
</tag:booklist>
Now, how do they replace the ${ArchiveLink} part to make it into something from mysql table, how do they extract and replace what method? 现在,他们如何替换$ {ArchiveLink}部分,使其从mysql表中转换为某种东西,如何提取和替换什么方法? preg_replace ?
preg_replace?
They are most likely using XLST (or a more elaborate custom templating engine that makes use of it) to transform the markup into standard HTML. 他们最有可能使用XLST(或使用它的更精细的自定义模板引擎)将标记转换为标准HTML。 Though i think the variables they are using are different... if i recall XSL variables are
{$VariableName}
as opposed to ${VariableName}
. 虽然我认为他们使用的变量是不同的...如果我记得XSL变量是
{$VariableName}
而不是${VariableName}
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.