<?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/"
		>
<channel>
	<title>Comments on: An Easy Plugin Callback Component for CakePHP 1.2</title>
	<atom:link href="http://jamienay.com/2009/11/an-easy-plugin-callback-component-for-cakephp-1-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamienay.com/2009/11/an-easy-plugin-callback-component-for-cakephp-1-2/</link>
	<description>A PHP web developer writing about the web.</description>
	<lastBuildDate>Mon, 26 Jul 2010 20:07:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Jamie</title>
		<link>http://jamienay.com/2009/11/an-easy-plugin-callback-component-for-cakephp-1-2/comment-page-1/#comment-3501</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Fri, 27 Nov 2009 22:58:36 +0000</pubDate>
		<guid isPermaLink="false">http://jamienay.com/?p=434#comment-3501</guid>
		<description>Rachman - I&#039;m in full agreement that views should be allowed to retrieve data from models. I&#039;ve done that more than a few times. We shouldn&#039;t be letting views modify model data (i.e. inserting, updating or deleting records), but I don&#039;t see anything wrong with giving views a mechanism to access data on demand.

That said, I try to load data in the controllers whenever I can, just to keep things a bit more organized for myself. And that&#039;s why I created this plugin callback system - so I can load plugin-specific variables on a site-wide basis while still keeping everything organized.

Thanks for the feedback and the discussion!</description>
		<content:encoded><![CDATA[<p>Rachman &#8211; I&#8217;m in full agreement that views should be allowed to retrieve data from models. I&#8217;ve done that more than a few times. We shouldn&#8217;t be letting views modify model data (i.e. inserting, updating or deleting records), but I don&#8217;t see anything wrong with giving views a mechanism to access data on demand.</p>
<p>That said, I try to load data in the controllers whenever I can, just to keep things a bit more organized for myself. And that&#8217;s why I created this plugin callback system &#8211; so I can load plugin-specific variables on a site-wide basis while still keeping everything organized.</p>
<p>Thanks for the feedback and the discussion!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rachman Chavik</title>
		<link>http://jamienay.com/2009/11/an-easy-plugin-callback-component-for-cakephp-1-2/comment-page-1/#comment-3488</link>
		<dc:creator>Rachman Chavik</dc:creator>
		<pubDate>Thu, 26 Nov 2009 12:03:13 +0000</pubDate>
		<guid isPermaLink="false">http://jamienay.com/?p=434#comment-3488</guid>
		<description>Jamie,

I&#039;m not very familiar with MVC theories or other project&#039;s implementation, but I feel that there should be some sort of mechanism to allow Views to retrieve data from Models in cakephp.

From wikipedia: http://en.wikipedia.org/wiki/Model-view-controller, it mentioned the following:

   A view queries the model in order to generate an appropriate user interface (for example, the 
   view lists the shopping cart&#039;s contents). Note that the view gets its own data from the model.

Also, have a look at http://java.sun.com/blueprints/patterns/MVC-detailed.html


My implementation of the WidgetHelper relies on the assumption that WidgetComponent has been created.  That component acts as a data puller, and sends the data back to the &#039;element&#039; via the widget_data variable.

So, in any view you&#039;ll be able to do:

$widget-&gt;element(
   &#039;News&#039; /* Model to use */,
  &#039;news/latest&#039; /* element views/elements/news/latest.ctp */ 
);

which then will call the NewsWidgetComponent::latest() function, which in turn calls News model to retrieve data.  You can then render the returned widget_data as you wish in element latest.ctp.</description>
		<content:encoded><![CDATA[<p>Jamie,</p>
<p>I&#8217;m not very familiar with MVC theories or other project&#8217;s implementation, but I feel that there should be some sort of mechanism to allow Views to retrieve data from Models in cakephp.</p>
<p>From wikipedia: <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="nofollow">http://en.wikipedia.org/wiki/Model-view-controller</a>, it mentioned the following:</p>
<p>   A view queries the model in order to generate an appropriate user interface (for example, the<br />
   view lists the shopping cart&#8217;s contents). Note that the view gets its own data from the model.</p>
<p>Also, have a look at <a href="http://java.sun.com/blueprints/patterns/MVC-detailed.html" rel="nofollow">http://java.sun.com/blueprints/patterns/MVC-detailed.html</a></p>
<p>My implementation of the WidgetHelper relies on the assumption that WidgetComponent has been created.  That component acts as a data puller, and sends the data back to the &#8216;element&#8217; via the widget_data variable.</p>
<p>So, in any view you&#8217;ll be able to do:</p>
<p>$widget->element(<br />
   &#8216;News&#8217; /* Model to use */,<br />
  &#8216;news/latest&#8217; /* element views/elements/news/latest.ctp */<br />
);</p>
<p>which then will call the NewsWidgetComponent::latest() function, which in turn calls News model to retrieve data.  You can then render the returned widget_data as you wish in element latest.ctp.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://jamienay.com/2009/11/an-easy-plugin-callback-component-for-cakephp-1-2/comment-page-1/#comment-3462</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Wed, 25 Nov 2009 16:22:19 +0000</pubDate>
		<guid isPermaLink="false">http://jamienay.com/?p=434#comment-3462</guid>
		<description>Interesting approach, Rachman. I like the MVC approach as much as the next guy, but I&#039;m not about &quot;violating&quot; it to get stuff done either. With coding time always at a premium for my projects, sometimes the result matters more than the process (ugh, I know, I can&#039;t believe I&#039;m saying that either!).</description>
		<content:encoded><![CDATA[<p>Interesting approach, Rachman. I like the MVC approach as much as the next guy, but I&#8217;m not about &#8220;violating&#8221; it to get stuff done either. With coding time always at a premium for my projects, sometimes the result matters more than the process (ugh, I know, I can&#8217;t believe I&#8217;m saying that either!).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rachman Chavik</title>
		<link>http://jamienay.com/2009/11/an-easy-plugin-callback-component-for-cakephp-1-2/comment-page-1/#comment-3399</link>
		<dc:creator>Rachman Chavik</dc:creator>
		<pubDate>Mon, 23 Nov 2009 10:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://jamienay.com/?p=434#comment-3399</guid>
		<description>Hi Jamie,

I&#039;ve been looking for ways to do something like this as well.
I considered your post, looked through AD7six mini controller, and some other stuff.

But I will probably take a shortcut and violate MVC a bit more ;)

Here&#039;s my current attempt: http://github.com/rchavik/cholesterol/blob/master/views/helpers/widget.php

-- rchavik</description>
		<content:encoded><![CDATA[<p>Hi Jamie,</p>
<p>I&#8217;ve been looking for ways to do something like this as well.<br />
I considered your post, looked through AD7six mini controller, and some other stuff.</p>
<p>But I will probably take a shortcut and violate MVC a bit more <img src='http://jamienay.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Here&#8217;s my current attempt: <a href="http://github.com/rchavik/cholesterol/blob/master/views/helpers/widget.php" rel="nofollow">http://github.com/rchavik/cholesterol/blob/master/views/helpers/widget.php</a></p>
<p>&#8211; rchavik</p>
]]></content:encoded>
	</item>
</channel>
</rss>
