Group 1

Published On: April 10, 2007  13:46, filed in
click photo for larger version
Group 1
Tags: photography pendragon movie

Old Man

Published On: April 10, 2007  13:46, filed in
click photo for larger version
Old Man
Tags: photography pendragon movie

Artos 1

Published On: April 10, 2007  13:45, filed in
click photo for larger version
Artos 1
Tags: photography pendragon movie

Roman Extra

Published On: April 10, 2007  13:44, filed in
click photo for larger version
Roman Extra
Tags: photography pendgragon movie

Nick 2

Published On: April 10, 2007  13:44, filed in
click photo for larger version
Nick 2
Tags: photography pendragon movie

Nick 1

Published On: April 10, 2007  13:41, filed in
click photo for larger version
Nick 1
Tags: photography pendragon movie

The Depth of Mercy and the Breadth

Published On: April 15, 2007  20:02, filed in Verse
How does one express,
the depth of mercy and the breadth
and width of His great love?

For I have descended
to such great heights
of proud and selfish gain.
And the weight of sin is
a dark and lonely pain.

Yet Christ above
on God's right hand
intercedes for me...

Oh, unexplainable grace,
death on Calvary.
mine is an undeserved and wasted life
and yet I am redeemed. 
Tags: grace faith redemption poetry verse free verse

MovableType Templating for WordPress

Published On: April 20, 2007  10:39
I don't know about you, but I've always disliked the WordPress templating structures. I've had some spare time over the last few weeks, so I decided to take some templating code I had worked on previously and port it to php.

phptemplate is a simple, fast and flexible templating system that can be used in any php application. It provides a fast way to build templated code, and offers a way to clearly separate code from content.

PHPTemplate has three main main files:

Parser.php : the parsers job is to parse a string and return a tree. It is a php class and has two functions:

  • parse_text takes two variables, $textblock is the text to be parsed, $tagID is the prefix to the tags which defaults to BK. So the default tags will look like this, <BKTag /> and <BKContainerTag>this is some block text</BKContainerTag>
  • parse_attributes gets called internally by the parser and will rarely be needed outside. It take once variable, $atag, and returns a hash with the attribute/value pairs.


TagHandlers.php : tag handlers are functions that get called when a tag is found. Tag handlers mirror the name of the tag, so if there is a tag called <BKFirstName />, then there will be a function called "FirstName()". Most tag handlers return a string which is compiled by Template.php and eventually written out to the page. Tag Handerls are passed two variables:

  • $token is the tag token object, is a hash, and has four items: $token->type (container|single), $token->tagname , $token->block (if it is a container tag, this is the contents of the container), and $token->attributes (a hash of attribute/value pairs). In the case of a container tag, it is the responsibility of the tag handler to call template.php's call_handlers function and pass it the $token->block.
  • $parameters is a variable containing anything you choose to pass through. It is often used by container tags to pass data to its subtags.



Template.php : the job of template is to call the parser, then call the tag handles for the tags it finds. It is a php class and when created, you pass it the text of the template. You then need to call the build_template() function, optionally passing at parameters in that you might need later. build_template returns a string, the result of the parsed template text.

To use phptemplate in wp, simple copy the phptemplate dir into your theme, and for any file you wish to use templating, paste this code into the php file and create a .tmpl file of the same name containing your template code.

<?php
require_once(TEMPLATEPATH.'/phptemplate/Template.php');
$tmpfile = substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], "/")+1);
$tmpfile = substr($tmpfile, 0, strrpos($tmpfile, "."));
$template = file_get_contents(TEMPLATEPATH."/".$tmpfile.".tmpl");
$te = new Template($template);
echo $te->build_template();
?>


I have included the default theme with a phptemplate example as a demonstration. Tags I have currently ported from wordpress are listed below:


  • Posts: replaces theLoop
  • LinkCategories
  • Links: when Links is used inside the LinkCategories tag, Links will only return those links in that link category.
  • Authors
  • Categories: may be used in either a container or a single tag context.

    I will be updating this post to provide more complete documentation of the wp tags i have ported. You can download the example of phptemplate in wp here.
 
Tags: wordpress movabletype mt wp blogging templating

About Me

My name is Jason Wall. I live in Saint Louis, where I work for a large company doing web development. I photograph for fun and shoot weddings for profit. I write poetry when I feel like it, and post my opinions here on the blog. For more about me check out the About page.
My 43 Things
My 43 Places

Walljm.com Stats

   Blog: 792
   Link Log: 383
   Photos: 790
   Poetry: 172
   Wallpapers: 10

Photography

The daily photo page with links to archives and galleries. more...

Tag Cloud

The popular presentation of tags, showing all the tags used at walljm.com ordered by size. more...

Blog & Photo Archives

Old posts listed chronologically and by category, Photos sorted by gallery. Archives page.

Poetry

The poetry archive, listed by title and categorized by type. more...

AJAX Bible

A dynamic Bible application I built using AJAX technologies that features the KJV, Strongs Concordance, Robinson's Morphilogical Analysis Codes, and Cross References (compiled from Strongs). AJAX Bible

Projects

Miscellaneus files and projects that I've created, written or coded. more...

Wallpapers

I occasionally take favorite photographs and turn them into desktop wallpapers. more...

Links

All the sites and people I read regularly or find useful enough to never want to loose. more...

Twitter

Loading...

// Creative Commons License