<?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"
	>

<channel>
	<title>Darren Beale &#187; PHP</title>
	<atom:link href="http://bealers.com/category/technology/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://bealers.com</link>
	<description>Husband, Father and Entrepreneurial Geek</description>
	<pubDate>Sun, 31 Aug 2008 16:39:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Debugging with PhpED and DBG</title>
		<link>http://bealers.com/2008/01/20/debugging-with-phped-and-dbg/</link>
		<comments>http://bealers.com/2008/01/20/debugging-with-phped-and-dbg/#comments</comments>
		<pubDate>Sun, 20 Jan 2008 17:17:05 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://bealers.com/2008/01/20/debugging-with-phped-and-dbg/</guid>
		<description><![CDATA[As long-term PhpED user I&#8217;ve always been well aware that I was not making the most of some of the more powerful features of my IDE, particularly the debugging capabilities. Well this week I finally got debugging set-up properly and as per most of my other blog posts I&#8217;m listing what I did here for [...]]]></description>
			<content:encoded><![CDATA[<p>As long-term <a href="http://www.nusphere.com">PhpED</a> user I&#8217;ve always been well aware that I was not making the most of some of the more powerful features of my IDE, particularly the debugging capabilities. Well this week I finally got debugging set-up properly and as per most of my other blog posts I&#8217;m listing what I did here for future reference and just in case it helps anyone else.<span id="more-437"></span></p>
<h3>Step 1: Server and client communication</h3>
<p>The dev server is our standard set-up: Debian stable (currently Etch) running with stable apt packages of PHP 5  (5.2.0) and Apache 2. I have Samba set-up to share each developers home directory with Apache having multiple VirtualHosts per developer serving from within those home directories.</p>
<p>My &#8216;client&#8217; is Windows XP or Vista (FWIW these instructions tested on both) running PhpED 5.2. We&#8217;ve mapped a drive to the home folder on the dev server and we can write to files within it.</p>
<p>The Nusphere website has <a href="http://www.nusphere.com/kb/technicalfaq/index.htm">detailed instructions</a> <a href="http://www.nusphere.com/kb/technicalfaq/howto_debug_rm_website.htm">here</a> &amp; <a href="http://www.nusphere.com/kb/technicalfaq/howto_install_dbg_module.htm">here</a> and here for getting the communication between client and server set-up. You probably want to read through all of that first but here&#8217;s my summary:</p>
<h4>Install the server module</h4>
<p>Situated somewhere like <code>C:\Program Files\nusphere\phped\debugger\server</code> you should find a number of operating system specific folders, these contain the relevant dbg module, in my case I needed <code>\Linux\dbg-3.2.10-Linux-glibc-2.2.tar.gz</code>. Unzip this and place the version specific to your PHP version into PHP&#8217;s extension_dir which can be easily figured out by either running <code>phpinfo();</code> or by looking at php.ini; in my case it&#8217;s <code>/usr/lib/php5/20060613+lfs.</code> For neatness I symlink  dbg.so-5.2.x to dbg.so I then create <code>/etc/php5/apache2/conf.d/dbg.ini</code> and within it I write:</p>
<p><code>extension=dbg.so</code></p>
<p><code>[debugger]<br />
debugger.enabled=on<br />
debugger.profiler_enabled=on<br />
debugger.hosts_allow=ALL<br />
debugger.hosts_deny=ALL<br />
debugger.ports=7869, 10000/16</code></p>
<p>Saving and then restarting Apache I check <code>phpinfo();</code> and see near the top:</p>
<p><code>This program makes use of the Zend Scripting Language Engine:<br />
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies<br />
<strong> with DBG v3.2.10, (C) 2000,2007, by Dmitri Dmitrienko</strong></code></p>
<p>&#8230;with further down the page more detailed information relating to the dbg module.</p>
<p>A few notes on my set-up:</p>
<ul>
<li>the <code>/etc/php5/apache2/conf.d/*.ini</code> is a Debian thing. If you&#8217;ve compiled from source or use another distribution then it&#8217;s likely that you want to put the dbg configuration settings into php.ini, you can find out where that lives on your system by looking in <code>phpinfo()</code></li>
<li>note the configuration line <code>debugger.hosts_allow=ALL</code>. It&#8217;s possible (and likely desirable) to only allow debugging sessions between specific machines. On my internal network I don&#8217;t care so to save configuration changes when new developers start or machines change I&#8217;m leaving it open to all</li>
</ul>
<h4>Ensure Server can talk to client</h4>
<p>With the server successfully set-up we now want to ensure that the server can talk to the client. To do this fire up PhpED and ensure that the the listener is running, this is the little satellite dish in your task bar. If you right-click and select set-up you should see this:</p>
<p><img src="http://bealers.com/wp-content/uploads/2008/01/listener.gif" alt="listener.gif" /></p>
<p>Good, now on the <strong><em>server</em></strong> telnet to the client, thus:</p>
<p><code>telnet &lt;client IP address&gt; 7869</code></p>
<p>If it&#8217;s working you should see a black dot appear within the listener icon in the system tray, if so you&#8217;re done. Just Ctrl  and ] to exit the telnet session and move onto step 2.</p>
<p><strong>Note: </strong>If you don&#8217;t know your ip address you can fire up a dos window and type ipconfig.<br />
<!--more--></p>
<h3>Step 2: Project set-up and mappings</h3>
<p>Step 1 is all relatively straightforward assuming you&#8217;re already comfortable with the inner workings of your set-up. What is less obvious is how to properly set-up the project to actually get down and start debugging. I have had partial success in the past with simple projects but the issue has always been with mappings. If all you want is a PhpED project where it&#8217;s root is also the document root of the website then there&#8217;s not a lot to it. Where the problem lies, for me at least, is when there are library files outside of the document root that you still want to be able to see and edit from within your project.</p>
<p>To illustrate a slightly more complex project set-up I&#8217;ll go through the mappings for one of my <a href="http://www.symfony-project.org/">Symfony</a> projects.</p>
<p>My directory structure is as follows:</p>
<p><code>/home/&lt;developer&gt;/www/projectname</code> (checked out from subversion, this is the trunk)<br />
<code>/home/&lt;developer&gt;/www/projectname/codebase</code><br />
<code>/home/&lt;developer&gt;/www/projectname/codebase/web</code> (default name for a Symfony project&#8217;s document root)</p>
<p>where <code>/home/&lt;developer&gt;/</code> is mapped to Z:\ (or whatever) on the client.</p>
<p>Elsewhere Symfony has been installed using PEAR so lives in <code>/usr/share/php/symfony</code>. To make it easier for a developer to look at (read only) versions of core Symfony (and PEAR) classes I ensure that within the developers&#8217; sandbox the library files are symlinked. So for example with symfony the developer would have:</p>
<p><code>/home/&lt;developer&gt;/www/lib/symfony -&gt; /usr/share/php/symfony</code></p>
<p>We want to be able to edit all of the files within the project so when setting up the new project we set the root directory to be the projectname folder so in this case it&#8217;ll be <code>Z:\www\projectname</code> and for now, just to get the project set-up and the code imported set the &#8216;Run mode&#8217; to be Local CGI.</p>
<p>Doing so gives us this view within the workspace:</p>
<p><img src="http://bealers.com/wp-content/uploads/2008/01/folders.gif" alt="folders.gif" /></p>
<p>That done we need to get the mappings sorted, so entering project properties again we set things up so they look like this:</p>
<p><img src="http://bealers.com/wp-content/uploads/2008/01/project-properties.gif" alt="project-properties.gif" /></p>
<p>Namely:</p>
<ul>
<li>Root directory is  unchanged and <code>Z:\www\projectname</code></li>
<li>Run mode is 3rd party web server</li>
<li>Root URL is blank</li>
<li>Remote root directory is blank</li>
</ul>
<p>If we were to press the OK button now PhpED would complain as it needs to know which URL you&#8217;re using to access the third party web server (our dev server) so instead we select the Mapping tab and <strong>add</strong> the following mappings</p>
<ol>
<li>The apache document root
<ul>
<li>Local directory is <code>Z:\www\projectname\codebase\web</code></li>
<li>Remote directory is <code>/home/user/www/projectname/codebase/web</code></li>
<li>URL is <code>http://projectname</code></li>
</ul>
</li>
<li>The Symfony libraries
<ul>
<li>Local directory is <code>Z:\www\lib\symfony</code></li>
<li>remote directory is <code>/usr/share/php/symfony</code></li>
</ul>
</li>
</ol>
<p><img src="http://bealers.com/wp-content/uploads/2008/01/mappings.gif" alt="mappings.gif" /></p>
<p>Ensuring that the original project root (in bold) is at the bottom of the list we can now press OK.</p>
<p>That&#8217;s it. If we open one of our pages, in Symfony&#8217;s case one of the  files under web, and then press the debug button (green arrow with a D in) or press F5 the debugging session with launch and by default it&#8217;ll stop on the first line of the first file. You&#8217;re now in debug mode, alright!.</p>
<p>How to use the debugger is left as an exercise for the reader. As you&#8217;d expect there&#8217;s more information on <a href="http://www.nusphere.com/products/php_debugger.htm">PhpED&#8217;s debugging features</a> on their website.</p>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2008/01/20/debugging-with-phped-and-dbg/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Setting PHP error reporting from a vhost or .htaccess</title>
		<link>http://bealers.com/2007/08/16/setting-php-error-reporting-from-a-vhost-or-htaccess/</link>
		<comments>http://bealers.com/2007/08/16/setting-php-error-reporting-from-a-vhost-or-htaccess/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 15:08:13 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://bealers.com/2007/08/16/setting-php-error-reporting-from-a-vhost-or-htaccess/</guid>
		<description><![CDATA[Here on our dev servers we turn PHP error reporting full on so we get to know of any issues with our code well before it hits production (where errors are turned off).
This does however cause problems with older legacy sites that generate reams of warning errors because the developers were slack and  - [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.siftware.co.uk">Here</a> on our dev servers we turn PHP error reporting full on so we get to know of any issues with our code well before it hits production (where errors are turned off).</p>
<p>This does however cause problems with older legacy sites that generate reams of warning errors because the developers were slack and  - say - didn&#8217;t declare all their variables. So, the obvious solution is to set the error reporting at the VirtualHost or.htaccess level.</p>
<p>Or is it? At the recent <a href="http://www.phpwm.org">PHPWM</a> meeting I brought up my issue that whenever I set it to be:</p>
<p><code>php_value error_reporting E_ALL &amp; ~E_NOTICES</code></p>
<p>which in php.ini will give you errors but not the notices, it was _definitely_ not working for me in the vhost. A possible solution offered was to use the integer value of the constant instead  but we all couldn&#8217;t remember what that was.</p>
<p>A quick Google later and it seems that using the text constants doesn&#8217;t work in the vhost or .htaccess but the integer version DOES. So the definitive answer to &#8220;How do I turn on PHP errors but get it  to ignore warnings in a vhost&#8221; is</p>
<p><code>php_value error_reporting 6135</code></p>
<p>Well, this works for me on  php 5.2.3 anyway <img src='http://bealers.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2007/08/16/setting-php-error-reporting-from-a-vhost-or-htaccess/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Symfony&#8217;s most popular plugins</title>
		<link>http://bealers.com/2007/08/15/symfonys-most-popular-plugins/</link>
		<comments>http://bealers.com/2007/08/15/symfonys-most-popular-plugins/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 12:15:18 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://bealers.com/2007/08/15/symfonys-most-popular-plugins/</guid>
		<description><![CDATA[Francios a core member of the Symfony team recently blogged about the 20 most popular plugins of the Symfony project based upon page views.
That list is:

sfSimpleCMSPlugin
sfGuardPlugin
sfPropelActAsNestedSetBehaviorPlugin
sfMediaLibraryPlugin
sfSimpleBlogPlugin
sfSimpleForumPlugin
sfFeed2Plugin
sfgWidgetsPlugin
sfThumbnailPlugin
sfUJSPlugin
sfControlPanelPlugin
sfFormValidationPlugin
sfMogileFSPlugin
sfLightboxPlugin
sfCaptchaPlugin
sfNiftyPlugin
sfPrototypeWindowPlugin
sfPropelLoadbalancerPlugin
sfSavvyPlugin
sfYzClientSideValidationPlugin

I find it very interesting that the &#8217;simple&#8217; ones are all in the top 6 with the CMS one - which is very new - already taking up top spot.
It [...]]]></description>
			<content:encoded><![CDATA[<p>Francios a core member of the <a href="http://www.symfony-project.com/">Symfony</a> team <a href="http://www.symfony-project.com/weblog/2007/08/14/top-20-symfony-plugins.html">recently blogged</a> about the 20 most popular plugins of the Symfony project based upon page views.</p>
<p>That list is:</p>
<ol>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfSimpleCMSPlugin">sfSimpleCMSPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfGuardPlugin">sfGuardPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfPropelActAsNestedSetBehaviorPlugin">sfPropelActAsNestedSetBehaviorPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfMediaLibraryPlugin">sfMediaLibraryPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfSimpleBlogPlugin">sfSimpleBlogPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfSimpleForumPlugin">sfSimpleForumPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfFeed2Plugin">sfFeed2Plugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfgWidgetsPlugin">sfgWidgetsPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfThumbnailPlugin">sfThumbnailPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfUJSPlugin">sfUJSPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfControlPanelPlugin">sfControlPanelPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfFormValidationPlugin">sfFormValidationPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfMogileFSPlugin">sfMogileFSPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfLightboxPlugin">sfLightboxPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfCaptchaPlugin">sfCaptchaPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfNiftyPlugin">sfNiftyPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfPrototypeWindowPlugin">sfPrototypeWindowPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfPropelLoadbalancerPlugin">sfPropelLoadbalancerPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfSavvyPlugin">sfSavvyPlugin</a></li>
<li><a href="http://trac.symfony-project.com/trac/wiki/sfYzClientSideValidationPlugin">sfYzClientSideValidationPlugin</a></li>
</ol>
<p>I find it very interesting that the &#8217;simple&#8217; ones are all in the top 6 with the CMS one - which is very new - already taking up top spot.</p>
<p>It proves that the interest is there for off-the-shelf solutions built upon this great framework and I feel that there&#8217;s going to be lots of exciting activity in this space over the coming months. For example  I&#8217;m sure I&#8217;m not the only one who is eagerly awaiting the impending release of <a href="http://www.magentocommerce.com">Magento</a> which is based upon the <a href="http://framework.zend.com/">Zend Framework.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2007/08/15/symfonys-most-popular-plugins/feed/</wfw:commentRss>
		</item>
		<item>
		<title>installing the Symfony plugin sfSimpleCMS</title>
		<link>http://bealers.com/2007/08/02/installing-the-symfony-plugin-sfsimplecms/</link>
		<comments>http://bealers.com/2007/08/02/installing-the-symfony-plugin-sfsimplecms/#comments</comments>
		<pubDate>Thu, 02 Aug 2007 17:32:52 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://bealers.com/2007/08/02/installing-the-symfony-plugin-sfsimplecms/</guid>
		<description><![CDATA[I was recently asked if I&#8217;d sucessfully got the Symfony plugin sfSimpleCMS working and I&#8217;m afraid my answer was no. I had tried briefly when preparing for my talk, but something didn&#8217;t work and I carried on with other things.
Being reminded of it and having an hour to kill before I head off to the [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently asked if I&#8217;d sucessfully got the Symfony plugin sfSimpleCMS working and I&#8217;m afraid my answer was no. I had tried briefly when preparing for <a href="http://bealers.com/2007/07/29/a-pragmatic-look-at-symfony/">my talk</a>, but something didn&#8217;t work and I carried on with other things.</p>
<p>Being reminded of it and having an hour to kill before I head off to the pub I thought I&#8217;d give it a stab, here we go&#8230;</p>
<p><span id="more-401"></span></p>
<p>My environment is PHP 5.2.3 on Debian Woody.</p>
<p>Upgrade to latest stable version (as root):<br />
<code>pear upgrade symfony/symfony</code></p>
<p>Stop being root and create test sandbox:<br />
<code>cd ~/www/TEST/<br />
mkdir sfSimpleCMS &amp;&amp; cd sfSimpleCMS</code></p>
<p>&#8230;obviously your paths can be different.</p>
<p>Create project and app<br />
<code>symfony init-project cms<br />
symfony init-app frontend</code></p>
<p>Set-up the Apache Virtual Host:<br />
<code>&lt;VirtualHost&gt;<br />
ServerName sfSimpleCMS.bealers<br />
DocumentRoot "/home/bealers/www/TEST/sfSimpleCMS/web"<br />
DirectoryIndex index.php<br />
php_flag magic_quotes_gpc off<br />
php_flag register_globals off<br />
Alias /sf /usr/share/php/data/symfony/web/sf<br />
&lt;Directory </code><code>/home/bealers/www/TEST/sfSimpleCMS/web</code><code>&gt;<br />
AllowOverride All<br />
Allow from All<br />
&lt;/Directory&gt;<br />
LogFormat "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\""<br />
TransferLog /var/log/apache/sfSimpleCMS.log<br />
ErrorLog /var/log/apache/sfSimpleCMS.log<br />
&lt;/VirtualHost&gt;</code></p>
<p>&#8230;your paths should match the location of your sandbox</p>
<p>Restart apache (as root, or use sudo)<br />
<code>apachectl reload</code></p>
<p>Make sure that your hostname resolves to the IP of the server and then try it in your browser in my case http://sfSimpleCMS.bealers</p>
<p><img src="http://bealers.com/wp-content/uploads/2007/08/sucess.png" alt="sucess.png" /></p>
<p>Do some simple config<br />
<code>mysql&gt; create database cms;<br />
mysql&gt; grant all on cms.* to cms@localhost identified by 'cms';</code></p>
<p>Edit config/propel.ini so that:<br />
<code>propel.database.createUrl  = mysql://cms:cms@localhost/<br />
propel.database.url        = mysql://cms:cms@localhost/cms</code></p>
<p>Edit config/databases.yml so that:<br />
<code>all:<br />
propel:<br />
class:          sfPropelDatabase<br />
param:<br />
dsn:          mysql://cms:cms@localhost/cms</code></p>
<p>Install the re-prequisites<br />
<code>symfony plugin-install http://plugins.symfony-project.com/sfGuardPlugin<br />
symfony cc</code></p>
<p><code>symfony plugin-install http://plugins.symfony-project.com/sfPropelActAsNestedSetBehaviorPlugin</code></p>
<p>Edit config/propel.ini so that:<br />
<code>propel.builder.addBehaviors = true</code></p>
<p>Install tiny MCE<br />
<code>cd /tmp<br />
wget http://prdownloads.sourceforge.net/tinymce/tinymce_2_1_1_1.tgz?download<br />
tar -zxvf tinymce_2_1_1_1.tgz</code></p>
<p>Move the actual useful bit to our Symfony project (obviously change this to contain the right path for you)<br />
<code>mv tinymce/jscripts/tiny_mce/ ~/www/TEST/sfSimpleCMS/web/js</code></p>
<p>Tidy up<br />
<code>rm -Rf tinymce*</code></p>
<p>Get back to our project<br />
<code>cd ~/www/TEST/sfSimpleCMS</code></p>
<p>Install sfSimpleCMS<br />
<code>symfony plugin-install http://plugins.symfony-project.com/sfSimpleCMSPlugin</code></p>
<p>Build everything<br />
<code>symfony propel-build-all</code></p>
<p>Our database now looks like this:<br />
<img src="http://bealers.com/wp-content/uploads/2007/08/db.png" alt="db.png" /></p>
<p>Edit apps/frontend/config/settings.yml so that:</p>
<p><code>all:<br />
.settings:<br />
enabled_modules:        [default, sfSimpleCMS, sfSimpleCMSAdmin]<br />
sfSimpleCMS:<br />
default_text:         '[add text here]'   # Default text for page editable parts<br />
routes_register:      on                  # Use the plugin's routes<br />
rich_editing:         on                 # Use TinyMCE for rich text editing<br />
default_page:         home                # Slug (=path) of the default root page<br />
home_link:            My swell site       # what is displayed on the top right corner of the pages (can be HTML code)<br />
use_l10n:             false               # Enable multiple versions for a single page<br />
localizations:        [en, fr, es]        # If l10n is enabled, list of cultures in which pages are available<br />
default_culture:      en                  # If l10n is not enabled, default culture for pages<br />
editor_credential:                        # Name of the credential required for page editing (leave blank for free editing)<br />
publisher_credential:                     # Name of the credential required for page publishing (leave blank for free publishing)<br />
templates:                                # Available templates<br />
simplePage:         Simple Page         #   the key is the name of a template which must be present in modules/sfSimpleCMS/templates/<br />
home:               Home                #   the value is the name under which the template is presented in lists<br />
slot_types:                               # Available slot types<br />
Text:           Simple text<br />
RichText:       Rich text<br />
Php:            PHP code<br />
Image:          Image<br />
Modular:        List of components</code></p>
<p>Import some data. I was unable to get the fixtures to load by running:<br />
symfony propel-load-data frontend plugins\sfSimpleCMSPlugin\data\fixtures (actually I&#8217;ve never had much luck with loading data from fixtures, but that&#8217;s another story) so with a bit of trial and error I came up with this simple query which&#8217;ll give us our first page (if we don&#8217;t do this things go a bit weird and the top element has no template assigned so the view barfs).</p>
<p><code>mysql&gt; insert into sf_simple_cms_page set id=1, slug="home", template="home", tree_left=1, tree_right=2, is_published=1, created_at=NOW();</code></p>
<p>Visiting http://sfsimplecms.bealers/frontend_dev.php/sfSimpleCMSAdmin/ should give you the site!</p>
<p><img src="http://bealers.com/wp-content/uploads/2007/08/admin.png" alt="admin.png" /></p>
<p><img src="http://bealers.com/wp-content/uploads/2007/08/edit.png" alt="edit.png" /></p>
<p>Double clicking on the content areas opens an editing window. I&#8217;ve been unable to get rich text editing working with tinyMCE but I guess it&#8217;s in the wrong place in the directory tree. I notice that theres a sfSimpleCMSPlugin folder under web that has its own js folder. Maybe it needs to go in there but I&#8217;ll leave that as an excersise for the reader whilst I head off to the pub.</p>
<p>Here&#8217;s the <a href="http://trac.symfony-project.com/trac/wiki/sfSimpleCMSPlugin">official plugin page</a> for further reference.</p>
<p><strong>Note: </strong>It see that Wordpress has munged the tabs which are important for the yml files. I suggest you look at the official plugin page above should you be unsure of the tab order. I&#8217;ll attempt to tidy it up some time soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2007/08/02/installing-the-symfony-plugin-sfsimplecms/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Symfony plugin: sfSimpleCMSPlugin</title>
		<link>http://bealers.com/2007/07/17/new-symfony-plugin-sfsimplecmsplugin/</link>
		<comments>http://bealers.com/2007/07/17/new-symfony-plugin-sfsimplecmsplugin/#comments</comments>
		<pubDate>Tue, 17 Jul 2007 19:06:41 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://bealers.com/2007/07/17/new-symfony-plugin-sfsimplecmsplugin/</guid>
		<description><![CDATA[Preparing for my talk I was on the Symfony wiki and came across this:
This plugin allows you to add a simple Content Management System (CMS) to your symfony application with the following features:
* Uses Javascript and Ajax to provide a neat user experience
* Edit zones in pages
* Edit page URL (you can use / in [...]]]></description>
			<content:encoded><![CDATA[<p>Preparing for <a href="http://bealers.com/2007/07/16/a-symfony-talk-at-bristol-skillswap/">my talk</a> I was on the Symfony wiki and came across this:</p>
<blockquote><p><a href="http://trac.symfony-project.com/trac/wiki/sfSimpleCMSPlugin">This plugin</a> allows you to add a simple Content Management System (CMS) to your symfony application with the following features:</p>
<p>* Uses Javascript and Ajax to provide a neat user experience<br />
* Edit zones in pages<br />
* Edit page URL (you can use / in page path)<br />
* Edit content in the real context (&#8217;edit in place&#8217;)<br />
* Preview result<br />
* Create and manage a tree structure for pages<br />
* i18n ready (the interface is translated)<br />
* l10n ready (a page can have different versions)<br />
* support multiple templates<br />
* Basic publication workflow<br />
* Breadcrumb navigation<br />
* User management is controlled through sfGuardPlugin</p>
<p>It is not aimed at replacing full-featured CMS packages, but offers a lightweight alternative for when you build a website that has to contain pages often updated by special users. It is voluntarily simple, and very easy to configure; so it should fulfill most basic CMS requirements.</p></blockquote>
<p>Sounds exactly what we&#8217;ve been looking for (or at least intending to build)</p>
<p><a href="http://trac.symfony-project.com/trac/wiki/sfSimpleCMSPlugin">More here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2007/07/17/new-symfony-plugin-sfsimplecmsplugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bargain PHP training</title>
		<link>http://bealers.com/2007/06/02/bargain-php-training/</link>
		<comments>http://bealers.com/2007/06/02/bargain-php-training/#comments</comments>
		<pubDate>Sat, 02 Jun 2007 11:23:22 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://bealers.com/2007/06/02/bargain-php-training/</guid>
		<description><![CDATA[David and Kat over at Pale Purple are offering a PHP training course lasting 5 days starting in July for £500; a special offer price as it&#8217;s the first time they&#8217;ve ran the course publically.
Sounds like a bargain to me.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://codepoets.co.uk/">David and Kat</a> over at Pale Purple are offering a <a href="http://www.palepurple.co.uk/events/learners-php-training-july-2007">PHP training course</a> lasting 5 days starting in July for £500; a special offer price as it&#8217;s the first time they&#8217;ve ran the course publically.</p>
<p>Sounds like a bargain to me.</p>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2007/06/02/bargain-php-training/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Symfony book released and codebase tagged 1.0 RC1</title>
		<link>http://bealers.com/2007/01/31/symfony-book-released-and-codebase-tagged-10-rc1/</link>
		<comments>http://bealers.com/2007/01/31/symfony-book-released-and-codebase-tagged-10-rc1/#comments</comments>
		<pubDate>Wed, 31 Jan 2007 00:52:44 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[dev]]></category>

		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://bealers.com/2007/01/31/symfony-book-released-and-codebase-tagged-10-rc1/</guid>
		<description><![CDATA[Symfony, the PHP5 framework that I&#8217;ve firmly adopted at work for any new bespoke projects went to version 1.0 RC1 this week.
Symfony is great, not just because it allows developers like me to get on and build complex, easily maintainable apps but also because the documentation is superb.
When I picked it up 5 months ago [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.symfony-project.com/">Symfony, the PHP5 framework</a> that I&#8217;ve firmly adopted at <a href="http://www.siftware.co.uk">work</a> for any new bespoke projects went to version 1.0 RC1 this week.</p>
<p>Symfony is great, not just because it allows developers like me to get on and build complex, easily maintainable apps but also because the documentation is <span style="font-weight: bold">superb</span>.</p>
<p>When I picked it up 5 months ago it was on version 0.6 and already had:</p>
<ul>
<li>The <a href="http://downloads.symfony-project.com/demo/admin/admin_generator_commented.mov">obligatory webcast</a> (I watched this once and then moved along)</li>
<li>A <a href="http://www.symfony-project.com/tutorial/my_first_project.html">beginners intro</a></li>
<li>A full hour-by-hour &#8216;project in a day&#8217; called <a href="http://www.symfony-project.com/askeet">Askeet</a> with very detailed code examples leading the reader to finish up with a full working project</li>
<li><a href="http://www.symfony-project.com/forum/">Forums</a>, <a href="mailto:symfony-users-subscribe@googlegroups.com">mailing lists</a>, <a href="http://www.symfony-project.com/trac/wiki">wiki</a> etc.</li>
</ul>
<p>To build on this already great work, today the printed book was released - which I&#8217;ve ordered. They&#8217;ve also gone one better and <a href="http://www.symfony-project.com/book/trunk">released the whole thing</a> available to read online under the <a href="http://www.gnu.org/copyleft/fdl.html">GFDL licence</a>. I happen to think that this is a pretty shrewd move and hope that it will cement Symfony&#8217;s place as one of the top PHP frameworks out there along with <a href="http://www.cakephp.org/">Cake</a> and the <a href="http://framework.zend.com/">ZF</a>.</p>
<p>If you&#8217;re a web developer and have not yet jumped into bed with a particular framework - whether self-rolled  or community led - then I would strongly urge you to try out the Symfony offering. It&#8217;s the dog&#8217;s danglies.</p>
<p><span style="font-weight: bold">Related</span><a href="http://www.symfony-project.com/weblog/post/108.html" title="Symfony kicks ass"><br />
</a></p>
<ul>
<li><a href="http://www.symfony-project.com/weblog/post/108.html" title="Symfony kicks ass">Website news release</a></li>
<li><a href="http://www.symfony-project.com/">Symfony project homepage</a></li>
<li><a href="http://www.amazon.com/dp/1590597869?tag=symfonyprojec-20&amp;camp=14573&amp;creative=327641&amp;linkCode=as1&amp;creativeASIN=1590597869&amp;adid=0B9T2EFZTZ8SSW10DX44&amp;">Buy the book</a> (with Symfony&#8217;s affiliate ID tagged)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2007/01/31/symfony-book-released-and-codebase-tagged-10-rc1/feed/</wfw:commentRss>
<enclosure url="http://downloads.symfony-project.com/demo/admin/admin_generator_commented.mov" length="18537976" type="video/quicktime" />
		</item>
		<item>
		<title>Symfony job going</title>
		<link>http://bealers.com/2007/01/17/symfony-job-going/</link>
		<comments>http://bealers.com/2007/01/17/symfony-job-going/#comments</comments>
		<pubDate>Tue, 16 Jan 2007 23:24:07 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://bealers.com/2007/01/17/symfony-job-going/</guid>
		<description><![CDATA[Sensio, Fabien Potencier&#8217;s company yesterday announced a great sounding job right up there in the ticks all the boxes category:

Whether you currently live in the US or in Poland, if you know symfony well enough, we&#8217;re interested. The positions are in Paris, France, and we are willing to do the necessary paperwork and look for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sensio.com/">Sensio</a>, Fabien Potencier&#8217;s company yesterday announced a great sounding job right up there in the ticks all the boxes category:</p>
<blockquote><p>
Whether you currently live in the US or in Poland, if you know symfony well enough, we&#8217;re interested. The positions are in Paris, France, and we are willing to do the necessary paperwork and look for accommodation for you. The job description is a mix between web development and project management. Prerequisites for working at Sensio&#8217;s are simple:</p>
<p>    * You must be an experienced PHP developer (you should know what OOP, MVC, ORM, and unit testing mean and how to apply them)<br />
    * You must be able to manage a small web project (you should know a bit about XP programming, trac, svn, and scheduling)<br />
    * You must be able to handle the relationship with a client (not necessarily with a tie, but at least with a smile)<br />
    * You must have already developed an application with symfony (askeet doesn&#8217;t count - you must have made the askeet tutorial anyway)<br />
    * You must be willing to move to Paris, France (who wouldn&#8217;t?)<br />
    * You must be available full time and soon enough (this is a real job)</p>
<p>French is not compulsory, since our teams speak English and the projects we work on come from all over the world. Salary is attractive, working conditions are nice, the team is fantastic, projects are fun. Plus, this is a unique opportunity to work in Paris.</p>
<p>If you&#8217;re interested, send a email to Fabien at fabien.potencier [at] symfony-project [dot] com. Interesting profiles will be contacted by phone during the week.</p></blockquote>
<p><a href="http://www.symfony-project.com/weblog/2007/01/15/do-you-want-to-move-to-paris.html">Post on Symfony site</a><br />
<a href="http://www.symfony-project.com/">Symfony, the PHP web framework</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2007/01/17/symfony-job-going/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Symfony and AJAX</title>
		<link>http://bealers.com/2006/11/19/symfony-and-ajax/</link>
		<comments>http://bealers.com/2006/11/19/symfony-and-ajax/#comments</comments>
		<pubDate>Sun, 19 Nov 2006 22:08:53 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[ajax]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://bealers.com/2006/11/19/symfony-and-ajax/</guid>
		<description><![CDATA[I&#8217;ve been playing with the AJAX support in Symfony this weekend and I&#8217;m blown away by how easy it is.
Today I put together a detailed/summary view switcher for a list of items coming from a database with a (script.aculo.us) fade in/out effect and I didn&#8217;t need to write one line of JavaScript. Now that&#8217;s what [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with the <a href="http://en.wikipedia.org/wiki/AJAX">AJAX</a> support in <a href="http://www.symfony-project.com">Symfony</a> this weekend and I&#8217;m blown away by how easy it is.</p>
<p>Today I put together a detailed/summary view switcher for a list of items coming from a database with a (<a href="http://script.aculo.us/">script.aculo.us</a>) fade in/out effect and <strong>I didn&#8217;t need to write one line of JavaScript</strong>. Now <em>that&#8217;s</em> what I&#8217;m talking about.</p>
<p>Here&#8217;s a summary of what I did, with example code:</p>
<p>Everything applies to the &#8216;list&#8217; action belonging to the &#8216;bar&#8217; module. The view displays either detailed or summary view for a paginated list of records coming from the database.</p>
<p>In my view file (app/module/templates/listSuccess.php) I add:</p>
<p>[php][/php]</p>
<p>A quick reload and I can see that the libraries have been loaded:</p>
<p>[html]<script src="http://bealers.com/sf/js/prototype/prototype.js" type="text/javascript"></script><br />
<script src="http://bealers.com/sf/js/prototype/builder.js" type="text/javascript"></script><br />
<script src="http://bealers.com/sf/js/prototype/effects.js" type="text/javascript"></script>[/html]</p>
<p>My complete template looks like:</p>
<p>[php]</p>
<div id="nav"><span id="detailActive">getAttribute(&#8217;viewMode&#8217;) == &#8216;detail&#8217;) ? &#8220;&#8221; : &#8221; style=&#8217;display: none&#8217;&#8221;; ?&gt;&gt;<br />
Detail View |                          &#8216;Summary View&#8217;,<br />
array(<br />
&#8216;url&#8217;      =&gt; &#8216;bar/setmode?mode=summary&#8217;,<br />
&#8216;complete&#8217; =&gt; visual_effect(&#8217;blind_down&#8217;, &#8217;summary&#8217;).visual_effect(&#8217;blind_up&#8217;, &#8216;detail&#8217;).<br />
&#8220;Element.hide(&#8217;detailActive&#8217;);Element.show(&#8217;summaryActive&#8217;);return false;&#8221;),<br />
array(&#8221;href&#8221; =&gt; &#8220;bar/setmode/mode/summary&#8221;));<br />
?&gt;<br />
</span></p>
<p><span id="summaryActive">getAttribute(&#8217;viewMode&#8217;) == &#8216;detail&#8217;) ? &#8221; style=&#8217;display: none&#8217;&#8221; : &#8220;&#8221;; ?&gt;&gt;<br />
&#8216;Detail View&#8217;,<br />
array(<br />
&#8216;url&#8217;      =&gt; &#8216;bar/setmode?mode=detail&#8217;,<br />
&#8216;complete&#8217; =&gt; visual_effect(&#8217;blind_up&#8217;, &#8217;summary&#8217;).visual_effect(&#8217;blind_down&#8217;, &#8216;detail&#8217;).<br />
&#8220;Element.hide(&#8217;summaryActive&#8217;);Element.show(&#8217;detailActive&#8217;);return false;&#8221;),<br />
array(&#8221;href&#8221; =&gt; &#8220;bar/setmode/mode/detail&#8221;));<br />
?&gt;<br />
| Summary View</span></p>
</div>
<div style="border: 1px dashed #0000ff;">&#8221; id=&#8221;detail&#8221;&gt;</p>
<h1><strong>Detail View</strong></h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed nulla augue, rhoncus in, ornare ac, vestibulum vitae, turpis. Suspendisse lacinia, odio at ornare suscipit, quam tellus dictum orci, eget egestas nibh sapien in enim. Nulla sed est nec lorem consectetuer adipiscing. Vivamus aliquam est ultricies ipsum. Duis et lacus. Nam venenatis sem sit amet justo. Donec pellentesque sodales felis. Nulla suscipit consequat arcu. Ut mollis turpis sit amet orci. Curabitur mauris massa, euismod eget, fringilla vel, interdum a, justo. Donec sed augue. Donec augue lacus, ullamcorper in, ultrices a, rhoncus sed, diam. Fusce nunc magna, porta eget, varius a, faucibus varius, est. Integer euismod dignissim mi. Aenean accumsan lectus non purus. Quisque ultrices sapien vitae sapien. Etiam tincidunt tellus et odio. Morbi pellentesque. Proin pharetra sem at massa.</p>
</div>
<div style="border: 1px dashed #ff0000;">&#8221; id=&#8221;summary&#8221;&gt;</p>
<h1>Summary View</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed nulla augue, rhoncus in, ornare ac, vestibulum vitae, turpis. Suspendisse lacinia, odio at ornare suscipit, quam tellus dictum orci, eget egestas nibh sapien in enim. Nulla sed est nec lorem consectetuer adipiscing. Vivamus aliquam est ultricies ipsum. Duis et lacus. Nam venenatis sem sit amet justo. Donec pellentesque sodales felis. Nulla suscipit consequat arcu. Ut mollis turpis sit amet orci. Curabitur mauris massa, euismod eget, fringilla vel, interdum a, justo. Donec sed augue. Donec augue lacus, ullamcorper in, ultrices a, rhoncus sed, diam. Fusce nunc magna, porta eget, varius a, faucibus varius, est. Integer euismod dignissim mi. Aenean accumsan lectus non purus. Quisque ultrices sapien vitae sapien. Etiam tincidunt tellus et odio. Morbi pellentesque. Proin pharetra sem at massa.</p>
</div>
<p>[/php]</p>
<p>and the module&#8217;s controller looks like:</p>
<p>[php]</p>
<p>class barActions extends autobarActions<br />
{</p>
<p>public function preExecute ()<br />
{<br />
// set a view mode for the bar/list page if one isn&#8217;t already set<br />
if (!$this-&gt;getUser()-&gt;hasAttribute(&#8217;viewMode&#8217;))<br />
{<br />
$this-&gt;getUser()-&gt;setAttribute(&#8217;viewMode&#8217;, &#8216;detail&#8217;);<br />
}<br />
}</p>
<p>/**<br />
* @desc Called by AJAX when clicking on the [Detail|Summary] view link.<br />
*       This allows us to &#8216;remember&#8217; the view that the user they have chosen<br />
*/<br />
public function executeSetmode()<br />
{<br />
$this-&gt;getUser()-&gt;setAttribute(&#8217;viewMode&#8217;, $this-&gt;getRequestParameter(&#8221;mode&#8221;));<br />
// if javascript is disabled we need to re-direct back to the listing<br />
$this-&gt;redirect(&#8221;bar&#8221;);<br />
}</p>
<p>}<br />
?&gt;[/php]</p>
<p>So when we click on the detail/summary link we want to set a session variable so that the application remembers the view mode. To do this this the template specifies an AJAX call using the link_to_remote() JavaScript helper it then, by using the &#8216;complete&#8217; parameter, executes the javascript methods. The visual_effect() calls are Symfony&#8217;s javascript helpers and they do the <a href="http://script.aculo.us/">script.aculo.us</a> fades between the two content windows, note the chaining. The latter part of the &#8216;complete&#8217; parameter are additional direct javascript calls to <a href="http://prototype.conio.net/">Prototype</a> methods so we can swap the navigation links to remove the link for the active view mode.</p>
<p>Like any self-respecting developer I wanted to ensure that the code would work with scripting turned off. Now this was the only part of the excersise where I had to do a bit of digging. In the excellent <a href="http://www.symfony-project.com/content/documentation.html">Symfony documentation</a> under <a href="http://www.symfony-project.com/book/trunk/javascript">JavaScript helpers</a> there is mention of the if_javascript() method, e.g.:</p>
<p>[php]</p>
<p>You have JavaScript enabled.</p>
<p><noscript>&lt;/p&gt; &lt;p&gt;You don&#8217;t have JavaScript enabled.&lt;/p&gt; &lt;p&gt;</noscript>[/php]</p>
<p>This seemed a bit cumbersome to me so after some further <a href="http://www.symfony-project.com/api/symfony/helper/JavascriptHelper.html">digging into the API</a> I noticed the <em>$options_html()</em> array for link_to_remote() . Using this I pass the URL so the href gets populated (normally it&#8217;s just a #) and as the last item within &#8216;complete&#8217; I add a <em>return false;</em> so with JavaScript enabled the link is not followed. Finally in my controller for setmode action I add the redirect. Now, even with javascript disabled, it all works albeit with a page reload.</p>
<p>I&#8217;ve still plenty to learn with Symfony but I can see that now I&#8217;m over the worst of the learning curve I&#8217;m going to start really enjoying it from here on in.</p>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2006/11/19/symfony-and-ajax/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Remote PHP debugging</title>
		<link>http://bealers.com/2006/09/28/remote-php-debugging/</link>
		<comments>http://bealers.com/2006/09/28/remote-php-debugging/#comments</comments>
		<pubDate>Thu, 28 Sep 2006 15:27:16 +0000</pubDate>
		<dc:creator>Bealers</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://bealers.com/2006/09/28/remote-php-debugging/</guid>
		<description><![CDATA[After 8 or so years of being a professional web developer I today finally cracked using a debugger with PHP.
I&#8217;ve been a long suffering PHPEdit user from since it was open source and into having to pay (twice) for a licence. Unfortunately I started getting very irritated by some annoying and performance degrading bugs in [...]]]></description>
			<content:encoded><![CDATA[<p>After 8 or so years of being a professional web developer I today finally cracked using a debugger with PHP.</p>
<p>I&#8217;ve been a long suffering <a href="http://www.waterproof.fr/">PHPEdit</a> user from since it was open source and into having to pay (twice) for a licence. Unfortunately I started getting very irritated by some annoying and performance degrading bugs in the newest version. So after a number of bug reports and spending too much time trying to get to the bottom of the problem I just gave up and bought Nusphere&#8217;s <a href="http://www.nusphere.com/products/phped.htm">PHP IDE</a>.</p>
<p>It wasn&#8217;t cheap but I really quickly became to like it and a month in there is no way I&#8217;d switch back.</p>
<p>Anyway, I&#8217;d toyed with PHPEdit&#8217;s debugger (which I&#8217;m sure does work) but the documentation is sparse to say the least and I never got it working perfectly. But today I decided to try with PHPEd (the Nuspehre one) and got nearly there on my own but had some path issues at the last hurdle.</p>
<p>A post on their support forum and 10 mins later I&#8217;m presented with <a href="http://support.nusphere.com/viewtopic.php?t=2135">this FAQ entry</a>.</p>
<p>Obviously mine is the the most complicated one at the bottom but adding the mappings as they suggest means that I can still see documents not in the project root and merrily debug!</p>
<p>Kick ass.</p>
]]></content:encoded>
			<wfw:commentRss>http://bealers.com/2006/09/28/remote-php-debugging/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
