<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Using Template Toolkit with Squatting</title>
	<atom:link href="http://transfixedbutnotdead.com/2008/10/21/using-template-toolkit-with-squatting/feed/" rel="self" type="application/rss+xml" />
	<link>http://transfixedbutnotdead.com/2008/10/21/using-template-toolkit-with-squatting/</link>
	<description>my ramblings on life, work &#38; anything left in-between</description>
	<lastBuildDate>Sat, 11 Feb 2012 02:28:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: CSS views in Squatting &#171; transfixed but not dead!</title>
		<link>http://transfixedbutnotdead.com/2008/10/21/using-template-toolkit-with-squatting/#comment-504</link>
		<dc:creator><![CDATA[CSS views in Squatting &#171; transfixed but not dead!]]></dc:creator>
		<pubDate>Tue, 23 Dec 2008 16:59:20 +0000</pubDate>
		<guid isPermaLink="false">http://draegtun.wordpress.com/?p=45#comment-504</guid>
		<description><![CDATA[[...] Using Template Toolkit With Squatting  Possibly related posts: (automatically generated)Css and Html!Creating a Joomla! Template :: Quick TutorialCSS to Do Anything !! [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Using Template Toolkit With Squatting  Possibly related posts: (automatically generated)Css and Html!Creating a Joomla! Template :: Quick TutorialCSS to Do Anything !! [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: draegtun</title>
		<link>http://transfixedbutnotdead.com/2008/10/21/using-template-toolkit-with-squatting/#comment-493</link>
		<dc:creator><![CDATA[draegtun]]></dc:creator>
		<pubDate>Tue, 04 Nov 2008 12:16:45 +0000</pubDate>
		<guid isPermaLink="false">http://draegtun.wordpress.com/?p=45#comment-493</guid>
		<description><![CDATA[Update to above comment.   

After &lt;a href=&quot;http://groups.google.co.uk/group/squatting-framework/browse_thread/thread/c8f398e63d3baa32/cdcbeecfefcd1c04#cdcbeecfefcd1c04&quot; rel=&quot;nofollow&quot;&gt;chatting&lt;/a&gt; with Beppu this is the expected behaviour from Squatting and this keeps it in line with what Camping does when you request a view prefixed with a _

So u can still use above &quot;fix&quot;.  Alternatively just rename your template to be prefixed with a _

/I3az/]]></description>
		<content:encoded><![CDATA[<p>Update to above comment.   </p>
<p>After <a href="http://groups.google.co.uk/group/squatting-framework/browse_thread/thread/c8f398e63d3baa32/cdcbeecfefcd1c04#cdcbeecfefcd1c04" rel="nofollow">chatting</a> with Beppu this is the expected behaviour from Squatting and this keeps it in line with what Camping does when you request a view prefixed with a _</p>
<p>So u can still use above &#8220;fix&#8221;.  Alternatively just rename your template to be prefixed with a _</p>
<p>/I3az/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: draegtun</title>
		<link>http://transfixedbutnotdead.com/2008/10/21/using-template-toolkit-with-squatting/#comment-492</link>
		<dc:creator><![CDATA[draegtun]]></dc:creator>
		<pubDate>Sat, 01 Nov 2008 19:04:19 +0000</pubDate>
		<guid isPermaLink="false">http://draegtun.wordpress.com/?p=45#comment-492</guid>
		<description><![CDATA[In Squatting when you render a view prefixed with a  &quot;_&quot; ( for eg. &lt;code&gt;$self-&gt;render( &#039;_page&#039; );&lt;/code&gt; ) then this will call the template without using the &lt;code&gt;layout&lt;/code&gt; view.

Unfortunately my TT code above doesn&#039;t cope with the fact that &lt;code&gt;$self-&gt;{template}&lt;/code&gt; would be prefixed with the &quot;_&quot; ;-(

Below is a fixed App::Views....
[sourcecode language=&quot;perl&quot;]
package App::Views;
use Squatting &#039;:views&#039;;
use Template;

our @V = (

    V(
        &#039;html&#039;,
        tt =&gt; Template-&gt;new( $App::CONFIG{ TT }-&gt;{ config } ),

        layout =&gt; sub {
            my ( $self, $v, $body ) = @_;
            my $tt = $self-&gt;{ tt };
            $v-&gt;{ site_tit } = $App::CONFIG{ TT }-&gt;{ site_tit };
            $v-&gt;{ body     } = $body;
            
            $tt-&gt;process( &#039;layout&#039;. $App::CONFIG{ TT }-&gt;{ postfix }, $v, \my $output)
                or return view_error( $tt-&gt;error );
            return $output;
        },

        _ =&gt; sub {
            my ( $self, $v ) = @_;
            my $tt = $self-&gt;{ tt };
            $v-&gt;{ R } = \&amp;R;
            
            $tt-&gt;process( 
                tt_template( $self-&gt;{template} ) . $App::CONFIG{ TT }-&gt;{ postfix }, 
                $v, \my $output) 
                or return view_error( $tt-&gt;error );
            return $output;
        }

    ),
);

sub view_error {
    my ( $error ) = shift;
    warn $error;
    return &quot;&lt;pre&gt;&quot; . $error . &quot;&lt;/pre&gt;\n&quot;;   # really need to HTML encode $error here
}

sub tt_template { 
    my $template = shift;
    $template =~ s/^_//;
    return $template;
}
[/sourcecode]

Thats better ;-)

/I3az/]]></description>
		<content:encoded><![CDATA[<p>In Squatting when you render a view prefixed with a  &#8220;_&#8221; ( for eg. <code>$self-&gt;render( '_page' );</code> ) then this will call the template without using the <code>layout</code> view.</p>
<p>Unfortunately my TT code above doesn&#8217;t cope with the fact that <code>$self-&gt;{template}</code> would be prefixed with the &#8220;_&#8221; ;-(</p>
<p>Below is a fixed App::Views&#8230;.</p>
<pre class="brush: perl;">
package App::Views;
use Squatting ':views';
use Template;

our @V = (

    V(
        'html',
        tt =&gt; Template-&gt;new( $App::CONFIG{ TT }-&gt;{ config } ),

        layout =&gt; sub {
            my ( $self, $v, $body ) = @_;
            my $tt = $self-&gt;{ tt };
            $v-&gt;{ site_tit } = $App::CONFIG{ TT }-&gt;{ site_tit };
            $v-&gt;{ body     } = $body;

            $tt-&gt;process( 'layout'. $App::CONFIG{ TT }-&gt;{ postfix }, $v, \my $output)
                or return view_error( $tt-&gt;error );
            return $output;
        },

        _ =&gt; sub {
            my ( $self, $v ) = @_;
            my $tt = $self-&gt;{ tt };
            $v-&gt;{ R } = \&amp;R;

            $tt-&gt;process(
                tt_template( $self-&gt;{template} ) . $App::CONFIG{ TT }-&gt;{ postfix },
                $v, \my $output)
                or return view_error( $tt-&gt;error );
            return $output;
        }

    ),
);

sub view_error {
    my ( $error ) = shift;
    warn $error;
    return &quot;&lt;pre&gt;&quot; . $error . &quot;&lt;/pre&gt;\n&quot;;   # really need to HTML encode $error here
}

sub tt_template {
    my $template = shift;
    $template =~ s/^_//;
    return $template;
}
</pre>
<p>Thats better <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>/I3az/</p>
]]></content:encoded>
	</item>
</channel>
</rss>

