<?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>Kerkness.ca &#187; kerkness</title>
	<atom:link href="http://www.kerkness.ca/tagged/kerkness/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kerkness.ca</link>
	<description>flexing my kerkness, among other things</description>
	<lastBuildDate>Wed, 14 Oct 2009 15:12:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP and Flex with Kerkness and Claire</title>
		<link>http://www.kerkness.ca/php-and-flex-with-kerkness-and-claire/</link>
		<comments>http://www.kerkness.ca/php-and-flex-with-kerkness-and-claire/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 05:24:38 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[claire]]></category>
		<category><![CDATA[kerkness]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=311</guid>
		<description><![CDATA[The following example shows a simple Flex application using Claire that communicates with a PHP server running Kerkness.
Click here to view the demo application
Click here to view the demo source
The demo application starts out by displaying a form which has 2 input fields.  When submitted the value of the form is submitted to the PHP [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows a simple Flex application using <a href="http://www.kerkness.ca/?page_id=97">Claire</a> that communicates with a PHP server running <a href="http://www.kerkness.ca/?page_id=95">Kerkness</a>.</p>
<p><a href="http://kerkness.ca/flexexamples/ClaireKerkness/ClaireKerkness.html">Click here to view the demo application</a></p>
<p><a href="http://kerkness.ca/flexexamples/ClaireKerkness/srcview/index.html">Click here to view the demo source</a></p>
<p>The demo application starts out by displaying a form which has 2 input fields.  When submitted the value of the form is submitted to the PHP service which validates the submission and returns a response.  If there are no errors the results are displayed.</p>
<h3>ClaireKerkness.mxml</h3>
<p>The main application MXML file contains the ViewController and a ViewStack with both our FormView and ResultView as children. When the view controller dispatches the mainViewChange event a handler function changes the displayed view.</p>
<h3>model/Views.as</h3>
<p>This is a very simple Actionscript class which defines a couple of static constants to use as the names for our two views.</p>
<h3>model/NameModel.as</h3>
<p>A simple Actionscript class which we use as a data model.  When a response is returned we update this model.</p>
<blockquote><p>NOTE: In this example our NameModel is a Singleton Class because we only want one instance.  This doesn&#8217;t have to be the case. You might want to create many instances of a data model if you expect many records of similar data.</p></blockquote>
<h3>views/FormView.mxml</h3>
<p>FormView is an MXML component that contains a couple of form elements and a ClaireService component which is used to send a HTTPService request to the Kerkness backend. If an error is returned the error message is displayed.  If a response is returned we update the NameModel and change the currentView to our ResultView.</p>
<h3>views/ResultView.mxml</h3>
<p>ResultView is a simple MXML component which displays content from the NameModel.</p>
<h3>kerk/module/demo/submitform.php</h3>
<p>This is the PHP file which accepts our form submission. Check out the kerkness tutorials for details on how the <a href="http://www.kerkness.ca/?page_id=95">kerkness</a> framework handles requests.</p>
<p>PHP Source Code</p>
<pre name="code" class="php">

if( ! $_POST['firstname'] || ! $_POST['lastname'] )
{
 	$kerk->throwError('Incomplete Submission...', true );
}

$fullName = $_POST['firstname']. ' ' .$_POST['lastname'];

$kerk->addContent('fullName', $fullName); 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/php-and-flex-with-kerkness-and-claire/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating your first JSON service request</title>
		<link>http://www.kerkness.ca/creating-your-first-json-service-request/</link>
		<comments>http://www.kerkness.ca/creating-your-first-json-service-request/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 19:31:18 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[kerkness]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=240</guid>
		<description><![CDATA[
In this example we are going to create a web service which returns a JSON formatted string. This request could be called from almost any type of AJAX or Javascrpt HTTP Request which expects a JSON formatted response.
Test the example: http://kerkness.ca/kerkdemo/hello.world
Example 1
Create the directory kerk/modules/hello/
Inside the &#8216;hello&#8217; directory create the file &#8216;world.php&#8217; and add the [...]]]></description>
			<content:encoded><![CDATA[<div id="page-content">
<p>In this example we are going to create a web service which returns a JSON formatted string. This request could be called from almost any type of AJAX or Javascrpt HTTP Request which expects a JSON formatted response.</p>
<p>Test the example: <a onclick="window.open(this.href, '_blank'); return false;" href="http://kerkness.ca/kerkdemo/hello.world">http://kerkness.ca/kerkdemo/hello.world</a></p>
<h2 id="toc0"><span>Example 1</span></h2>
<p>Create the directory kerk/modules/hello/</p>
<p>Inside the &#8216;hello&#8217; directory create the file &#8216;world.php&#8217; and add the following to it.</p>
<div class="code">
<pre><code>&lt;?php
    $kerk-&gt;addContent('myvar', 'Hello World');
?&gt;</code></pre>
</div>
<p>Now you can make a request for this service by calling <a href="http://kerkness.ca/kerkdemo/hello.world">http://kerkness.ca/kerkdemo/hello.world</a> and see the following response</p>
<div class="code">
<pre><code>{"content":{"myvar":"Hello World"}}</code></pre>
</div>
<h2 id="toc1"><span>Next</span></h2>
<p><a href="http://www.kerkness.ca/?p=243">Creating your first HTML service request</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/creating-your-first-json-service-request/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a web page from multiple requests or content blocks</title>
		<link>http://www.kerkness.ca/creating-a-web-page-from-multiple-requests-or-content-blocks/</link>
		<comments>http://www.kerkness.ca/creating-a-web-page-from-multiple-requests-or-content-blocks/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 19:18:45 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[kerkness]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=248</guid>
		<description><![CDATA[In this example we are going to create a web page that uses a theme as well as several dynamic content blocks. The page theme will include a dynamic navigation menu and the main body of the page will include a random quote content block.
Test this example: http://kerkness.ca/kerkdemo/example.home
Example 4
If you haven&#8217;t done so already check [...]]]></description>
			<content:encoded><![CDATA[<p>In this example we are going to create a web page that uses a theme as well as several dynamic content blocks. The page theme will include a dynamic navigation menu and the main body of the page will include a random quote content block.</p>
<p>Test this example: <a onclick="window.open(this.href, '_blank'); return false;" href="http://kerkness.ca/kerkdemo/example.home">http://kerkness.ca/kerkdemo/example.home</a></p>
<h2 id="toc0"><span>Example 4</span></h2>
<p>If you haven&#8217;t done so already check out <a href="http://www.kerkness.ca/?p=240">Example 1</a>, <a href="http://www.kerkness.ca/?p=243">Example 2</a> and <a href="http://www.kerkness.ca/?p=248">Example 3</a>.</p>
<h2 id="toc1"><span>Create folders and files</span></h2>
<p>Create the following folders. <em>kerk/modules/example</em> and <em>kerk/templates/example</em></p>
<p>Inside the <em>kerk/modules/example</em> folder create the files &#8216;<em>home.php</em>&#8216;, &#8216;<em>quote.php</em>&#8216;, &#8216;<em>nav.php</em>&#8216; and &#8216;<em>theme.php</em>&#8216;. These will be the scripts that are executed to create the content for our page.</p>
<p>Inside the <em>kerk/templates/example</em> folder create a similar set of files. &#8216;<em>home.php</em>&#8216;, &#8216;<em>quote.php</em>&#8216;, &#8216;<em>nav.php</em>&#8216; and &#8216;<em>theme.php</em>&#8216;. These files will be the templates used to format the content from our scripts.</p>
<h3 id="toc2"><span>kerk/modules/example/home.php</span></h3>
<div class="code">
<pre><code>&lt;?php
  $kerk-&gt;setResponseFormat('HTML');
  $kerk-&gt;setTheme('example.theme');
  $kerk-&gt;addRequest('example.quote');
?&gt;</code></pre>
</div>
<h3 id="toc3"><span>kerk/modules/example/theme.php</span></h3>
<div class="code">
<pre><code>&lt;?php
   $kerk-&gt;addRequest('example.nav');
?&gt;</code></pre>
</div>
<h3 id="toc4"><span>kerk/modules/example/nav.php</span></h3>
<div class="code">
<pre><code>&lt;?php
    $links[] = array('url'=&gt;'http://www.google.ca', 'name'=&gt;'Google');
    $links[] = array('url'=&gt;'http://kerkness.blogspot.com', 'name'=&gt;'Blog');
    $links[] = array('url'=&gt;'http://kerkness.wikidot.com', 'name'=&gt;'Wiki');

    $kerk-&gt;addContent('links', $links);
?&gt;</code></pre>
</div>
<h3 id="toc5"><span>kerk/modules/example/quote.php</span></h3>
<div class="code">
<pre><code>&lt;?php
  $quotes = array(
        'You are your shadow and your shadow is you.',
        'I am a banana!',
        'I would love a banana!',
        'How much is that banana!',
        'My banana is yellow!',
        'habba banana!',
        'Looks like a banana!',
        'Smells like a banana!',
        'Tastes like a banana!',
        'I am not a banana');
  $quote = $quotes[array_rand($quotes)];
  $kerk-&gt;addContent( 'quote', $quote );
?&gt;</code></pre>
</div>
<h3 id="toc6"><span>kerk/templates/example/home.php</span></h3>
<div class="code">
<pre><code>&lt;div align="left"&gt;
   This is my home page and here is some non-dynamic content.
&lt;/div&gt;
&lt;div style="background-color:#CCCCCC"&gt;
   [include:public.example.quote]
&lt;/div&gt;</code></pre>
</div>
<h3 id="toc7"><span>kerk/templates/example/theme.php</span></h3>
<div class="code">
<pre><code>&lt;html&gt;
  &lt;body&gt;
     &lt;h1&gt;This is my web page&lt;/h1&gt;
     [include:public.example.nav]
     &lt;div bgcolor="blue"&gt;
    [include:main_request]
     &lt;/div&gt;
     &lt;h5&gt;This is my page footer&lt;/h5&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>
</div>
<h3 id="toc8"><span>kerk/templates/example/nav.php</span></h3>
<div class="code">
<pre><code>&lt;div style="width: 530px; background-color:#EEEEEE;"&gt;
 Navigation
&lt;?php foreach( $links as $i=&gt;$link ) { ?&gt;
    &lt;a href="&lt;?php print $link['url'] ?&gt;"&gt;&lt;?php print $link['name'] ?&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;
&lt;?php } // end foreach $links ?&gt;
&lt;/div&gt;</code></pre>
</div>
<h3 id="toc9"><span>kerk/templates/example/quote.php</span></h3>
<div class="code">
<pre><code>&lt;b&gt;Random Quote&lt;/b&gt;&lt;br/&gt;
&lt;i&gt;&lt;?php print $quote ?&gt;&lt;/i&gt;</code></pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/creating-a-web-page-from-multiple-requests-or-content-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an HTML request with a Theme</title>
		<link>http://www.kerkness.ca/creating-an-html-request-with-a-theme/</link>
		<comments>http://www.kerkness.ca/creating-an-html-request-with-a-theme/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 19:16:31 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[kerkness]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=246</guid>
		<description><![CDATA[
In this example we set an additional request to act as a theme. Using themes are useful when you want several web pages or requests to be displayed in a consistent look. A theme is only relevant when sending an HTML formatted response.
Test the example: http://kerkness.ca/kerkdemo/hello.galaxy
Example 3
Inside the folder kerk/modules/hello create a file called galaxy.php [...]]]></description>
			<content:encoded><![CDATA[<div id="page-content">
<p>In this example we set an additional request to act as a theme. Using themes are useful when you want several web pages or requests to be displayed in a consistent look. A theme is only relevant when sending an HTML formatted response.</p>
<p>Test the example: <a onclick="window.open(this.href, '_blank'); return false;" href="http://kerkness.ca/kerkdemo/hello.galaxy">http://kerkness.ca/kerkdemo/hello.galaxy</a></p>
<h2 id="toc0"><span>Example 3</span></h2>
<p>Inside the folder kerk/modules/hello create a file called galaxy.php and add the following to it. This file is exactly the same as the universe.php file created in the <a href="http://www.kerkness.ca/?p=243">first HTML example</a> except we have added a line which sets the theme for our request. (note: We can still use the tempalte hello.universe even tho our request is hello.galaxy)</p>
<div class="code">
<pre><code>&lt;?php

  // Tell kerkness that this request should return an HTML response
  $kerk-&gt;setResponseFormat('HTML');

  // Set the template for this request
  $kerk-&gt;setTemplate( 'hello.universe' );

  // Set the theme for this request
  $kerk-&gt;setTheme( 'hello.theme' );

  // Add some content to the request object
  $kerk-&gt;addContent('myVar', 'Hello Galaxy');

?&gt;</code></pre>
</div>
<p>Inside the directory kerk/modules/hello create the file &#8216;theme.php&#8217; and add the following</p>
<div class="code">
<pre><code>&lt;?php

 $kerk-&gt;setTemplate('hello.theme');
 $kerk-&gt;addContent('page_title', "This is my theme title");

?&gt;</code></pre>
</div>
<p>Inside the directory kerk/templates/hello create the file &#8216;theme.php&#8217; and add the following</p>
<div class="code">
<pre><code>&lt;html&gt;
 &lt;body&gt;
    &lt;h1&gt;&lt;?php print $page_title ?&gt;&lt;/h1&gt;
    &lt;!-- Place include tag where results from our main request will be placed --&gt;
    [include:main_request]
    &lt;h2&gt;This is a footer&lt;/h2&gt;
 &lt;/body&gt;
&lt;/html&gt;</code></pre>
</div>
<p>Now when you call <a href="http://kerkness.ca/kerkdemo/hello.galaxy">http://kerkness.ca/kerkdemo/hello.galaxy</a> the request hello.galaxy will now be displayed inside the hello.theme.</p>
<h2 id="toc1"><span>Next</span></h2>
<p><a href="http://www.kerkness.ca/?p=248">Creating a full dynamic web page with several content blocks</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/creating-an-html-request-with-a-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating your first HTML service request</title>
		<link>http://www.kerkness.ca/creating-your-first-html-service-request/</link>
		<comments>http://www.kerkness.ca/creating-your-first-html-service-request/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 19:14:19 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[kerkness]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=243</guid>
		<description><![CDATA[
This example shows a request which returns a HTML formatted response using an HTML/PHP template. This request could be called by when a partial or full web page is expected in response. It could be used to load an entire web page or be used as a content block in another web page.
Test the example: [...]]]></description>
			<content:encoded><![CDATA[<div id="page-content">
<p>This example shows a request which returns a HTML formatted response using an HTML/PHP template. This request could be called by when a partial or full web page is expected in response. It could be used to load an entire web page or be used as a content block in another web page.</p>
<p>Test the example: <a onclick="window.open(this.href, '_blank'); return false;" href="http://kerkness.ca/kerkdemo/hello.universe">http://kerkness.ca/kerkdemo/hello.universe</a></p>
<h2 id="toc0"><span>Example 2</span></h2>
<p>If you haven&#8217;t already create the directory kerk/modules/hello</p>
<p>Inside the &#8216;hello&#8217; directory create the file &#8216;universe.php&#8217; and add the following to it.</p>
<div class="code">
<pre><code>&lt;?php

 // Tell kerkness that this request should return an HTML response
  $kerk-&gt;setResponseFormat('HTML');

  // Set the template for this request
  $kerk-&gt;setTemplate( 'hello.universe' );

  // Add some content to the request object
  $kerk-&gt;addContent('myVar', 'Hello Universe');

?&gt;</code></pre>
</div>
<p>Create the director kerk/templates/hello</p>
<p>Inside the &#8216;kerk/templates/hello&#8217; directory create the file &#8216;universe.php&#8217; and add the following to it</p>
<div class="code">
<pre><code>&lt;b&gt;This is the template for hello.universe&lt;/b&gt;&lt;br/&gt;
&lt;?php print $myVar ?&gt;</code></pre>
</div>
<p>Now you can make a request for this service by calling <a href="http://kerkness.ca/kerkdemo/hello.universe">http://kerkness.ca/kerkdemo/hello.universe</a> and see the following response:</p>
<hr /><strong>This is the template for hello.universe</strong><br />
Hello Universe</p>
<hr />
<h2 id="toc1"><span>Next</span></h2>
<p><a href="http://www.kerkness.ca/?p=246">Your first HTML request with Theme</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/creating-your-first-html-service-request/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Kerkness</title>
		<link>http://www.kerkness.ca/installing-kerkness/</link>
		<comments>http://www.kerkness.ca/installing-kerkness/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 19:10:59 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[kerkness]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=238</guid>
		<description><![CDATA[Installing Kerkness ( overview )
Kerkness requires a web server running php5 with php-json enabled. It has been primarily test on Ubuntu servers running Apache2 but should be suitable for any server environment running php5.
If you plan on using clean request URLs you will need to have the Apache ReWrite module enabled for your apache server [...]]]></description>
			<content:encoded><![CDATA[<h2 id="toc0"><span>Installing Kerkness ( overview )</span></h2>
<p>Kerkness requires a web server running php5 with <a href="http://www.aurore.net/projects/php-json">php-json</a> enabled. It has been primarily test on Ubuntu servers running Apache2 but should be suitable for any server environment running php5.</p>
<p>If you plan on using clean request URLs you will need to have the Apache ReWrite module enabled for your apache server and requires the use of a .htaccess file.</p>
<p>Basic install steps:</p>
<ol>
<li><a href="http://www.kerkness.ca/?page_id=279">Download current version of kerkness</a></li>
<li>Copy the contents of the folders &#8216;kerk&#8217; and &#8216;www&#8217; to your web server where &#8216;www&#8217; is the root directory for your website or domain.</li>
<li>Modify the values in the config file &#8216;www/kc.php&#8217;;</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/installing-kerkness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
