<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WP Gallery</title>
	<atom:link href="http://www.wpgallery.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wpgallery.co.uk</link>
	<description>A gallery of wordpress plugins</description>
	<lastBuildDate>Sat, 24 Mar 2012 23:54:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>WP XML Template</title>
		<link>http://www.wpgallery.co.uk/wp-xml-template/</link>
		<comments>http://www.wpgallery.co.uk/wp-xml-template/#comments</comments>
		<pubDate>Sun, 26 Feb 2012 03:28:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.wpgallery.co.uk/?p=785</guid>
		<description><![CDATA[This plugin offers simple and advanced mechanisms for embedding parameterised post snippets into posts. For the purposes of this plug-in a Wordpress Post-Template is simply a Wordpress post (or page) which embeds the values of its own custom variables within its html content by means of simple mark-up. The Wordpress post-template can then be embedded [...]]]></description>
			<content:encoded><![CDATA[<p>This plugin offers simple and advanced mechanisms for embedding parameterised post snippets into posts.

<em>For the purposes of this plug-in a <strong>Wordpress Post-Template</strong> is simply a Wordpress post (or page) which embeds the values of its own custom variables within its html content by means of simple mark-up. The Wordpress post-template  can then be embedded within another post, also by means of simple markup, with the option to override the custom variables differently each time the post template is embedded.</em>

Additionally custom variables, global variables (defined on the plug-in settings page) and external files can contain <strong>XML</strong><strong></strong> which can be iterated by the post-template. <strong>CSV</strong> files are also supported - they are simply converted to &lt;row&gt; and &lt;col&gt; tags and after that it is business as usual. Internally the post-template engine deals with XML (addressable by the power of <strong>XQuery</strong>). It's most important aspect is that it is hierarchical. Read on to see why this is such a useful feature.

With this plugin you could create a post-template describing an embedded video or a mobile phone deal "box". As you will see below you can then repeatedly render it on some page (optionally) based on variables from an xml file. If you later decide to change the way it looks or you want to render it differently on another site then you only have to change the post-template instead of updating all instances of it on every page it occurs on. Likewise if you want to add more similar content you just have to update the xml file.
<h2>Example: Embedding the "Showcase" Post-Template</h2>
The "showcase" shown below is rendered using the following directives:

<span style="display: block; background: #DFDFDF; font-family: courier;">{rewrite}[call(@showcase,class{Mobile Phones},brand{Apple})]{/rewrite}</span>

where the following parameters are passed to the "call" method,
<ul>
	<li>one anonymous parameter which is being set to "@showcase" which is shorthand for "globals/showcase".The global variables are specified in the settings page of the plugin. On that page "showcase" contains the number of the post-template to embed - "55".</li>
	<li>The <strong>class</strong> of the devices to show. We are overriding "class" which is defined as a custom variable for post 55.</li>
	<li>The <strong>brand</strong> of the devices to show. We are overriding "brand" which is defined as a custom variable  for post 55.</li>
</ul>
<table>
<tbody>
<tr>
<td><div id="showcase"><style>#showcase {position:relative;width:620px;padding:0px;margin:0px;}
.child {height:172px;float:left;width:190px;padding:4px;margin:2px;text-align:left;color:navy;background:white;border:1px solid #4797CB;font-family:arial;font-size:12px;}</style><div class="child">


<div style="height: 44px;"><img style="float: left;" title="3 Store" src="http://three-stores.co.uk/wp-content/themes/iMobile/images/quickpick/3.jpg" alt="3 Store" width="16" height="16" border="0" /><strong><span style="font-family: Arial; color: navy; font-size: 15px;">iPhone 4 16GB Black Refreshed</span></strong></div>
<div style="height: 86px;"><a style="text-decoration: none;" href="" rel="nofollow" target="_blank"><img style="float: right;" title="3 Store iPhone 4 16GB Black Refreshed. 5.0 megapixel camera with LED flash. HD video recording & editing. Glass design for optical quality and scratch resistance. 3.5" high-resolution screen" src="http://three-stores.co.uk/thumb.jpg.php?img=8801466744862.jpg&mw=100&mh=80" alt="" border="0" /></a>- FREE Mobile Phone
- 2000 Minutes
- 5000 Texts
</div>
<div style="height: 38px;">

<span style="color: #00adef;"><strong>Only <span style="background: yellow;">£31</span> a month (x24)</strong></span>
<br />
<div style="background: #F7FFF7; color: #ff7f00; margin: 0px;"><center><a href="" rel="nofollow">More Deals &gt;&gt;</a></center></div>

</div>


</div><div class="child">


<div style="height: 44px;"><img style="float: left;" title="3 Store" src="http://three-stores.co.uk/wp-content/themes/iMobile/images/quickpick/3.jpg" alt="3 Store" width="16" height="16" border="0" /><strong><span style="font-family: Arial; color: navy; font-size: 15px;">iPhone 4 16GB White Refreshed</span></strong></div>
<div style="height: 86px;"><a style="text-decoration: none;" href="" rel="nofollow" target="_blank"><img style="float: right;" title="3 Store iPhone 4 16GB White Refreshed. 5.0 megapixel camera with LED flash. HD video recording & editing. Glass design for optical quality and scratch resistance. 3.5" high-resolution screen" src="http://three-stores.co.uk/thumb.jpg.php?img=8800932495390.jpg&mw=100&mh=80" alt="" border="0" /></a>- FREE Mobile Phone
- 2000 Minutes
- 5000 Texts
</div>
<div style="height: 38px;">

<span style="color: #00adef;"><strong>Only <span style="background: yellow;">£31</span> a month (x24)</strong></span>
<br />
<div style="background: #F7FFF7; color: #ff7f00; margin: 0px;"><center><a href="" rel="nofollow">More Deals &gt;&gt;</a></center></div>

</div>


</div><div class="child">


<div style="height: 44px;"><img style="float: left;" title="3 Store" src="http://three-stores.co.uk/wp-content/themes/iMobile/images/quickpick/3.jpg" alt="3 Store" width="16" height="16" border="0" /><strong><span style="font-family: Arial; color: navy; font-size: 15px;">iPhone 4 8GB Black</span></strong></div>
<div style="height: 86px;"><a style="text-decoration: none;" href="" rel="nofollow" target="_blank"><img style="float: right;" title="3 Store iPhone 4 8GB Black. 5.0 megapixel camera with LED flash. Comes with iOS 5. HD video recording & editing. Glass design for optical quality and scratch resistance. 3.5" high-resolution screen" src="http://three-stores.co.uk/thumb.jpg.php?img=8801466744862.jpg&mw=100&mh=80" alt="" border="0" /></a>- £99 up front
- 2000 Minutes
- 5000 Texts
</div>
<div style="height: 38px;">

<span style="color: #00adef;"><strong>Only <span style="background: yellow;">£30</span> a month (x24)</strong></span>
<br />
<div style="background: #F7FFF7; color: #ff7f00; margin: 0px;"><center><a href="" rel="nofollow">More Deals &gt;&gt;</a></center></div>

</div>


</div><div class="child">


<div style="height: 44px;"><img style="float: left;" title="3 Store" src="http://three-stores.co.uk/wp-content/themes/iMobile/images/quickpick/3.jpg" alt="3 Store" width="16" height="16" border="0" /><strong><span style="font-family: Arial; color: navy; font-size: 15px;">iPhone 4 8GB White</span></strong></div>
<div style="height: 86px;"><a style="text-decoration: none;" href="" rel="nofollow" target="_blank"><img style="float: right;" title="3 Store iPhone 4 8GB White. 5.0 megapixel camera with LED flash. Comes with iOS 5. HD video recording & editing. Glass design for optical quality and scratch resistance. 3.5" high-resolution screen" src="http://three-stores.co.uk/thumb.jpg.php?img=8800932495390.jpg&mw=100&mh=80" alt="" border="0" /></a>- £99 up front
- 2000 Minutes
- 5000 Texts
</div>
<div style="height: 38px;">

<span style="color: #00adef;"><strong>Only <span style="background: yellow;">£30</span> a month (x24)</strong></span>
<br />
<div style="background: #F7FFF7; color: #ff7f00; margin: 0px;"><center><a href="" rel="nofollow">More Deals &gt;&gt;</a></center></div>

</div>


</div></div></td>
</tr>
</tbody>
</table>
<h3>What's Inside the "Showcase" Post-Template?</h3>
The "showcase" post-template has four custom variables; <span style="color: #ff00ff;">style</span> (a style sheet), <span style="color: #ff00ff;">devices</span> (main xml data), <span style="color: #ff00ff;">class</span> (device class) and<span style="color: #ff00ff;"> brand</span> (device brand). The post-template is defined as follows (html or text view):
<div style="display: block; background: #DFDFDF; font-family: courier;">{rewrite}</div>
<div style="display: block; background: #DFDFDF; font-family: courier;">  [<span style="color: #ff00ff;">style</span>]</div>
<div style="display: block; background: #DFDFDF; font-family: courier;">  {<span style="color: #ff0000;">rewrite:device</span> <span style="color: #ff00ff;">devices</span>/device[@class<span style="color: #000000;">='{[<span style="color: #ff00ff;">class</span>]}'</span> and @bran<span style="color: #000000;">d='{[<span style="color: #ff00ff;">brand</span>]}']</span>}</div>
<div style="display: block; background: #DFDFDF; font-family: courier;">    {<span style="color: #ff0000;">rewrite:variant</span> device/variants/variant}</div>
<div style="display: block; background: #DFDFDF; font-family: courier;">      {<span style="color: #ff0000;">rewrite:deal</span> device/deals/deal[1]}</div>
<div style="display: block; background: #DFDFDF; font-family: courier;"><span style="color: #ff6600;">         [call(@dealpost,lines[deal],</span></div>
<div style="display: block; background: #DFDFDF; font-family: courier;"><span style="color: #ff6600;">               monthly[deal/@monthly],</span></div>
<div style="display: block; background: #DFDFDF; font-family: courier;"><span style="color: #ff6600;">               cost[deal/@cost], </span></div>
<div style="display: block; background: #DFDFDF; font-family: courier;"><span style="color: #ff6600;">               months[deal/@months],</span></div>
<div style="display: block; background: #DFDFDF; font-family: courier;"><span style="color: #ff6600;">               specs[device/specs],</span></div>
<div style="display: block; background: #DFDFDF; font-family: courier;"><span style="color: #ff6600;">               title[variant],</span></div>
<div style="display: block; background: #DFDFDF; font-family: courier;"><span style="color: #ff6600;">               link[variant/@link],</span></div>
<div style="display: block; background: #DFDFDF; font-family: courier;"><span style="color: #ff6600;">               image[variant/@image])]</span></div>
<div style="display: block; background: #DFDFDF; font-family: courier;">      {/rewrite:deal}</div>
<div style="display: block; background: #DFDFDF; font-family: courier;">    {/rewrite:variant}</div>
<div style="display: block; background: #DFDFDF; font-family: courier;">  {/rewrite:device}</div>
<div style="display: block; background: #DFDFDF; font-family: courier;">{/rewrite}</div>
The code above is relatively easy to understand - if you consider how much it is doing. It contains three nested <span style="color: #ff0000;">rewrite</span> sections which are iterating the accompanying xml data at various levels. Here is what the data looks like (<span style="color: #ff00ff;">devices</span>):

<span style="display: block; color: purple; background: #dfdfdf;">&lt;devices<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;device<span style="color: red;"> class="<span style="color: blue;">Mobile Phone</span>" brand="<span style="color: blue;">Apple</span>" model="<span style="color: blue;">iPhone 4 16GB Refreshed</span>"</span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;specs<span style="color: red;"></span>&gt;<span style="color: black;">5.0 megapixel camera with LED flash. HD video recording &amp;amp; editing. Glass design for optical quality and scratch resistance. 3.5&amp;quot; high-resolution screen</span>&lt;/specs&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;variants<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;variant<span style="color: red;"> link="<span style="color: blue;"></span>" image="<span style="color: blue;">http://three-stores.co.uk/thumb.jpg.php?img=8801466744862.jpg&amp;amp;mw=100&amp;amp;mh=80</span>"</span>&gt;<span style="color: black;">iPhone 4 16GB Black Refreshed</span>&lt;/variant&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;variant<span style="color: red;"> link="<span style="color: blue;"></span>" image="<span style="color: blue;">http://three-stores.co.uk/thumb.jpg.php?img=8800932495390.jpg&amp;amp;mw=100&amp;amp;mh=80</span>"</span>&gt;<span style="color: black;">iPhone 4 16GB White Refreshed</span>&lt;/variant&gt;</span></span>&lt;/variants&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;deals<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;deal<span style="color: red;"> id="<span style="color: blue;">1</span>" cost="<span style="color: blue;">600</span>" monthly="<span style="color: blue;">31</span>" months="<span style="color: blue;">24</span>"</span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;line<span style="color: red;"> type="<span style="color: blue;">upfront</span>" value="<span style="color: blue;">0</span>"</span>&gt;<span style="color: black;">FREE Mobile Phone</span>&lt;/line&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;line<span style="color: red;"> type="<span style="color: blue;">minutes</span>" value="<span style="color: blue;">2000</span>"</span>&gt;<span style="color: black;">2000 Minutes</span>&lt;/line&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;line<span style="color: red;"> type="<span style="color: blue;">texts</span>" value="<span style="color: blue;">5000</span>"</span>&gt;<span style="color: black;">5000 Texts</span>&lt;/line&gt;</span></span>&lt;/deal&gt;</span></span>&lt;/deals&gt;</span></span>&lt;/device&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;device<span style="color: red;"> class="<span style="color: blue;">Mobile Phone</span>" brand="<span style="color: blue;">Apple</span>" model="<span style="color: blue;">iPhone 4 8GB</span>"</span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;specs<span style="color: red;"></span>&gt;<span style="color: black;">5.0 megapixel camera with LED flash. Comes with iOS 5. HD video recording &amp;amp; editing. Glass design for optical quality and scratch resistance. 3.5&amp;quot; high-resolution screen</span>&lt;/specs&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;variants<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;variant<span style="color: red;"> link="<span style="color: blue;"></span>" image="<span style="color: blue;">http://three-stores.co.uk/thumb.jpg.php?img=8801466744862.jpg&amp;amp;mw=100&amp;amp;mh=80</span>"</span>&gt;<span style="color: black;">iPhone 4 8GB Black</span>&lt;/variant&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;variant<span style="color: red;"> link="<span style="color: blue;"></span>" image="<span style="color: blue;">http://three-stores.co.uk/thumb.jpg.php?img=8800932495390.jpg&amp;amp;mw=100&amp;amp;mh=80</span>"</span>&gt;<span style="color: black;">iPhone 4 8GB White</span>&lt;/variant&gt;</span></span>&lt;/variants&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;deals<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;deal<span style="color: red;"> id="<span style="color: blue;">2</span>" cost="<span style="color: blue;">819</span>" brand="<span style="color: blue;">Apple</span>" model="<span style="color: blue;">iPhone 4 8GB</span>" monthly="<span style="color: blue;">30</span>" months="<span style="color: blue;">24</span>"</span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;line<span style="color: red;"> type="<span style="color: blue;">upfront</span>" value="<span style="color: blue;">99</span>"</span>&gt;<span style="color: black;">£99 up front</span>&lt;/line&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;line<span style="color: red;"> type="<span style="color: blue;">minutes</span>" value="<span style="color: blue;">2000</span>"</span>&gt;<span style="color: black;">2000 Minutes</span>&lt;/line&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: #dfdfdf;">&lt;line<span style="color: red;"> type="<span style="color: blue;">texts</span>" value="<span style="color: blue;">5000</span>"</span>&gt;<span style="color: black;">5000 Texts</span>&lt;/line&gt;</span></span>&lt;/deal&gt;</span></span>&lt;/deals&gt;</span></span>&lt;/device&gt;</span></span>&lt;/devices&gt;</span>

Here is the style sheet (<span style="color: #ff00ff;">style</span>):

<span style="display: block; background: #DFDFDF; font-family: courier;">

&lt;style&gt;
#showcase {position:relative;width:620px;padding:0px;margin:0px;}
.child {height:172px;float:left;width:190px;padding:4px;margin:2px;text-align:left;color:navy;background:white;border:1px solid #4797CB;font-family:arial;font-size:12px;}
&lt;/style&gt;

</span>
<h3>The "DealPost" Post-Template (Individual Deal Boxes)</h3>
<div style="background: #dfdfdf"><p style="font-family:courier;font-size:12px">&lt;div class=&quot;child&quot;&gt;

{rewrite}
&lt;div style=&quot;height: 44px;&quot;&gt;&lt;img style=&quot;float: left;&quot; title=&quot;3 Store&quot; src=&quot;http://three-stores.co.uk/wp-content/themes/iMobile/images/quickpick/3.jpg&quot; alt=&quot;3 Store&quot; width=&quot;16&quot; height=&quot;16&quot; border=&quot;0&quot; /&gt;&lt;strong&gt;&lt;span style=&quot;font-family: Arial; color: navy; font-size: 15px;&quot;&gt;[title]&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;height: 86px;&quot;&gt;&lt;a style=&quot;text-decoration: none;&quot; href=&quot;[link]&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: right;&quot; title=&quot;3 Store [title]. [specs]&quot; src=&quot;[image]&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;{rewrite:line lines/line}- [line]
{/rewrite:line}&lt;/div&gt;
&lt;div style=&quot;height: 38px;&quot;&gt;

&lt;span style=&quot;color: #00adef;&quot;&gt;&lt;strong&gt;Only &lt;span style=&quot;background: yellow;&quot;&gt;£[monthly]&lt;/span&gt; a month (x[months])&lt;/strong&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #F7FFF7; color: #ff7f00; margin: 0px;&quot;&gt;&lt;center&gt;&lt;a href=&quot;[link]&quot; rel=&quot;nofollow&quot;&gt;More Deals &amp;gt;&amp;gt;&lt;/a&gt;&lt;/center&gt;&lt;/div&gt;

&lt;/div&gt;
{/rewrite}

&lt;/div&gt;</p></div><p>The best way to work with template designs in Wordpress' would be a combination of visual and html modes. You can also use an external html editor to design your deal box and then copy the html into your post in html mode.</p>

The "dealpost" post-template has the following custom variables:
<ul>
	<li>"image" - A link to the image to display.</li>
	<li>"lines" - The lines to display in the deal box.</li>
	<li>"link" - A link to the deal.</li>
	<li>"title" - The title of the deal.</li>
	<li>"monthly" - The monthly amount to pay.</li>
	<li>"months" - The number of months to pay.</li>
	<li>"specs" - The device's specifications.</li>
</ul>

<h2>Complete Syntax and Usage</h2>
The following definitions will give a clear understanding of the information that follows:
<ul>
	<li><strong>Definitions</strong></li>
<ul>
	<li><em>source text</em> - Text that may include embedded <em>template tag</em>s.</li>
	<li><em>variable</em> - The name of a variable and optional xpath suffix.</li>
	<li><em>expression</em> - Can be one of the following:</li>
<ul>
	<li>a variable - e.g. "model"</li>
	<li>a number - e.g. "123"</li>
	<li>a method - e.g. "call(<em>expression</em>/<em>assignment</em>,<em>assignment</em>,...)"</li>
	<li>source text surrounded by "{" and "}"- e.g. "{Hello World}"</li>
</ul>
	<li><em>template tag</em> - Mostly [<em>expression</em>] but can also be {<em>source text</em>} or [<em>assignment</em>] (no output)</li>
	<li><em>assignment</em> - A <em>variable</em> followed by <em>template tag</em> - e.g. <em>variable</em>[<em>expression</em>] or <em>variable</em>{<em>source text</em>}</li>
</ul>
</ul>
Plugin directives are embedded in posts (the <em>source text</em>) in the same way you would create a normal post/page consisting only of text. Refer to the definition of <em>template tag</em> above - that's what you will be adding into your post. However the plugin will do nothing with that tag if you either did not activate the plugin or you forgot to surround the post or post section with {rewrite} and {/rewrite} tags.
<h3>{Rewrite} Directives</h3>
Everything between the {rewrite} and {/rewrite} directives is rewritten by the plugin, but a {rewrite} directive can also specify which portion of an xml document it is rendering when using the extended syntax {rewrite:var2 var1:xpath} for which the corresponding end-tag is {/rewrite:var2}. This indicates to the plugin that you want to iterate all the node identified by xpath, assuming var1 contains the xml document that you loaded previously. For each node found (var2) the template repeats the template replacements found between the two rewrite:var2 tags. See how this works in the examples above.
<h3>Pre-Defined Methods Available</h3>
The following methods are available which deal with posts:
<ul>
	<li><strong>postraw(<em>expression</em>)</strong> -  The raw post content of the post identified by expression (post id) is returned.</li>
	<li><strong>rewrite(<em>expression, assignment, assignment</em>, ...)</strong> - The (result of) <em>expression</em> is rewritten using the inputs.</li>
	<li><strong>call(expression, assignment, assignment, ...)</strong> - The post identified by <em>expression</em> is rewritten using the inputs.</li>
</ul>
The following additionals methods are available:
<ul>
	<li><strong>ucwords(<em>expression</em>) - </strong>Upper cases the first letter of every word in a string.<strong>
</strong></li>
	<li><strong>ucfirst(<em>expression</em>) </strong>- Upper cases the first letter of a string.<strong>
</strong></li>
	<li><strong>setcookies(<em>expression, assignment</em>, ...) - </strong>Sets cookies according to assignments. Expression is the expiry (ms).<strong>
</strong></li>
	<li><strong>loadxml(<em>expression</em>) - </strong>Loads XML from file/url/string. Assumed to be string if starts with "&lt;".<strong></strong></li>
	<li><strong>savexml(<em>expression[, file]</em>) - </strong>Outputs  expression as xml text<strong>. </strong>Optional file{<em>filename</em>} or file[<em>expression</em>] parameter.<strong>
</strong></li>
	<li><strong>loadcsv(<em>expression</em>) - </strong>Similar to "loadxml" but makes csv rows and column into xml &lt;row&gt; and &lt;col&gt; elements.<strong>
</strong></li>
	<li><strong>replace(<em>expression,search,replace</em>) - </strong>Searches <em>expression</em> for <em>search</em> expr and replaces it with <em>replace</em> expr.<strong></strong></li>
</ul>
<h3>Pre-defined Global Values</h3>
The following variables deal with variables on the plugin settings page, cookies, request and referrer arguments
<ul>
	<li><strong>globals</strong> - This is an XML variable that can be used with an xpath suffix. It contains:</li>
<ul>
	<li>All the variables defined on the plugins settings page (accessible as "globals/<em>variable</em>" or "@<em>variable</em>")</li>
	<li><strong>@request - </strong>The page arguments - e.g. for "?x=1", @request/@x would return "1".</li>
	<li><strong>@referrer - </strong>The referrer arguments - e.g. for "?q=mobile", @referrer/@q would return "mobile".</li>
	<li><strong>@cookies - </strong>The http cookies as elements - e.g. "@cookies/tid" gives the value of cookie named "tid".</li>
</ul>
</ul>
The following variables are provided for convenience. They have higher precedence than the preceding global variables:
<ul>
	<li><strong>@single</strong> = Has a value of "1" for single-post pages and "0" otherwise - e.g. "0"</li>
	<li><strong>@url</strong> - The page URL (permalink) - e.g. "http://www.wpgallery.co.uk/wordpress-post-template/?"</li>
	<li><strong>@ip</strong> - The client's IP address - e.g. "54.224.79.93"</li>
	<li><strong>@cbip</strong> - IP address with "." replaced with "o" - e.g. "54o224o79o93"</li>
	<li><strong>@id</strong> - The post's id - e.g. "4"</li>
</ul>
The following pre-defined variables deal with "escaping" issues:
<ul>
	<li><strong>lcrl</strong> = "{"</li>
	<li><strong>rcrl</strong> = "}"</li>
	<li><strong>lsqb</strong> = "["</li>
	<li><strong>rsqb</strong> = "]"</li>
	<li><strong>pipe</strong> = "|"</li>
	<li><strong>amps</strong> = "&amp;"</li>
</ul>
<h3>User-Defined Variables and Functions</h3>
You can define your own PHP function for use in the templates. Simply add a file called 'xmlt-custom.php' to the plugin's folder. Here is a simple example of what would go in the file:
<div style="background: #dfdfdf;">
<pre>&lt;?php

function xml_template_myfunc(&amp;$vars)
{
  return "This is what myfunc is returning";
}

function xml_template_customfunctions(&amp;$vars)
{
  $vars['myvar'] = "This is the value of myvar";
  $vars['myfunc()'] = "xml_template_myfunc";
}
?&gt;</pre>
</div>
Look for other examples of function definitions at the bottom of the 'xmlt-rewrite.php' file.

<a name="install"></a>
<h2><span style="color: #000000;">How do I install the Wordpress Post-Template plugin?</span></h2>
<ol>
	<li><span style="color: #000000;">Unzip the zip file into your Wordpress ".../wp-content/plugins" folder.</span></li>
	<li><span style="color: #000000;">"Activate" the plugin on the dashboard "Plugins" page.</span></li>
</ol>
<span style="color: #000000;">That's about it for now. Leave a comment if you need assistance.</span>

<span style="color: #000000;"><strong>Enjoy playing and working with this plugin!</strong></span>

</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wpgallery.co.uk/wp-xml-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Search</title>
		<link>http://www.wpgallery.co.uk/google-search/</link>
		<comments>http://www.wpgallery.co.uk/google-search/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 09:43:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.wpgallery.co.uk/?p=731</guid>
		<description><![CDATA[Powered by &#60;request&#62;&#60;/request&#62;]]></description>
			<content:encoded><![CDATA[<p>Powered by <img src="http://www.google.com/uds/css/small-logo.png" class="gsc-branding-img"><br />
<br />
<span style="display: block; color: purple; background: lightgray;">&lt;request<span style="color: red;"></span>&gt;<span style="color: black;"></span>&lt;/request&gt;</span><br />
</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wpgallery.co.uk/google-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XML Beautifier &#8211; Online &#8220;Pretty XML&#8221; Converter</title>
		<link>http://www.wpgallery.co.uk/xml-beautifier/</link>
		<comments>http://www.wpgallery.co.uk/xml-beautifier/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 07:07:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[wp xml template]]></category>

		<guid isPermaLink="false">http://www.wpgallery.co.uk/?p=494</guid>
		<description><![CDATA[This "XML Beautifier" takes an XML file and formats it online to produces a beautified version on-the-fly in your WordPress blog. This is an example of using the WP XML Template plug in to produce indented and syntax highlighted XML that can be embedded in your posts or pages. The template can be defined using [...]]]></description>
			<content:encoded><![CDATA[<p>This "XML Beautifier" takes an XML file and formats it online to produces a beautified version on-the-fly in your WordPress blog.</p>
<p>This is an example of using the WP XML Template plug in to produce indented and syntax highlighted XML that can be embedded in your posts or pages. The template can be defined using the following recursive markup:</p>
<p><span style="background:#dfdfdf">{rewrite}&lt;span style=&quot;display: block; color: purple; background: [background];&quot;&gt;&amp;lt;[name(xml)]&lt;span style=&quot;color: red;&quot;&gt;{rewrite:attr xml/@*} [name(attr)]=&quot;&lt;span style=&quot;color: blue;&quot;&gt;[htmlencode(xmlencode(attr))]&lt;/span&gt;&quot;{/rewrite:attr}&lt;/span&gt;&amp;gt;&lt;span style=&quot;color: black;&quot;&gt;[htmlencode(xmlencode(xml))]&lt;/span&gt;{rewrite:tag xml/*}&lt;span style=&quot;display: block; margin-left: 20px;&quot;&gt;[call(@id,xml[tag],background[background])]&lt;/span&gt;{/rewrite:tag}&amp;lt;/[name(xml)]&amp;gt;&lt;/span&gt;{/rewrite}</span></p>
<p>which in visual mode will look like this:</p>
<p><span style="background:#dfdfdf">{rewrite}<span style="display: block; color: purple; background: [background];">&lt;[name(xml)]<span style="color: red;">{rewrite:attr xml/@*} [name(attr)]="<span style="color: blue;">[htmlencode(xmlencode(attr))]</span>"{/rewrite:attr}</span>&gt;<span style="color: black;">[htmlencode(xmlencode(xml))]</span>{rewrite:tag xml/*}<span style="display: block; margin-left: 20px;">[call(@id,xml[tag],background[background])]</span>{/rewrite:tag}&lt;/[name(xml)]&gt;</span>{/rewrite}</span></p>
<p>and this is how you embed it:</p>
<p><span style="background:#dfdfdf">{rewrite}[call(@prettyxml, background{lightgray}, xml[loadxml({../uploads/file.xml})])]{/rewrite}</span></p>
<p>and this is what it produces:</p>
<p><span style="display: block; color: purple; background: lightgray;">&lt;devices<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;device<span style="color: red;"> class="<span style="color: blue;">Mobile Phone</span>" brand="<span style="color: blue;">Apple</span>" model="<span style="color: blue;">iPhone 4 16GB Refreshed</span>"</span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;specs<span style="color: red;"></span>&gt;<span style="color: black;">5.0 megapixel camera with LED flash. HD video recording &amp;amp; editing. Glass design for optical quality and scratch resistance. 3.5&amp;quot; high-resolution screen</span>&lt;/specs&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;variants<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;variant<span style="color: red;"> link="<span style="color: blue;"></span>" image="<span style="color: blue;">http://three-stores.co.uk/thumb.jpg.php?img=8801466744862.jpg&amp;amp;mw=100&amp;amp;mh=80</span>"</span>&gt;<span style="color: black;">iPhone 4 16GB Black Refreshed</span>&lt;/variant&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;variant<span style="color: red;"> link="<span style="color: blue;"></span>" image="<span style="color: blue;">http://three-stores.co.uk/thumb.jpg.php?img=8800932495390.jpg&amp;amp;mw=100&amp;amp;mh=80</span>"</span>&gt;<span style="color: black;">iPhone 4 16GB White Refreshed</span>&lt;/variant&gt;</span></span>&lt;/variants&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;deals<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;deal<span style="color: red;"> id="<span style="color: blue;">1</span>" cost="<span style="color: blue;">600</span>" monthly="<span style="color: blue;">31</span>" months="<span style="color: blue;">24</span>"</span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;line<span style="color: red;"> type="<span style="color: blue;">upfront</span>" value="<span style="color: blue;">0</span>"</span>&gt;<span style="color: black;">FREE Mobile Phone</span>&lt;/line&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;line<span style="color: red;"> type="<span style="color: blue;">minutes</span>" value="<span style="color: blue;">2000</span>"</span>&gt;<span style="color: black;">2000 Minutes</span>&lt;/line&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;line<span style="color: red;"> type="<span style="color: blue;">texts</span>" value="<span style="color: blue;">5000</span>"</span>&gt;<span style="color: black;">5000 Texts</span>&lt;/line&gt;</span></span>&lt;/deal&gt;</span></span>&lt;/deals&gt;</span></span>&lt;/device&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;device<span style="color: red;"> class="<span style="color: blue;">Mobile Phone</span>" brand="<span style="color: blue;">Apple</span>" model="<span style="color: blue;">iPhone 4 8GB</span>"</span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;specs<span style="color: red;"></span>&gt;<span style="color: black;">5.0 megapixel camera with LED flash. Comes with iOS 5. HD video recording &amp;amp; editing. Glass design for optical quality and scratch resistance. 3.5&amp;quot; high-resolution screen</span>&lt;/specs&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;variants<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;variant<span style="color: red;"> link="<span style="color: blue;"></span>" image="<span style="color: blue;">http://three-stores.co.uk/thumb.jpg.php?img=8801466744862.jpg&amp;amp;mw=100&amp;amp;mh=80</span>"</span>&gt;<span style="color: black;">iPhone 4 8GB Black</span>&lt;/variant&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;variant<span style="color: red;"> link="<span style="color: blue;"></span>" image="<span style="color: blue;">http://three-stores.co.uk/thumb.jpg.php?img=8800932495390.jpg&amp;amp;mw=100&amp;amp;mh=80</span>"</span>&gt;<span style="color: black;">iPhone 4 8GB White</span>&lt;/variant&gt;</span></span>&lt;/variants&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;deals<span style="color: red;"></span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;deal<span style="color: red;"> id="<span style="color: blue;">2</span>" cost="<span style="color: blue;">819</span>" brand="<span style="color: blue;">Apple</span>" model="<span style="color: blue;">iPhone 4 8GB</span>" monthly="<span style="color: blue;">30</span>" months="<span style="color: blue;">24</span>"</span>&gt;<span style="color: black;"></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;line<span style="color: red;"> type="<span style="color: blue;">upfront</span>" value="<span style="color: blue;">99</span>"</span>&gt;<span style="color: black;">£99 up front</span>&lt;/line&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;line<span style="color: red;"> type="<span style="color: blue;">minutes</span>" value="<span style="color: blue;">2000</span>"</span>&gt;<span style="color: black;">2000 Minutes</span>&lt;/line&gt;</span></span><span style="display: block; margin-left: 20px;"><span style="display: block; color: purple; background: lightgray;">&lt;line<span style="color: red;"> type="<span style="color: blue;">texts</span>" value="<span style="color: blue;">5000</span>"</span>&gt;<span style="color: black;">5000 Texts</span>&lt;/line&gt;</span></span>&lt;/deal&gt;</span></span>&lt;/deals&gt;</span></span>&lt;/device&gt;</span></span>&lt;/devices&gt;</span></p>
<p>In this case "prettyxml" is defined as a global variable on the plugin's settings page and it contains the post number of the template. "background" is defined as a custom variable on the template post itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wpgallery.co.uk/xml-beautifier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
