Neil Turner's Blog

Blogging about technology and randomness since 2002

PHP TypeKey and Dynamic Publishing

I’ve spent part of this afternoon trying to get PHP TypeKey to work with Dynamic Publishing, which is a lot easier said than done.
I have now got it to work but not with the standard code. This is because you can’t use standard MT tags inside PHP code blocks; instead, you have to express the tags as PHP object functions. PHP TypeKey needs this because the <$MTRemoteSignInLink$> and <$MTRemoteSignOutLink$> tags both produce output that is invalid HTML, so I use the htmlentities() PHP function to correct the character entities to make them valid. This means that htmlentities(<$MTRemoteSignInLink static="1"$>); becomes htmlentities($this->tag('MTRemoteSignInLink', array('static' => '1')));.
Another problem I encountered was with caching, which I had enabled as a way of reducing database load when generating the dynamic pages. With caching enabled, the message that said whether you were signed in or not would not be accurate, so that had to be disabled.
Once the above had been done, the system seemed to work okay, and I’m now using it over at Smaller World. I’ll try to get a separate Dynamic-compatible version out at some point for those interested in deploying it themselves.

3 Comments

  1. Thanks, that seems to be working. When are yoiu going to place a link to this in your sidebar?

  2. At some point :). It’s on my to-do list, but I have a few other priorities at the moment, such as exams and project work…

  3. Ahh $this->tag forgot all about that. Thanks for the solution ๐Ÿ™‚