Category: Code

  • The One Line Template Engine

    Bought to you by vincevincevince over at webmasterworld. The engine itself: print preg_replace(“/\{([^\{]{1,100}?)\}/e”,”$$1″,file_get_contents(“template.tpl”)); Format of template.tpl file: <html> <head> <title>{title}</title> </head> <body> <h1>{header}</h1> {text} </body> </html> Setting variables: $title=”Example page”; $header=”My Examples”; $text=”See the placeholders replaced?”; “/\{([^\{]{1,100}?)\}/e”,”$$1″ I’m delimiting the regular expression with / / and using the modifier ‘e’ which causes the second argument […]

  • Sideways Text

    Just upgraded to Firefox 3.5 and I have to test out the goods. Sideways Text If your on a cutting edge browser the text should appear sideways. I had to tweak a bit to get it to display properly, so obviously there are a few bugs or misconceptions. The code for the curious is: <div […]