tags:

views:

24

answers:

1

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.

i.e 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 ?

A: 

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}.

prodigitalson