More TrackBack Implementation Stuff
I found myself in a quandry in the midst of my trackback implementation. A normal implementation in blog software involves listing the total number of total trackbacks on the listing page. Then, for the full entry page or a separate trackbacks page, the actual details of the trackbacks are displayed. The issue I had was that I was using PHP to perform the XSL transformation on my XML blog contents file. The trackbacks are controlled by a funky Perl script (that I have since modified). I wanted to be able to do a PHP server-side include bit of code inside the results of the XSL transformation. Luckily, looking at this article on evaluating php expressions using Sablotron, I discovered how to get PHP to render the result and then evaluate the inner PHP expressions that I included in the XSL.
Key to this whole thing is using:
<xsl:processing-instruction name="php"> php stuff goes here... </xsl:processing-instruction>
Next, you need to change the processing slightly in the php code to look like this:
$xh = xslt_create();$result = eval ("?>". xslt_process($xh, './devblog/current.xml', 'devblog.xsl'));echo $result;xslt_free($xh);
And you’ll be good to go. So that takes care of the count so that I can show the number of trackbacks for each entry and it will also provide me the ability to include the trackback details inline with the single entry display page.
No comments yet. Be the first.
Leave a reply