xtemplate to phptemplate conversion

Posted by gordon on Sat, 27/11/2004 - 11:31am

Firstly rename the xtemplate.xtmpl file to original.xtmpl so that the theme is no longer a xtemplate theme.

Creating page.tpl.php

  1. copy original.xtmpl to page.tpl.php
  2. Remove the node, comment, box, and block sections. In the place of these sections add the following code
    <?php echo $comment ?>
  3. Change all the "{" characters to "<?php print $"
  4. Change all the "}" characters to "; ?>"
  5. Change the "$footer" to "$closure"
  6. Change "$message" to "$messages"
  7. As the primary and secondary links in phptemplate are arrays you will need to change them from "echo $primary_links;" to "echo theme('links', $primary_links);". Also the same needs to be done for secondary links.
  8. In the blocks section we need to change the $block to either $sidebar_left or $sidebar_right depending on which side of the content it is on.

Creating node.tpl.php

  1. Copy the node section from the original.tmpl to a new file node.tpl.php
  2. As before change all the "{" and "}" characters to "<?php print $" and "; ?>" respectively.
  3. change $link to $node_url.
  4. Change "$taxonomy" to "$terms"
  5. Change "print $sticky;" to "if ($sticky) { print " sticky"; }"
  6. Change "print $picture;" to "if ($picture) { print $picture; }"

Creating comment.tpl.php

  1. Copy the comment section from the original.tmpl to a new file comment.tpl.php
  2. As before change all the "{" and "}" characters to "<?php print $" and "; ?>" respectively.
  3. Change "print $picture;" to "if ($picture) { print $picture; }"

Also just to be clean, you may want to change the displaying of the new so it will only show when the $new != ''

Create block.tpl.php

  1. Copy the comment section from the original.tmpl to a new file comment.tpl.php
  2. As before change all the "{" and "}" characters to "<?php print $block->" and "; ?>" respectively.
  3. Then change the $block->title to $block->subject.

Create box.tpl.php

  1. Copy the comment section from the original.tmpl to a new file comment.tpl.php
  2. As before change all the "{" and "}" characters to "<?php print $" and "; ?>" respectively.

This is also a very good

This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this. StartCleaningService.com

I think more writers should

I think more writers should take care to write with passion like you. Even informational articles like this can have personality. That’s what you have interjected in this informative article. Your views are very unique.

The first steps are wrong in

The first steps are wrong in the last two tpl.php's sections. You wrote comment there.
 

Comment?

This explanation is really odd. What's with the repeated parts about comments? I have a hard time figuring out what you mean. I doubt someone who is not familiar with the inner workings of a theme system will manage.

 

This really looks an

This really looks an interesting post and something which I was always curious about – xtemplate to phptemplate conversion!! Since everything is explained step by step, it was really easy to follow with getting confused!! This is really going to make a lot of things possible and once the instructions are completed and I am sure that this is going to be taken advantage of many who come here!! I am really looking forward to more like these!!

Well I have done a bit of

Well I have done a bit of work this weekend on building updating ecommerce to use the new forms api. The store module is basically complete now. However I do need to refactor some of the methods of doing things such as the admin/store so that it can uses the new _validate() and _submit() functions to do the updating640-721//156-215.71//N10-005/642-447//312-50v7//1Y0-A19//NS0-154//642-982//642-874//JN0-660//642-437//SK0-003//