简体   繁体   中英

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.

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? 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. Though i think the variables they are using are different... if i recall XSL variables are {$VariableName} as opposed to ${VariableName} .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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