<?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>Symfony Developer</title>
	<atom:link href="http://www.symfonydeveloper.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.symfonydeveloper.com</link>
	<description>Documenting my finds in hopes of more efficient use of the framework</description>
	<lastBuildDate>Tue, 24 Aug 2010 16:44:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Adding CKEditor &amp; CK Finder to Symfony 1.3/1.4</title>
		<link>http://www.symfonydeveloper.com/2010/08/24/adding-ckeditor-ck-finder-to-symfony-1314/</link>
		<comments>http://www.symfonydeveloper.com/2010/08/24/adding-ckeditor-ck-finder-to-symfony-1314/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 16:23:41 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Admin Generator]]></category>
		<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://www.symfonydeveloper.com/?p=39</guid>
		<description><![CDATA[I stumbled all over the place trying to do this. My first stumble was the the Symfony CKEditor plugin was not a stable release. But rather than tell you everything I stumbled on, I&#8217;ll just give you the run down on how I got these working via a step-by-step tutorial: From the plugin page, download [...]]]></description>
			<content:encoded><![CDATA[<p>I stumbled all over the place trying to do this.  My first stumble was the the <a href="http://http://www.symfony-project.org/plugins/sfCKEditorPlugin">Symfony CKEditor plugin</a> was not a stable release.  But rather than tell you everything I stumbled on, I&#8217;ll  just give you the run down on how I got these working via a step-by-step tutorial:</p>
<ol>
<li>From the plugin page, download the most recent release to your server.  In my case it was 0.1.2 and I put it in my <em>data</em> directory:
<pre>wget http://plugins.symfony-project.org/get/sfCKEditorPlugin/sfCKEditorPlugin-0.1.2.tgz</pre>
</li>
<li>Install the plugin from the local location on the server:
<pre>symfony plugin:install data/sfCKEditorPlugin-0.1.2.tgz</pre>
</li>
<li>Download and extract the <a href="http://http://ckeditor.com/" target="_blank">CKEditor</a> and <a href="http://http://ckfinder.com/" target="_blank">CKFinder</a> tarball files to your <em>web/js</em> directory.  This creates two new directories, namely <em>web/js/ckeditor</em> and <em>web/js/ckfinder</em>.</li>
<li>Create/edit your project&#8217;s <em>config/autoload.yml</em> file to read:
<pre>autoload:
  ckeditor:
    name:       ckeditor
    path:       %SF_WEB_DIR%/js/ckeditor/
    recursive:  on

  ckfinder:
    name:       ckfinder
    path:       %SF_WEB_DIR%/js/ckfinder/
    recursive:  on</pre>
</li>
<li>Edit your application&#8217;s <em>config/app.yml</em> file to read:
<pre>all:
  ckeditor:
    basePath:         '/js/ckeditor/'
  ckfinder:
    basePath:         '/js/ckfinder/'</pre>
</li>
<li>Include the javascript files in your application&#8217;s <em>config/view.yml</em> file:
<pre>javascripts:    [/js/ckeditor/ckeditor.js, /js/ckfinder/ckfinder.js]</pre>
</li>
<li>Enable CKFinder via your application&#8217;s configuration class file, within the configure() method:
<pre>class yourappConfiguration extends sfApplicationConfiguration
{
	public function configure()
	{
		sfConfig::set('app_ckfinder_active', true);
	}
}</pre>
</li>
<li>Enable CKFinder for the current user.  This step will require you to implement your own security method to do properly, but essentially you need to edit the CheckAuthentication() function in the <em>web/js/ckfinder/config.php</em> file so that it returns a true value.  Be careful on this one.  Read the comments in that function and do it right!
<pre>function CheckAuthentication()
{
	// WARNING : DO NOT simply return "true". By doing so, you are allowing
	// "anyone" to upload and list the files in your server. You must implement
	// some kind of session validation here.

	//this is just a sample function call... create your own
	if (current_user_is_authenticated()) {
		return true;
	} else {
		return false;
	}
}</pre>
</li>
<li>Clear your Symfony cache:
<pre>symfony cc</pre>
</li>
<li>A simple form setup should do the trick now:
<pre>$this-&gt;widgetSchema['filed_to_enhance'] = new sfWidgetFormCKEditor();</pre>
</li>
</ol>
<p>The above should work for both a simple CRUD generation as well as the admin generator.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfonydeveloper.com/2010/08/24/adding-ckeditor-ck-finder-to-symfony-1314/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Missing stylesheets in the Admin Generator</title>
		<link>http://www.symfonydeveloper.com/2010/08/12/missing-stylesheets-admin-generator/</link>
		<comments>http://www.symfonydeveloper.com/2010/08/12/missing-stylesheets-admin-generator/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 15:08:15 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Admin Generator]]></category>

		<guid isPermaLink="false">http://www.symfonydeveloper.com/?p=34</guid>
		<description><![CDATA[In Symfony 1.4.x I found I was missing stylesheets for the admin generator pages. Specifically, I was missing the following: &#60;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; media=&#34;screen&#34; href=&#34;/sfPropelPlugin/css/global.css&#34; /&#62; &#60;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; media=&#34;screen&#34; href=&#34;/sfPropelPlugin/css/default.css&#34; /&#62; It took a bunch of digging, but I finally realized there is now a sf command for ensuring these are in place: symfony [...]]]></description>
			<content:encoded><![CDATA[<p>In Symfony 1.4.x I found I was missing stylesheets for the admin generator pages.  Specifically, I was missing the following:</p>
<p>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/sfPropelPlugin/css/global.css&quot; /&gt;<br />
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;/sfPropelPlugin/css/default.css&quot; /&gt;</p>
<p>It took a bunch of digging, but I finally realized there is now a sf command for ensuring these are in place:</p>
<pre>symfony plugin:publish-assets</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.symfonydeveloper.com/2010/08/12/missing-stylesheets-admin-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alphabetizing Many-to-many Relationships in the Admin Generator</title>
		<link>http://www.symfonydeveloper.com/2009/10/26/alphabetizing-many-to-many-relationships-in-the-admin-generator/</link>
		<comments>http://www.symfonydeveloper.com/2009/10/26/alphabetizing-many-to-many-relationships-in-the-admin-generator/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 22:39:39 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Admin Generator]]></category>

		<guid isPermaLink="false">http://www.symfonydeveloper.com/?p=32</guid>
		<description><![CDATA[I searched high and low for a solution that I could place in my generator.yml file in order to alphabetize (or somehow order) the associated attributes for a given piece of data.  I was certain I&#8217;d be able to do this using a params configuration.  Finally, I realized it&#8217;s not going to be solved by [...]]]></description>
			<content:encoded><![CDATA[<p>I searched high and low for a solution that I could place in my generator.yml file in order to alphabetize (or somehow order) the associated attributes for a given piece of data.  I was certain I&#8217;d be able to do this using a params configuration.  Finally, I realized it&#8217;s not going to be solved by editing the generator file.  So instead I opened the model file that I used in the generator file and overrode the doSelect method like this:</p>
<pre>
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
	{
		if(count($criteria->getOrderByColumns()) == 0)
		{
				$criteria->addAscendingOrderByColumn(self::NAME);
		} 

		return self::populateObjects(self::doSelectStmt($criteria, $con));
	}
</pre>
<p>Of course, I&#8217;m using Propel&#8230; and I have a &#8220;name&#8221; column that I wanted to alphabetize on.  But you get the point.  Edit the above as you see fit for your needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfonydeveloper.com/2009/10/26/alphabetizing-many-to-many-relationships-in-the-admin-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing variables from an action (or module template) to a layout template</title>
		<link>http://www.symfonydeveloper.com/2009/03/05/passing-variables-from-an-action-or-module-template-to-a-layout-template/</link>
		<comments>http://www.symfonydeveloper.com/2009/03/05/passing-variables-from-an-action-or-module-template-to-a-layout-template/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 23:55:28 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Variable Referencing]]></category>

		<guid isPermaLink="false">http://www.symfonydeveloper.com/?p=28</guid>
		<description><![CDATA[Since Symfony 1.1, a bit of change has gone on with passing variables from an action to a layout file. You used to be able to do it like this: $this-&#62;foo = 'bar'; And then you could call it in either your action&#8217;s template file or the application&#8217;s layout file like this: &#60;?php echo $bar ?&#62; But [...]]]></description>
			<content:encoded><![CDATA[<p>Since Symfony 1.1, a bit of change has gone on with passing variables from an action to a layout file. You used to be able to do it like this:</p>
<pre>$this-&gt;foo = 'bar';</pre>
<p>And then you could call it in either your action&#8217;s template file or the application&#8217;s layout file like this:</p>
<pre>&lt;?php echo $bar ?&gt;</pre>
<p>But that&#8217;s no longer the case&#8230; for good reason, but I won&#8217;t get into that here.  Now you&#8217;re forced to use slots.  So If you want to use the same logic above, you must pass the variable via a slot in your action like this:</p>
<pre>$this-&gt;getResponse()-&gt;setSlot('foo', 'bar');</pre>
<p>Then you can call that variable value from within your layout template like this:</p>
<pre>&lt;?php echo get_slot('foo') ?&gt;</pre>
<p>You can also make the assignment from within your action&#8217;s template file like this:</p>
<pre>&lt;?php slot('foo', 'bar') ?&gt;</pre>
<p>And you&#8217;ll still call the variable the same way in your layout template.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfonydeveloper.com/2009/03/05/passing-variables-from-an-action-or-module-template-to-a-layout-template/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Finding the current internal route or URI</title>
		<link>http://www.symfonydeveloper.com/2009/03/05/current-internal-route-uri/</link>
		<comments>http://www.symfonydeveloper.com/2009/03/05/current-internal-route-uri/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 13:49:47 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.symfonydeveloper.com/?p=22</guid>
		<description><![CDATA[I was creating a login form on one of my site pages. The login box appears on all pages of the site until the visitor becomes a user tat is signed in. I wanted to be able to return the user to the exact page they logged in from, so I needed to grab the [...]]]></description>
			<content:encoded><![CDATA[<p>I was creating a login form on one of my site pages. The login box appears on all pages of the site until the visitor becomes a user tat is signed in. I wanted to be able to return the user to the exact page they logged in from, so I needed to grab the internal route for any given page, at any time within my layout template file. The method for doing this has changed since 1.0 and now the current method (as of 1.2) goes like this:</p>
<pre>sfContext::getInstance()-&amp;gt;getRouting()-&amp;gt;getCurrentInternalUri();</pre>
<p>That gives you the current route. So I included a hidden input in my login form that looked like this:</p>
<pre>&lt;input type="hidden" name="route" value="&lt;?php echo sfContext::getInstance()-&gt;getRouting()-&gt;getCurrentInternalUri(); ?&gt;" /&gt;</pre>
<p>And now, I can simply redirect the user back to the page they logged in from by grabbing that route variable.</p>
<p>This is a bit more you can do with this to take it a step further for your needs. I&#8217;m simply copying from the Symfony book site:</p>
<pre>// If you require a URL like

http://myapp.example.com/article/21

$routing = sfContext::getInstance()->getRouting();

// Use the following in article/read action
$uri = $routing->getCurrentInternalUri();
 => article/read?id=21

$uri = $routing->getCurrentInternalUri(true);
 => @article_by_id?id=21

$rule = $routing->getCurrentRouteName();
 => article_by_id

// If you just need the current module/action names,
// remember that they are actual request parameters
$module = $request->getParameter('module');
$action = $request->getParameter('action');</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.symfonydeveloper.com/2009/03/05/current-internal-route-uri/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Linking within the action, model and templates</title>
		<link>http://www.symfonydeveloper.com/2009/02/10/linking-within-the-action-model-and-templates/</link>
		<comments>http://www.symfonydeveloper.com/2009/02/10/linking-within-the-action-model-and-templates/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 20:27:19 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.symfonydeveloper.com/?p=15</guid>
		<description><![CDATA[I continuously find myself looking these up, so I&#8217;m posting them here. Routing in Symfony is super easy, but remembering the proper method for calling upon routes can be mind scrambling. Generating links in a Template link_to('Anchor Text', 'action/method?id=123', array('class' =&#62; 'some-class', 'target' =&#62; '_blank')) Below, the second parameter determines whether or not to send [...]]]></description>
			<content:encoded><![CDATA[<p>I continuously find myself looking these up, so I&#8217;m posting them here.  Routing in Symfony is super easy, but remembering the proper method for calling upon routes can be mind scrambling.</p>
<h3>Generating links in a Template</h3>
<pre>link_to('Anchor Text', 'action/method?id=123', array('class' =&gt; 'some-class', 'target' =&gt; '_blank'))</pre>
<p>Below, the second parameter determines whether or not to send an absolute URL</p>
<pre>url_for('action/method?id=123', true)</pre>
<h3>Generating links in an Action or Controller</h3>
<pre>$this-&gt;getController()-&gt;genUrl('action/method?id=123')</pre>
<h3>Generating links from within the Model</h3>
<p>Below, the second parameter of genUrl() determines whether or not to send an absolute URL</p>
<pre>sfContext::getInstance()-&gt;getController()-&gt;genUrl('action/method?id=123', true)</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.symfonydeveloper.com/2009/02/10/linking-within-the-action-model-and-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Demystifying input_in_place_editor_tag with an example</title>
		<link>http://www.symfonydeveloper.com/2009/01/17/input_in_place_editor_tag-example/</link>
		<comments>http://www.symfonydeveloper.com/2009/01/17/input_in_place_editor_tag-example/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 15:11:21 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Form Elements]]></category>

		<guid isPermaLink="false">http://www.symfonydeveloper.com/?p=11</guid>
		<description><![CDATA[Symfony&#8217;s documentation on the input_in_place_editor_tag is a little lacking.  The input_in_place_editor_tag allows for in-line editing of any piece of text within your site.  It uses AJAX to post the altered information back to your system. It&#8217;s a great tool, but I found myself wondering how to go about making use of it from within my Action [...]]]></description>
			<content:encoded><![CDATA[<p>Symfony&#8217;s documentation on the input_in_place_editor_tag is a little lacking.  The input_in_place_editor_tag allows for in-line editing of any piece of text within your site.  It uses AJAX to post the altered information back to your system. It&#8217;s a great tool, but I found myself wondering how to go about making use of it from within my Action methods.  It didn&#8217;t take too much digging to figure out the basics you need to know.</p>
<p>Let&#8217;s assume you are working on a Wiki for your company website.  And that any user signed into your site can edit information within a Wiki page.  For this example, let&#8217;s assume all wiki pages have a &#8216;heading&#8217; attribute and we want to allow the user to edit that heading for any page.  The following code makes some assumptions about how your system may be setup, but should provide a general example of how to achieve what you need to do.</p>
<p>Within your template:</p>
<pre>&lt;?php use_helper('Javascript') ?&gt;
&lt;?php if ($sf_user-&gt;isAuthenticated()): ?&gt;
    &lt;div id="edit_heading"&gt;&lt;?php echo $page-&gt;getHeading() ?&gt;&lt;/div&gt;
    &lt;?php echo input_in_place_editor_tag('edit_heading,
                   'page/editInLine?attribute=Heading&amp;id='.$page-&gt;getId(),
                   array('cols' =&gt; '60', 'rows' =&gt; '3', )) ?&gt;
&lt;?php else: ?&gt;
    &lt;?php echo $page-&gt;getHeading() ?&gt;
&lt;?php endif; ?&gt;</pre>
<p>This snippet of template is checking to see if the user is signed in.  If they are, it is allowing them to edit the heading of the page.  The editing will call a method named executeEditInLine within the actions.class.php file of the page module.  So now let&#8217;s create the Action method.  Note that this example is simplified.  You should do some data cleansing as well as perhaps some user authentication.  But here we go:</p>
<pre>public function executeEditInLine(sfWebRequest $request)
{
    //load the proper page to work with
    $page = PagePeer::retrieveByPk($request-&gt;getParameter('id'));

    //determine the proper get and set methods to be used
    $set_func = 'set'.$request-&gt;getParameter('attribute');
    $get_func = 'get'.$request-&gt;getParameter('attribute');

    //same the current version of your page before performing the update
    $page-&gt;saveCurrentVersion();

    //set the new value, save it and return it back for page display
    $page-&gt;$set_func($request-&gt;getParameter('value'));
    $page-&gt;save();
    die($page-&gt;$get_func());
}</pre>
<p><strong>Notice how the actual data being sent is done so within the parameter named &#8216;value.&#8217;</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfonydeveloper.com/2009/01/17/input_in_place_editor_tag-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customizing a rich input_date_tag with different button text</title>
		<link>http://www.symfonydeveloper.com/2009/01/11/customizing-a-rich-input_date_tag-with-different-button-text/</link>
		<comments>http://www.symfonydeveloper.com/2009/01/11/customizing-a-rich-input_date_tag-with-different-button-text/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 11:34:30 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Form Elements]]></category>

		<guid isPermaLink="false">http://www.symfonydeveloper.com/?p=5</guid>
		<description><![CDATA[To change the default text of the input_date_tag away from &#8220;&#8230;&#8221; simply use the additional option calendar_button_txt.  The following shows a &#8220;rich&#8221; calendar with the button labeled Change Me: &#60;?php echo input_date_tag(&#8216;input_name&#8217;, &#8216;now&#8217;, array(&#8216;rich&#8217; =&#62; true, &#8216;calendar_button_txt&#8217; =&#62; &#8216;Change Me&#8217;)); ?&#62;]]></description>
			<content:encoded><![CDATA[<p>To change the default text of the input_date_tag away from &#8220;&#8230;&#8221; simply use the additional option calendar_button_txt.  The following shows a &#8220;rich&#8221; calendar with the button labeled Change Me:</p>
<div class="code">&lt;?php echo input_date_tag(&#8216;input_name&#8217;, &#8216;now&#8217;, array(&#8216;rich&#8217; =&gt; true, &#8216;calendar_button_txt&#8217; =&gt; &#8216;Change Me&#8217;)); ?&gt;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.symfonydeveloper.com/2009/01/11/customizing-a-rich-input_date_tag-with-different-button-text/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Frustrated, but lovin&#8217; it</title>
		<link>http://www.symfonydeveloper.com/2009/01/10/frustrated-but-lovin-it/</link>
		<comments>http://www.symfonydeveloper.com/2009/01/10/frustrated-but-lovin-it/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 16:04:26 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://server1.contentfarm.net/~symfonyd/?p=3</guid>
		<description><![CDATA[I&#8217;ve been working with the PHP framework Symfony for a little over a year now.  When I started, I was using version 1.0.  About 4 weeks ago I decided to go back and upgrade all of my sites it&#8217;s been used on to version 1.2.  That was a bit of a nightmare, but I&#8217;ve finally finished.  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with the PHP framework <a href="http://www.symfony-project.org/">Symfony</a> for a little over a year now.  When I started, I was using version 1.0.  About 4 weeks ago I decided to go back and upgrade all of my sites it&#8217;s been used on to version 1.2.  That was a bit of a nightmare, but I&#8217;ve finally finished.  And promises are being made that upgrades form version 1.2 should go much smoother&#8230; we&#8217;ll see.</p>
<p>The truth is that ever since I started using Symfony, my projects have become more robust, easier to work with and overall just a bit better.  I&#8217;ve truly enjoyed working in this environment, but I find that I tend to ask myself the same questions more than once.  I have to hand it to the Symfony team&#8230; they&#8217;ve done a good job with online documentation, but it just never seems to &#8220;cover it all.&#8221;  My Google toolbar search history shows a huge number of queries that begin with the word symfony.  And I find that I&#8217;m often trying to dig up the same information I tracked down in the past.  I make great use of the help forum.  I would guess about 50% of my questions are answered there via searching alone.</p>
<p>So here I am.  Out of necessity, I&#8217;ve decided to go ahead and start recording my finds and report on them here in hopes of being able to find my same answers more quickly in the future.  Since I owned this domain, I figured I&#8217;d do it all in a public blog in case anyone else finds use from my findings.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.symfonydeveloper.com/2009/01/10/frustrated-but-lovin-it/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

