<?xml version="1.0" encoding="utf-8"?>
<!-- If you are running a bot please visit this policy page outlining rules you must respect. https://www.livejournal.com/bots/ -->
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:lj="https://www.livejournal.com">
  <id>urn:lj:livejournal.com:atom1:cakephp</id>
  <title>CakePHP LJ Community</title>
  <subtitle>CakePHP LJ Community</subtitle>
  <author>
    <name>CakePHP LJ Community</name>
  </author>
  <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/"/>
  <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom"/>
  <updated>2007-04-17T09:58:50Z</updated>
  <lj:journal userid="10437206" username="cakephp" type="community"/>
  <link rel="service.feed" type="application/x.atom+xml" href="https://cakephp.livejournal.com/data/atom" title="CakePHP LJ Community"/>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:7326</id>
    <author>
      <name>texhapb</name>
    </author>
    <lj:poster user="texhapb" userid="9098542"/>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/7326.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=7326"/>
    <title>Tags and Rights</title>
    <published>2007-04-17T09:58:50Z</published>
    <updated>2007-04-17T09:58:50Z</updated>
    <content type="html">I'm planning to use tags at my site instead of tree of content. Also there's an opportunity to create a tree from tags (if there's more then 1 tag assigned to an element).&lt;br /&gt;&lt;br /&gt;But how can I set up rights for an elements? Yes, I can set it for every element, but what's for a groups of elements, such as sections and subsections in ordinary tree content categorising system?</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:6929</id>
    <author>
      <name>texhapb</name>
    </author>
    <lj:poster user="texhapb" userid="9098542"/>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/6929.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=6929"/>
    <title>Setting up an application</title>
    <published>2007-04-03T08:08:23Z</published>
    <updated>2007-04-03T08:08:23Z</updated>
    <content type="html">Does anyone have some thoughts on automatic installing of cakePHP applications?&lt;br /&gt;&lt;br /&gt;For example, if the table is missing the check_and_install action is performed to check the table presence and structure and create or fix them.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:6813</id>
    <author>
      <name>texhapb</name>
    </author>
    <lj:poster user="texhapb" userid="9098542"/>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/6813.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=6813"/>
    <title>URL reversing.</title>
    <published>2007-03-25T16:53:49Z</published>
    <updated>2007-03-25T16:53:49Z</updated>
    <content type="html">As you know, there's an URL parser in cake. But we have to write all URLs by hands in "flash" messages, "redirects", views etc.&lt;br /&gt;&lt;br /&gt;Does anyone have any suggestions how to automatize this task? This means that it should be really simple way to change site routing.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:5966</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/5966.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=5966"/>
    <title>Cook up Web sites fast with CakePHP, Part 4: Session and Request Handler components</title>
    <published>2007-01-10T03:18:56Z</published>
    <updated>2007-01-10T03:18:56Z</updated>
    <category term="tutorials"/>
    <content type="html">&lt;a target='_blank' href='http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake4.html' rel='nofollow'&gt;http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake4.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;There are multiple ways of saving session data using CakePHP's Session component, and each method has its advantages. In this tutorial, you'll learn how to use the Session component by incorporating all three ways into your application, so you'll be able to pick the best one that works for you. You'll also learn how to use the Request Handler component to aid you in your handling of various HTTP requests, including requests from mobile browsers, or requests containing XML or HTML content.&lt;br /&gt;&lt;br /&gt;This tutorial is divided into two main topics:&lt;br /&gt;&lt;br /&gt;* The different types of session handling covered by CakePHP -- You will learn the advantages and disadvantages of each, and how to implement them.&lt;br /&gt;&lt;br /&gt;* How to use the RequestHandler in your controllers -- We will use it for two purposes: to add an RSS feed of your products and to implement Ajax functionality. &lt;/em&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:5771</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/5771.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=5771"/>
    <title>christmas presents from the cake team</title>
    <published>2006-12-28T20:23:25Z</published>
    <updated>2006-12-28T20:23:25Z</updated>
    <category term="new version"/>
    <content type="html">I'm a little late in catching it, but the dev team released 2 new versions of CakePHP on Christmas day:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://cakeforge.org/frs/?group_id=23&amp;amp;release_id=170" target="_blank" rel="nofollow"&gt;Version 1.1.12.4205&lt;/a&gt; is a bugfix release with no major changes&lt;br /&gt;&lt;br /&gt;Also released is a &lt;a href="http://cakeforge.org/frs/?group_id=23&amp;amp;release_id=171" target="_blank" rel="nofollow"&gt;development version of Cake 1.2&lt;/a&gt;, which I'm excited to start playing with.  You can read more about it here in &lt;a href="http://bakery.cakephp.org/articles/view/197" target="_blank" rel="nofollow"&gt;this Bakery article&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Happy holidays, and happy baking.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:5630</id>
    <author>
      <name>Sevka</name>
    </author>
    <lj:poster user="sevka" userid="997172"/>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/5630.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=5630"/>
    <title>cakephp @ 2006-12-21T18:42:00</title>
    <published>2006-12-21T16:45:59Z</published>
    <updated>2006-12-21T16:45:59Z</updated>
    <content type="html">I have model A and model B. Can I use model B inside the model A class?</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:5290</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/5290.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=5290"/>
    <title>some more bugs in the developerWorks tutorial</title>
    <published>2006-12-20T22:26:25Z</published>
    <updated>2006-12-20T22:26:25Z</updated>
    <category term="bugs"/>
    <category term="tutorials"/>
    <content type="html">I hit another little bug in the developerWorks tutorial; there's a problem in Part 2, Section 8: Putting your ACLs to work&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Listing 17 reads:&lt;br /&gt;&lt;pre style="font-family: Trebuchet MS, Times New Roman, Times; padding: 10px; background-color: #ddd; border: 1px solid #bbb; margin: 5px 0px; display: block"&gt;
function view($id) {
  $product = $this-&amp;gt;Product-&amp;gt;read(null, $id);
  if ($this-&amp;gt;Acl-&amp;gt;check($this-&amp;gt;Session-&amp;gt;read('user'), $id.'-'.$product['title'], 
'read'))
  {
    $this-&amp;gt;set('product', $product);
  } else {
    $this-&amp;gt;Session-&amp;gt;setFlash('Only Registered Users may view this product.');
    $this-&amp;gt;redirect('/users/register');
  }
}
&lt;/pre&gt;&lt;br /&gt;The problem is in the line:&lt;br /&gt;&lt;em&gt;$this-&amp;gt;Acl-&amp;gt;check($this-&amp;gt;Session-&amp;gt;read('user'), $id.'-'.$product['title'], &lt;br /&gt;'read')&lt;/em&gt;&lt;br /&gt;Specifically, &lt;em&gt;$product['title']&lt;/em&gt;; In this tutorial, the Product model is associated to the Dealer model, so a -&amp;gt;read() on products returns both the Product and Dealer data:&lt;br /&gt;&lt;pre style="font-family: Trebuchet MS, Times New Roman, Times; padding: 10px; background-color: #ddd; border: 1px solid #bbb; margin: 5px 0px; display: block"&gt;
Array
(
    [Product] =&amp;gt; Array
        (
            [id] =&amp;gt; 18
            [title] =&amp;gt; Test Product
            [dealer_id] =&amp;gt; 1
            [description] =&amp;gt; Test Product Descript
        )

    [Dealer] =&amp;gt; Array
        (
            [id] =&amp;gt; 1
            [title] =&amp;gt; Tor Johnson School Of Drama
        )

)
&lt;/pre&gt;&lt;br /&gt;As you can see, $product['title'] does not exist.  There are 2 ways to fix this: the first is by placing &lt;em&gt;$this-&amp;gt;Product-&amp;gt;recursive = 0&lt;/em&gt; before the -&amp;gt;read(), which will only return the array of Product data, and no association data, but you probably want to display the association data, so I went with replacing &lt;em&gt;$product['title']&lt;/em&gt; with &lt;em&gt;$product['Product']['title']&lt;/em&gt;.  Hope this comes in handy for someone.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='cutid1-end'&gt;&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:4904</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/4904.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=4904"/>
    <title>bug(s) with acl.php</title>
    <published>2006-12-20T19:21:47Z</published>
    <updated>2006-12-20T20:02:48Z</updated>
    <category term="bugs"/>
    <category term="acl"/>
    <content type="html">I've been running through the &lt;a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html" target="_blank" rel="nofollow"&gt;developerWorks articles on Cake&lt;/a&gt;, and hit a little bug during the ACL steps; I was getting 2 errors, one regarding array_shift() requiring an array parameter, and the other stating "class 'Configure' not found"&lt;br /&gt;&lt;br /&gt;The first issue was my fault; I recently installed PHP5 and Apache2.2, and my php directory is now c:\php5, but c:\php was still in my Windows PATH list, so when I was running php from my command line, it was calling c:\php\php.exe (which was my old php4.x install) and for whatever reason the line "$serverArgs = env('argv');" in acl.php was returning nothing; I took out c:\php from my path, and the warning disappeared.  Probably nothing anyone else will hit, but as a heads up, if you ever experience bizarre CLI behavior, and you have multiple PHP installs either specify the full pull for php.exe, or check on your PATH variable.&lt;br /&gt;&lt;br /&gt;The second issue has already been addressed by the Cake team (&lt;a target='_blank' href='https://trac.cakephp.org/changeset/4078' rel='nofollow'&gt;https://trac.cakephp.org/changeset/4078&lt;/a&gt;) but the code has not been merged into the trunk yet, so even if you have the latest nightly build, you get the error 'class Configure not found'; changing the uses() call on line 93 to include 'configure' fixes this issue.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; The acl fix above still does not allow "initdb" to be run for me; if you're having a problem with running initdb, you can just run the sql file app/config/sql/db_acl.sql on your database by hand. The ACL "create" command seems to be running just fine.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:4618</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/4618.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=4618"/>
    <title>Cook up Websites Fast..., Part 3</title>
    <published>2006-12-19T18:13:43Z</published>
    <updated>2006-12-19T18:13:43Z</updated>
    <category term="tutorials"/>
    <content type="html">Part 3 of IBM's developerWorks series on Cake has been published:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Cook up Web sites fast with CakePHP, Part 3: Use Sanitize for your protection&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;CakePHP is a stable production-ready, rapid-development aid for building Web sites in PHP. This "Cook up Web sites fast with CakePHP" series shows you how to build an online product catalog using CakePHP. Part 1 focuses on getting CakePHP up and running, and Part 2 demonstrates how to use scaffolding and Bake. In this article, you will learn how to use CakePHP's Sanitize and Security components to help secure your user-submitted data. You will also learn how to handle invalid requests.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;a target='_blank' href='http://www-128.ibm.com/developerworks/opensource/library/os-php-cake3/' rel='nofollow'&gt;http://www-128.ibm.com/developerworks/opensource/library/os-php-cake3/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Links to part 1 and 2 can be found below, and in Part 3</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:4597</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/4597.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=4597"/>
    <title>Cook Up Websites Fast... Pt. 2</title>
    <published>2006-12-13T21:58:36Z</published>
    <updated>2006-12-13T21:59:55Z</updated>
    <category term="tutorials"/>
    <content type="html">Thanks to the &lt;a href="http://cakebaker.42dh.com" target="_blank" rel="nofollow"&gt;cakebaker&lt;/a&gt;, I noticed that the &lt;a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake2.html" target="_blank" rel="nofollow"&gt;second part&lt;/a&gt; in IBM's DeveloperWorks series on CakePHP has been released, covering Scaffolding, the Bake script, and Cake's mind-bogglingly-lacking-in-documentation ACL lists:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;"This tutorial shows you how to jumpstart your CakePHP application using scaffolding and Bake. You will also learn the ins and outs of using CakePHP's Access Control Lists (ACLs). You'll get a look at what scaffolding is and what it provides. Then you'll learn how to use Bake to generate the code for a scaffold, letting you tweak it as you go. Finally, you will learn about ACLs: what they are, how to create them, and how to use them in your application. This tutorial builds on the online product application Tor created in &lt;a href="http://www.ibm.com/developerworks/opensource/edu/os-dw-os-php-cake1.html" target="_blank" rel="nofollow"&gt;Part 1&lt;/a&gt;."&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;These articles do require registration to view, but the signup process was painless, and I haven't seen anything remotely spam-ish come as a result.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://cakebaker.42dh.com/2006/12/13/cook-up-websites-fast-with-cakephp-part-2/trackback/" target="_blank" rel="nofollow"&gt;Cook up websites fast with CakePHP, part 2&lt;/a&gt; (CakeBaker's Post)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake2.html" target="_blank" rel="nofollow"&gt;Cook up Web sites fast with CakePHP, Part 2: Bake bigger and better with CakePHP&lt;/a&gt; (developerWorks article, part 2)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html" target="_blank" rel="nofollow"&gt;Cook up Web sites fast with CakePHP, Part 1: Adding related information and services&lt;/a&gt; (developerWorks article, part 1)&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:4272</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/4272.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=4272"/>
    <title>Cake 1.1.11.4064 Released</title>
    <published>2006-12-04T18:14:44Z</published>
    <updated>2006-12-04T18:14:44Z</updated>
    <category term="new version"/>
    <content type="html">CakePHP 1.1.11.4064 has been released, with at least 1 change I'm very happy with - Cake model classes are now "lazy loaded", meaning only the models Cake needs for a certain action are loaded, instead of the previous method of loading ALL model classes for each action. I doubt this ever really impared performance in the small app's I've created, but it was always a minor annoyance to me. Nimrod, another baker/blogger, had previously come up with his own fix for lazy loading models that can be read &lt;a href="http://abing.gotdns.com/posts/2006/lazy-loaded-models-for-cakephp/" target="_blank" rel="nofollow"&gt;here&lt;/a&gt;.  (Completely off topic here, but if I haven't mentioned it before, Nimrod's &lt;a href="http://abing.gotdns.com/posts/2006/themeable-view-class-for-cakephp/" target="_blank" rel="nofollow"&gt;Themeable View Class&lt;/a&gt; is definitely worth a look if you're interested in "theme"-ing your Cake apps.)&lt;br /&gt;&lt;br /&gt;A summary of the other updates can be found in the release notes &lt;a href="https://trac.cakephp.org/wiki/notes/1.1.x.x" target="_blank" rel="nofollow"&gt;here&lt;/a&gt;, and the new version can be downloaded from CakeForge &lt;a href="http://cakeforge.org/frs/?group_id=23&amp;amp;release_id=164" target="_blank" rel="nofollow"&gt;here&lt;/a&gt;.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:3879</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/3879.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=3879"/>
    <title>Cook up Web sites fast with CakePHP</title>
    <published>2006-11-28T18:09:44Z</published>
    <updated>2006-11-28T18:09:44Z</updated>
    <category term="tutorials"/>
    <content type="html">&lt;a href="http://cakebaker.42dh.com/2006/11/21/cook-up-websites-fast-with-cakephp/" target="_blank" rel="nofollow"&gt;Cakebaker&lt;/a&gt; stumbled onto the first in a &lt;a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html" target="_blank" rel="nofollow"&gt;series of articles about CakePHP&lt;/a&gt; on IBM's developerWorks site that seem look fairly promising.  From IBM's site:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;"CakePHP is a stable production-ready, rapid-development aid for building Web sites in PHP. This "Cook up Web sites fast with CakePHP" series shows you how to build an online product catalog using CakePHP."&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;This first article teaches you how to get Cake installed and running, and covers setting up a very simple user signup system.  It's a great novice read, but there were even a few tidbits within that I found pretty useful as an "experienced" Cake developer.&lt;br /&gt;&lt;br /&gt;&amp;bull; &lt;a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html" target="_blank" rel="nofollow"&gt;Cook up websites fast with CakePHP&lt;/a&gt; (IBM developerWorks article, part 1)&lt;br /&gt;&amp;bull; &lt;a href="http://cakebaker.42dh.com/2006/11/21/cook-up-websites-fast-with-cakephp/" target="_blank" rel="nofollow"&gt;Cook up websites fast with CakePHP&lt;/a&gt; (Cakebaker's post)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:3689</id>
    <author>
      <name>Sevka</name>
    </author>
    <lj:poster user="sevka" userid="997172"/>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/3689.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=3689"/>
    <title>MySQL Views and Cake PHP</title>
    <published>2006-11-09T16:02:13Z</published>
    <updated>2006-11-09T16:02:13Z</updated>
    <content type="html">Sorry my english.&lt;br /&gt;I have a problem when I use MySQL views. I don't mean View from MVC, I mean SQL views like "CREATE VIEW MY_VIEW AS SELECT table1.a as a, table2.b as b FROM..."&lt;br /&gt;&lt;br /&gt;When i used views in php or in other frameworks, i can operate with them like with tables. But cake-php presents views like query result and it's very uncomfortable.&lt;br /&gt;If i create View like this "CREATE VIEW view1 AS SELECT table1.a as a, table2.b as b FROM table1,table2" I want to access my data by ['view1']['a'] , ['view1']['b'] , but CAKE-PHP creates array like that: ['table1']['a'], ['table2']['b'].&lt;br /&gt;&lt;br /&gt;Can I operate with MySQL views like with tables? Or it's impossible with Cake-PHP?&lt;br /&gt;&lt;br /&gt;Thanks.&lt;br /&gt;&lt;br /&gt;P.S. I create model for my MySQL View like for table.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:3426</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/3426.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=3426"/>
    <title>cake version 1.1.10.3825 released</title>
    <published>2006-11-08T18:57:28Z</published>
    <updated>2006-11-08T18:58:27Z</updated>
    <category term="new version"/>
    <content type="html">&lt;em&gt;"This is another bug fix for the 1.1 series and marks the last release before 1.2."&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;You can grab the newest version from CakeForge: &lt;br /&gt;&lt;a target='_blank' href='http://cakeforge.org/frs/?group_id=23&amp;release_id=156' rel='nofollow'&gt;http://cakeforge.org/frs/?group_id=23&amp;release_id=156&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:3323</id>
    <author>
      <name>mx_</name>
    </author>
    <lj:poster user="mx_" userid="2625855"/>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/3323.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=3323"/>
    <title>Implementing bar gadget on every page</title>
    <published>2006-11-02T10:09:03Z</published>
    <updated>2006-11-02T10:09:03Z</updated>
    <content type="html">I'm trying to create a bar, which would be hanging on every page on my site.  That bar should have username/password textboxes (if you're logged out), and some little useful info if you're logged in.  I'm trying to implement it as a component+element, but I can't figure out how to wire things up, and how this bar will work together with other views and controllers, especially when it comes to logging in a user.  I drew a quick &lt;b&gt;&lt;a href="http://www.wehike.net/unrelated/dgInfobar.png" target="_blank" rel="nofollow"&gt;diagram&lt;/a&gt;&lt;/b&gt; in OpenOffice Draw, to illustrate how I understand it, but even with that diagram, I'm not sure how to make it work.&lt;br /&gt;&lt;br /&gt;The tricky part 1:&lt;br /&gt;When logging in through that bar there should not be any extra intermediate page.  When you click "login", the bar should just switch to "welcome, user; etc". Only one page refresh should occur.&lt;br /&gt;&lt;br /&gt;The tricky part 2:&lt;br /&gt;No ajax. I will implement ajax later, when I'm sure it works without it.&lt;br /&gt;&lt;br /&gt;Any help would be appreciated.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:2863</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/2863.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=2863"/>
    <title>app themes</title>
    <published>2006-10-07T22:27:28Z</published>
    <updated>2006-10-07T22:27:28Z</updated>
    <category term="themes"/>
    <content type="html">I've spent the past several days looking for a decent theming system for my Cake apps, and stumbled across &lt;a href="http://abing.gotdns.com/posts/2006/themeable-view-class-for-cakephp/" target="_blank" rel="nofollow"&gt;this solution&lt;/a&gt; on Nimrod's blog, &lt;a href="http://abing.gotdns.com/" target="_blank" rel="nofollow"&gt;Terminus a Quo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Just to specify, what I'm looking for in a "theming system" is the ability to group views, stylesheets, layouts, etc - anything having to do with styling or layout - are lumped together under a common folder, and Cake will load a theme depending on some setting.&lt;br /&gt;&lt;br /&gt;I'm currently working on Cake sites for two separate bands.  Both sites will have pretty much the same content (discography, artist bios, a blog, news, yadda yadda) and the backend elements to both will probably be identical.  I was looking into theming as a way for me to work on 1 set of core app components, and easily switch between the front ends for either act.  Additionally I wanted an easy method of quickly deploying new site layouts once the sites are live.&lt;br /&gt;&lt;br /&gt;Nimrod's ThemeableView works like this:&lt;br /&gt;&lt;br /&gt;Place themeable.php in /app/views/ and add the following to your app controller:&lt;br /&gt;var $view = 'Themeable';&lt;br /&gt;var $themeName = 'MyThemeName';&lt;br /&gt;&lt;br /&gt;That's pretty much it for setup.  You can now use the directory /app/themes to store your theme related views:&lt;br /&gt;/app/themes/MyThemeName/views/&lt;br /&gt;/app/themes/MyThemeName/views/layouts/default.thtml&lt;br /&gt;/app/themes/MyThemeName/views/pages/home.thtml&lt;br /&gt;/app/themes/MyThemeName/views/controller_name/action.thtml&lt;br /&gt;&lt;br /&gt;Also your images, css and stylesheets can be placed under /app/webroot/themes/:&lt;br /&gt;/app/webroot/themes/MyThemeName/css/default.css&lt;br /&gt;/app/webroot/themes/MyThemeName/js/my_script.js&lt;br /&gt;/app/webroot/themes/MyThemeName/img/logo.gif&lt;br /&gt;&lt;br /&gt;A nice feature of the ThemeableView code is that it does not just the search for the requested view in your themes directory - if you're requesting mysite.com/posts/view/34, and /app/themes/MyThemeName/views/posts/view.thtml does not exist, ThemeableView will then check for /app/views/posts/view.thtml and then look in cake's tempalte setup under /cake/libs/view.  This means that not ALL of your views and layouts have to belong to a theme.  &lt;br /&gt;&lt;br /&gt;Other possibilities -&lt;br /&gt;&lt;br /&gt;- A theme 'preview' mode, where, if a user w/ staff or admin-type privileges is logged in and some kind of $_GET var were passed  - perhaps 'mysite.com/posts/?theme=NewTheme - a theme would be temporarily loaded for the staff user; could be handy during the development phase of a theme, as you would be able to see how your new theme looks with real data and content loaded.&lt;br /&gt;&lt;br /&gt;- One could possibly use themes as a way of internationalization - each language you wished to support could have its own "theme" (MyTheme_En, MyTheme_Fr, MyTheme_Sp, etc) and depending on a user choice, a Session could be set instructing Cake which language theme to load&lt;br /&gt;&lt;br /&gt;You can find the script and some more detailed information and some examples here:&lt;br /&gt;&lt;a target='_blank' href='http://abing.gotdns.com/posts/2006/themeable-view-class-for-cakephp/' rel='nofollow'&gt;http://abing.gotdns.com/posts/2006/themeable-view-class-for-cakephp/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='cutid1-end'&gt;&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:2753</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/2753.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=2753"/>
    <title>new cake version</title>
    <published>2006-09-26T18:06:39Z</published>
    <updated>2006-09-26T18:06:39Z</updated>
    <category term="bakery"/>
    <category term="new version"/>
    <content type="html">There's a new bugfix version of Cake out, 1.1.8.3544 -&lt;br /&gt;&lt;a target='_blank' href='http://cakeforge.org/frs/?group_id=23&amp;release_id=134' rel='nofollow'&gt;http://cakeforge.org/frs/?group_id=23&amp;release_id=134&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As &lt;a href="http://cakeforge.org/frs/shownotes.php?group_id=23&amp;amp;release_id=134" target="_blank" rel="nofollow"&gt;the announcement&lt;/a&gt; states, this will be the end of the 1.1 line, and it also contains some tidbits about what can be expected from the 1.2 versions, along with the introduction of &lt;a href="http://bakery.cakephp.org" target="_blank" rel="nofollow"&gt;the bakery&lt;/a&gt;, a new repository for cake projects and tutorials to replace the old wiki.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:2553</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/2553.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=2553"/>
    <title>cake project</title>
    <published>2006-09-14T17:30:16Z</published>
    <updated>2006-09-14T17:30:16Z</updated>
    <category term="projects"/>
    <content type="html">&lt;a target='_blank' href='http://reaxmusic.com/' rel='nofollow'&gt;http://reaxmusic.com/&lt;/a&gt; - This is the first big Cake project I've 'completed' - still not 100% done, but when I am I will probably open up the source if anyone is interested.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:2165</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/2165.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=2165"/>
    <title>plugin docs</title>
    <published>2006-08-11T19:44:50Z</published>
    <updated>2006-08-11T19:44:50Z</updated>
    <category term="docs"/>
    <category term="plugins"/>
    <content type="html">looks like the &lt;a href="http://manual.cakephp.org/chapter/plugins" target="_blank" rel="nofollow"&gt;plugins chapter&lt;/a&gt; of the &lt;a href="http://manual.cakephp.org/" target="_blank" rel="nofollow"&gt;CakePHP manual&lt;/a&gt; has been updated: &lt;a target='_blank' href='http://manual.cakephp.org/chapter/plugins' rel='nofollow'&gt;http://manual.cakephp.org/chapter/plugins&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm not sure when this was done, but it's much more detailed than I recall it being last time I skimmed it</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:1874</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/1874.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=1874"/>
    <title>simple curl component</title>
    <published>2006-08-09T23:51:00Z</published>
    <updated>2006-08-09T23:53:19Z</updated>
    <category term="curl"/>
    <category term="component"/>
    <content type="html">a simple wrapper for some common cURL functionality bundled into a Cake component... &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="padding: 15px; background-color: #dddddd"&gt;
&amp;lt;?php

/**
 * cURL component.
 * 
 * 
 * Example usage:
 * 
 * $this-&amp;gt;Curl-&amp;gt;server = &amp;quot;www.google.com/search&amp;quot;;
 * $this-&amp;gt;Curl-&amp;gt;params = array(
 * 		'q' =&amp;gt; 'search term'
 * );
 * $this-&amp;gt;xmlResponse = false;
 * $this-&amp;gt;returnHeader = false;
 * 
 * $this-&amp;gt;Curl-&amp;gt;buildRequestString(); // can be used for debug - automatically called with Execute
 * debug($this-&amp;gt;Curl-&amp;gt;requestString);
 * 
 * $response = $this-&amp;gt;Curl-&amp;gt;execute();
 * debug($response);
 * 
 */

/**
 * Test for cURL compatibility.
 */
if(!function_exists('curl_init'))
{
	die('cURL not installed.');
}


class CurlComponent extends Object 
{
	var $components = array('Xmlsimple');
	
	var $test = false;
	var $testResponse = 'TEST MODE DEFAULT RESPONSE';
	
	var $xmlResponse = false;
	
	var $server = null;
	var $params = null;
	var $response = null;
	var $requestString = null;
	
	var $returnHeader = true;
	var $returnTransfer = true;
	
	var $success = false;
	
	var $returnedData = null;
	
	var $error = null;
	
	function execute()
	{
		if($this-&amp;gt;test)
		{
			$this-&amp;gt;success = true;
			$this-&amp;gt;returnedData = $this-&amp;gt;testResponse;
			break;
		}
		else 
		{
			
			if(!$this-&amp;gt;server)
			{
				$this-&amp;gt;error = 'No server set.';
				break;
			}
			else 
			{
				$this-&amp;gt;buildRequestString();
				
				$session = curl_init($this-&amp;gt;requestString);
				curl_setopt($session, CURLOPT_HEADER, $this-&amp;gt;returnHeader);
				curl_setopt($session, CURLOPT_RETURNTRANSFER, $this-&amp;gt;returnTransfer);
				$response = curl_exec($session);				
				
				// check for error
				if(curl_errno($session))
				{
					$this-&amp;gt;error = curl_error($session);
					break;
				}
				else 
				{
					curl_close($session);	
					if($this-&amp;gt;xmlResponse)
					{
						$status_code = array();
						preg_match('/\d\d\d/', $response, $status_code);
						// Get the XML from the response, bypassing the header
						if (!($xml = strstr($response, '&amp;lt;?xml'))) {
						   $xml = null;
						}
						
						$parsed_xml = $this-&amp;gt;Xmlsimple-&amp;gt;parse($xml);
						
						$this-&amp;gt;success = true;
						$this-&amp;gt;returnedData = $parsed_xml;
						
					}
					else
					{
						$this-&amp;gt;success = true;
						$this-&amp;gt;returnedData = $response;
					}
				}
				
			}
		}
	}
	
	function buildRequestString()
	{
		/**
		 * Return an error if server not set.
		 */
		if(!$this-&amp;gt;server)
		{
			$this-&amp;gt;error = 'Server not set.';
			return false;
		}
		
		$request = $this-&amp;gt;server;
		
		if(!empty($this-&amp;gt;params))
		{
			$request.= '?';
			
			// Build request string out of params.
			foreach($this-&amp;gt;params as $var =&amp;gt; $val)
			{
				$request .= $var.'='.urlencode($val).'&amp;amp;';
			}
			// remove trailing '&amp;amp;'
			$request = substr($request,0,-1);
		}
		
		$this-&amp;gt;requestString = $request;
		return array('success'=&amp;gt;1);
		
	}
	
	function setParams($params=null)
	{
		if(is_array($params))
		{
			$this-&amp;gt;params = $params;
		}
	}
	
	function addParams($params=null)
	{
		if(is_array($this-&amp;gt;params))
		{
			$this-&amp;gt;params = array_merge($this-&amp;gt;params,$params);
		}
		else 
		{
			$this-&amp;gt;params = $params;
		}
	}	
}

?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='cutid1-end'&gt;&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:1632</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/1632.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=1632"/>
    <title>google maps</title>
    <published>2006-08-09T15:51:16Z</published>
    <updated>2006-08-09T15:51:16Z</updated>
    <category term="google maps"/>
    <content type="html">I've started work on my own Google Maps helper/component... I was using the helper created by rd11, but found it to be kind of limiting... I should have this done in the next day or two, and will be passing it along</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:1370</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/1370.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=1370"/>
    <title>validating models without a database table</title>
    <published>2006-08-04T22:51:45Z</published>
    <updated>2006-08-11T00:11:42Z</updated>
    <category term="validation"/>
    <content type="html">occasionally, elements of my cake apps call for forms to be validated that aren't linked to a database table - for instance a Contact form that emails the form to a certain email address, as opposed to logging contacts in a database.  You would probably want to be sure that the user has filled in all of the necessary information before creating and sending the email.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;my contact model: contains a validate array for standard cake validation&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To use a model without a corresponding database table, you use $Model-&amp;gt;useTable = false;...&lt;br /&gt;&lt;br /&gt;&lt;pre style="padding: 15px; background-color: #cccccc;"&gt;
&amp;lt;?php

class Contact extends AppModel 
{
	var $name = 'Contact';
	var $useTable = false;
	
	var $validate = array(
		'name' =&amp;gt; VALID_NOT_EMPTY,
		'email' =&amp;gt; VALID_EMAIL,
		'message' =&amp;gt; VALID_NOT_EMPTY
	);
}

?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;my contact controller&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="padding: 15px; background-color: #cccccc; overflow: auto"&gt;
&amp;lt;?php

class ContactController extends AppController 
{
	var $name = 'Contact';
	var $uses = array('Contact');
	var $components = array('Email','Output'); // uses Email and Output components from rdOS

	function index()
	{
		
		if(empty($this-&amp;gt;data))
		{
			// no data has been passed to page from form
			$this-&amp;gt;render();
		}
		else 
		{
			// data has been passed from form
			
			// validate model using -&amp;gt;validates() not -&amp;gt;save()
			if($this-&amp;gt;Contact-&amp;gt;validates($this-&amp;gt;data))
			{
				// Validation passed
				$this-&amp;gt;Sanitize-&amp;gt;cleanArray($this-&amp;gt;data);
				
				$defaultLayout  = $this-&amp;gt;layout;
				$this-&amp;gt;layout = 'email';
				$this-&amp;gt;Email-&amp;gt;headers = &amp;quot;Content-type: text/plain; charset=iso-8859-1\n&amp;quot;;
				$this-&amp;gt;Email-&amp;gt;to = &amp;quot;email@server.com&amp;quot;;
				$this-&amp;gt;Email-&amp;gt;from = $this-&amp;gt;data['Contact']['name'].' &amp;lt;'.$this-&amp;gt;data['Contact']['email'].'&amp;gt;';
				$this-&amp;gt;Email-&amp;gt;subject = 'website contact';
				$this-&amp;gt;Email-&amp;gt;thtml = 'email_layout';
				$this-&amp;gt;Email-&amp;gt;controller = &amp;amp;$this;
				$this-&amp;gt;set('data',$this-&amp;gt;data);
				$this-&amp;gt;Email-&amp;gt;send();				

				$this-&amp;gt;set('sent',1);
				$this-&amp;gt;render('index',$defaultLayout);
			}
			else 
			{
				// Validation failed
				$this-&amp;gt;validateErrors($this-&amp;gt;Contact); // for triggering $html-&amp;gt;tagErroMsg()
			}
		}
		
		/*					
		$this-&amp;gt;set('email', $this-&amp;gt;data['User']['email']);
		$this-&amp;gt;set('password', $passwordOrig);

		//Send email
		

		*/
		
	}
	
}

?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;views/contact/index.thtml - my contact form view file&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="padding: 15px; background-color: #cccccc; overflow: auto"&gt;
&amp;lt;div class=&amp;quot;page-content&amp;quot; id=&amp;quot;contact&amp;quot;&amp;gt;
&amp;lt;div id=&amp;quot;page-header-img&amp;quot;&amp;gt;&amp;lt;?php echo $html-&amp;gt;image('layout/header-generic-sm.jpg',array('alt'=&amp;gt;'contact us'))?&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;?php if(isset($sent)): ?&amp;gt;

&amp;lt;fieldset id=&amp;quot;left&amp;quot; style=&amp;quot;height: 300px;&amp;quot;&amp;gt;
	
	&amp;lt;div class=&amp;quot;set-row&amp;quot; id=&amp;quot;header&amp;quot;&amp;gt;
		&amp;lt;div class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;label&amp;gt;Thank &amp;lt;strong&amp;gt;you&amp;lt;/strong&amp;gt;&amp;lt;/label&amp;gt;&amp;lt;/div&amp;gt;
	&amp;lt;/div&amp;gt;
	
	
	&amp;lt;div class=&amp;quot;set-row&amp;quot; id=&amp;quot;submit&amp;quot;&amp;gt;
		&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;We have received your message.&amp;lt;/p&amp;gt;
		&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt; If a response was requested, a member of our staff &amp;lt;br/&amp;gt;will follow up with you as soon as possible.&amp;lt;/p&amp;gt;
	&amp;lt;/div&amp;gt;
&amp;lt;/fieldset&amp;gt;

&amp;lt;?php else: ?&amp;gt;


&amp;lt;fieldset id=&amp;quot;left&amp;quot;&amp;gt;
	&amp;lt;?php echo $html-&amp;gt;formTag('/contact') ?&amp;gt;	

	&amp;lt;div class=&amp;quot;set-row&amp;quot; id=&amp;quot;header&amp;quot;&amp;gt;
		&amp;lt;div class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;label&amp;gt;Contact &amp;lt;strong&amp;gt;us&amp;lt;/strong&amp;gt;&amp;lt;/label&amp;gt;&amp;lt;/div&amp;gt;
	&amp;lt;/div&amp;gt;

	&amp;lt;div class=&amp;quot;set-row&amp;quot;&amp;gt;
		&amp;lt;div class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;label&amp;gt;your name:&amp;lt;/label&amp;gt;&amp;lt;/div&amp;gt;
		&amp;lt;div class=&amp;quot;input&amp;quot;&amp;gt;
			&amp;lt;?php echo $html-&amp;gt;input('Contact/name',array('class'=&amp;gt;'text')) ?&amp;gt;
			&amp;lt;?php echo $html-&amp;gt;tagErrorMsg('Contact/name','your name is required') ?&amp;gt;
		&amp;lt;/div&amp;gt;
		&amp;lt;div class=&amp;quot;clear&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;
	&amp;lt;/div&amp;gt;
	
	&amp;lt;div class=&amp;quot;set-row&amp;quot;&amp;gt;
		&amp;lt;div class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;label&amp;gt;email:&amp;lt;/label&amp;gt;&amp;lt;/div&amp;gt;
		&amp;lt;div class=&amp;quot;input&amp;quot;&amp;gt;
			&amp;lt;?php echo $html-&amp;gt;input('Contact/email',array('class'=&amp;gt;'text')) ?&amp;gt;
			&amp;lt;?php echo $html-&amp;gt;tagErrorMsg('Contact/email','you must provide a valid email address') ?&amp;gt;
		&amp;lt;/div&amp;gt;
		&amp;lt;div class=&amp;quot;clear&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;
	&amp;lt;/div&amp;gt;

	&amp;lt;div class=&amp;quot;set-row&amp;quot;&amp;gt;
		&amp;lt;div class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;label&amp;gt;message:&amp;lt;/label&amp;gt;&amp;lt;/div&amp;gt;
		&amp;lt;div class=&amp;quot;input&amp;quot;&amp;gt;
			&amp;lt;?php echo $html-&amp;gt;textarea('Contact/message') ?&amp;gt;
			&amp;lt;?php echo $html-&amp;gt;tagErrorMsg('Contact/message','you must write a message') ?&amp;gt;
		&amp;lt;/div&amp;gt;
		&amp;lt;div class=&amp;quot;clear&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;
	&amp;lt;/div&amp;gt;		
	
	&amp;lt;div class=&amp;quot;set-row&amp;quot; id=&amp;quot;submit&amp;quot;&amp;gt;
		&amp;lt;div class=&amp;quot;input&amp;quot;&amp;gt;&amp;lt;?php echo $html-&amp;gt;submit('send message',array('class'=&amp;gt;'submit')) ?&amp;gt;&amp;lt;/div&amp;gt;
	&amp;lt;/div&amp;gt;
&amp;lt;/fieldset&amp;gt;
&amp;lt;/form&amp;gt;

&amp;lt;?php endif; ?&amp;gt;

&amp;lt;fieldset id=&amp;quot;right&amp;quot;&amp;gt;
&amp;lt;?php echo $html-&amp;gt;image('layout/contact-inset.jpg') ?&amp;gt;
&amp;lt;/fieldset&amp;gt;

&amp;lt;div class=&amp;quot;clear&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;


&amp;lt;/div&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;/views/contact/email_layout.thtml&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="padding: 15px; background-color: #cccccc"&gt;
Website Contact
-------------------------------------------------------------------------

From: &amp;lt;?php echo $data['Contact']['name'] ?&amp;gt; &amp;lt;?php echo $data['Contact']['email'] ?&amp;gt;


Message:
&amp;lt;?php echo $data['Contact']['message'] ?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That's about it.  I could also use the extra Model-&amp;gt;invalidate() validation method discussed in my previous post in my Contact Controller ex.-&amp;gt; $this-&amp;gt;Contact-&amp;gt;invalidate('name_length')&lt;br /&gt;&lt;br /&gt;This isn't anything very complex, but something I run into occasionally.&lt;br /&gt;&lt;br /&gt;&lt;a name='cutid1-end'&gt;&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:1165</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/1165.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=1165"/>
    <title>another validation approach?</title>
    <published>2006-06-14T17:27:24Z</published>
    <updated>2006-06-14T17:27:24Z</updated>
    <category term="validation"/>
    <content type="html">yes... another... and this one I believe is actually Cake-"recommended"&lt;br /&gt;&lt;br /&gt;up until now I've been using the following:&lt;br /&gt;&lt;a target='_blank' href='http://wiki.cakephp.org/tutorials:complex_model_validation_routines' rel='nofollow'&gt;http://wiki.cakephp.org/tutorials:complex_model_validation_routines&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;This method is not officially cake-supported, but I liked the flexibility it gave in customizing error messages for invalid fields.&lt;br /&gt;&lt;br /&gt;Here's another method I tinkered with at some point too: &lt;a target='_blank' href='http://cakebaker.wordpress.com/2006/02/06/yet-another-data-validation-approach/' rel='nofollow'&gt;http://cakebaker.wordpress.com/2006/02/06/yet-another-data-validation-approach/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Both were nice and flexible, but a little over-complicated, and not extremely "strict MVC".&lt;br /&gt;&lt;br /&gt;Gwoo has recently turned me on to the Model::invalidate() method, which is new to 1.0 I believe, and after a bit of playing last night, it seems to work quite well, and is extremely simple to implement.&lt;br /&gt;&lt;br /&gt;You can try and piece together some information about it &lt;a href="http://cakephp.org/search?q=invalidate" target="_blank" rel="nofollow"&gt;here&lt;/a&gt; and &lt;a href="http://groups.google.com/group/cake-php/browse_thread/thread/bec26338072a9e9b/7a47a67e615563ba?q=invalidate&amp;amp;rnum=2#7a47a67e615563ba" target="_blank" rel="nofollow"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the above google groups link there's an expanded method where someone hacked the invalidates() function to also accept error messages (so the messages could be passed to the error display, instead of residing in the view) however, I could not get the hacked way to work properly.  The basic invalidates() work very well tho, and plays nicely with the simple, traditional Cake validation method of having a $validate array in your model, something the other complex validation methods override.  &lt;br /&gt;&lt;br /&gt;Another point of note is that you can invalidate fields that aren't in your model (such as 'username_taken' or 'image_filesize') and display these errors accordingly in your view.  Also, this method plays nice with the regular $html-&amp;gt;tagErrorMsg() and doesn't require any additional helpers or edits to app_model.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In my model:&lt;/strong&gt;&lt;br /&gt;&lt;pre style="padding: 50px; background-color: #bbbbbb"&gt;
// basic model validation
var $validate = array(
	'username' =&amp;gt; VALID_NOT_EMPTY,
	'password' =&amp;gt; VALID_NOT_EMPTY 
);

// complex validation
function beforeValidate()
{
	if(!empty($this-&amp;gt;data[$this-&amp;gt;name]['username']) &amp;amp;&amp;amp; ( strlen($this-&amp;gt;data[$this-&amp;gt;name]['username']) &amp;gt; MAX_USERNAME_LEN || strlen($this-&amp;gt;data[$this-&amp;gt;name]['username']) &amp;lt; MIN_USERNAME_LEN ))
	{
		$this-&amp;gt;invalidate('username');
	}

	if(!empty($this-&amp;gt;data[$this-&amp;gt;name]['password']) &amp;amp;&amp;amp; ( strlen($this-&amp;gt;data[$this-&amp;gt;name]['password']) &amp;gt; MAX_PWD_LEN || strlen($this-&amp;gt;data[$this-&amp;gt;name]['password']) &amp;lt; MIN_PWD_LEN ))
	{
		$this-&amp;gt;invalidate('password');
	}		
	
	if(isset($this-&amp;gt;data[$this-&amp;gt;name]['password']) &amp;amp;&amp;amp; ($this-&amp;gt;data[$this-&amp;gt;name]['password'] != $this-&amp;gt;data[$this-&amp;gt;name]['reppass']))
	{
		$this-&amp;gt;invalidate('reppass');
	}

	// Userpic Validation
	if(isset($this-&amp;gt;data[$this-&amp;gt;name]['userpic_type']) &amp;amp;&amp;amp; !empty($this-&amp;gt;data[$this-&amp;gt;name]['userpic_type']))
	{
		$validTypes = explode(',',VALID_IMAGE_TYPES);
		debug($validTypes);
		debug($this-&amp;gt;data[$this-&amp;gt;name]['userpic_type']);
		if(!in_array($this-&amp;gt;data[$this-&amp;gt;name]['userpic_type'],$validTypes))
		{
			$this-&amp;gt;invalidate('userpic', 'Invalid File Format.');
		}			
	}		
	
	// i believe return true is necessary to move everything along to the next step
	return true;
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In my view:&lt;/strong&gt;&lt;br /&gt;&lt;pre style="padding: 50px; background-color: #bbbbbb"&gt;
&amp;lt;div class=&amp;quot;set-column&amp;quot;&amp;gt;
	&amp;lt;div class=&amp;quot;label&amp;quot;&amp;gt;
		&amp;lt;label&amp;gt;Username:&amp;lt;/label&amp;gt; required, unique, &amp;lt;?php echo MIN_USERNAME_LEN ?&amp;gt; to &amp;lt;?php echo MAX_USERNAME_LEN ?&amp;gt; characters
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;input&amp;quot;&amp;gt;
		&amp;lt;?php echo $html-&amp;gt;input('User/username') ?&amp;gt; 
		&amp;lt;?php echo $html-&amp;gt;tagErrorMsg('User/username', 'Invalid Username.') ?&amp;gt;
		&amp;lt;?php echo $html-&amp;gt;tagErrorMsg('User/username_taken', 'Username already taken.') ?&amp;gt;
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;clear&amp;quot;&amp;gt;&amp;amp;nbsp&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div class=&amp;quot;set-column&amp;quot;&amp;gt;
	&amp;lt;div class=&amp;quot;label&amp;quot;&amp;gt;
		&amp;lt;label&amp;gt;Password:&amp;lt;/label&amp;gt; required, &amp;lt;?php echo MIN_PWD_LEN ?&amp;gt; to &amp;lt;?php echo MAX_PWD_LEN ?&amp;gt; characters
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;input&amp;quot;&amp;gt;
		&amp;lt;?php echo $html-&amp;gt;password('User/password', array('id' =&amp;gt; 'user_password')) ?&amp;gt; 
		&amp;lt;?php echo $html-&amp;gt;tagErrorMsg('User/password','Invalid Password.') ?&amp;gt;
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;clear&amp;quot;&amp;gt;&amp;amp;nbsp&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div class=&amp;quot;set-column&amp;quot;&amp;gt;
	&amp;lt;div class=&amp;quot;label&amp;quot;&amp;gt;
		&amp;lt;label&amp;gt;Repeat Password:&amp;lt;/label&amp;gt; required
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;input&amp;quot;&amp;gt;
		&amp;lt;?php echo $html-&amp;gt;password('User/reppass', array('id' =&amp;gt; 'user_reppass')) ?&amp;gt; 
		&amp;lt;?php echo $html-&amp;gt;tagErrorMsg('User/reppass','Passwords do not match.') ?&amp;gt;

	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;clear&amp;quot;&amp;gt;&amp;amp;nbsp&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;	
&amp;lt;div class=&amp;quot;set-column&amp;quot;&amp;gt;
	&amp;lt;div class=&amp;quot;label&amp;quot;&amp;gt;
		&amp;lt;label&amp;gt;Your Userpic:&amp;lt;/label&amp;gt; will be resized to fit 100x100 pixels (and a 50x50 pixel thumbnail)
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;input&amp;quot;&amp;gt;
		&amp;lt;?php echo $html-&amp;gt;file('userpic',  array('size'=&amp;gt;40)) ?&amp;gt; 
		&amp;lt;?php echo $html-&amp;gt;tagErrorMsg('User/userpic', 'Invalid file format.') ?&amp;gt;
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;clear&amp;quot;&amp;gt;&amp;amp;nbsp&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;	
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In my controller: &lt;/strong&gt;&lt;br /&gt;&lt;pre style="padding: 50px; background-color: #bbbbbb"&gt;
// check if userpic uploaded, and if so, check that it is in a valid format
if(!empty($this-&amp;gt;params['form']['userpic']['tmp_name']))
{
	$this-&amp;gt;data['User']['userpic_type'] = $this-&amp;gt;params['form']['userpic']['type'];
}

// check if Username is unique
if(!empty($this-&amp;gt;data['User']['username']))
{
	$user = $this-&amp;gt;User-&amp;gt;findByUsername($this-&amp;gt;data['User']['username']);
	if(!empty($user['User']['username']))
	{
		$this-&amp;gt;User-&amp;gt;invalidate('username_taken');
	}
}
		
//if($this-&amp;gt;User-&amp;gt;save($this-&amp;gt;data))
if($this-&amp;gt;User-&amp;gt;save($this-&amp;gt;data))
{
  // do some more stuff
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Hopefully someone finds this useful!&lt;br /&gt;&lt;br /&gt;&lt;a name='cutid1-end'&gt;&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:786</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/786.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=786"/>
    <title>a step beyond bindModel</title>
    <published>2006-06-13T20:09:38Z</published>
    <updated>2006-06-13T20:11:30Z</updated>
    <category term="associations"/>
    <content type="html">I frequently use variations on the "bindComment" method gwoo wrote about here: &lt;a target='_blank' href='http://rd11.com/posts/view/19' rel='nofollow'&gt;http://rd11.com/posts/view/19&lt;/a&gt; - this cuts down on load-time a bit by not, for instance, always loading attached Comments wherever I load a Post (without having to specify recursive = 0);  then in my PostsController-&amp;gt;view() I can say $this-&amp;gt;Post-&amp;gt;attachComment();&lt;br /&gt;&lt;br /&gt;I recently noticed, however, that objects in a 'dependent' association weren't always 'automagically' being deleted...  what I did was add $model-&amp;gt;bindModel(); in $model-&amp;gt;beforeDelete() and it completely fixed the problem...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="padding: 15px; background-color: #dddddd;"&gt;
&amp;lt;?php
class User extends AppModel
{
	var $name = 'User';
	
	// taken from gwoo
	function bindComment ($conditions = null, $order = 'created DESC', $limit = null, $page = '1')
	{
		$this-&amp;gt;bindModel(array(
			'hasMany' =&amp;gt; array(
				'Comment' =&amp;gt; array(
					'className' =&amp;gt; 'Comment',
					'conditions' =&amp;gt; $conditions,
					'order' =&amp;gt; $order,
					'limit' =&amp;gt; $limit,
					'foreignKey' =&amp;gt; 'user_id',
					'dependent' =&amp;gt; true,
					'exclusive' =&amp;gt; false,
					'finderSql' =&amp;gt; '',
					'counterSql' =&amp;gt; ''
				)
			)
		));
	}
	
	function beforeDelete()
	{
		if(parent::beforeDelete())
		{
			// attach comment model to user so all user's comments get wiped on -&amp;gt;del
			$this-&amp;gt;bindComment();

			// do other stuff...
			
			// continue w/ delete
			return true;
		}
	}
}
?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='cutid1-end'&gt;&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:cakephp:639</id>
    <link rel="alternate" type="text/html" href="https://cakephp.livejournal.com/639.html"/>
    <link rel="self" type="text/xml" href="https://cakephp.livejournal.com/data/atom/?itemid=639"/>
    <title>simple image manipulation component</title>
    <published>2006-06-12T20:16:38Z</published>
    <updated>2006-08-17T15:44:17Z</updated>
    <category term="component"/>
    <category term="images"/>
    <category term="gd"/>
    <content type="html">I wrote a little component for handling a couple common image sizing needs (creating thumbnails, resizing to a max width/height)&lt;br /&gt;&lt;br /&gt;requires gd2&lt;br /&gt;&lt;br /&gt;EDIT 6/21: Added some more bugfixes and another method&lt;br /&gt;&lt;br /&gt;EDIT 8/17: Made some more changes...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="padding: 15px; background-color: #dddddd;"&gt;
&amp;lt;?php

/**
 * Some handy functions for manipulating images.
 * Requires GD (I believe at least GD2...)
 *
 * @author Ryan Clark &amp;lt;clark.ryan@gmail.com&amp;gt;
 * @version 0.0.4
 *  - 0.0.2 bugfix
 *  - 0.0.3 added maxDimension
 *  - 0.0.4 internalized supported filetypes, added supportedFiletype()
 */
class ImageComponent extends Object
{
	
	var $supportedFiletypes = array('gif','jpeg','pjpeg','png');
	
	var $outputType = 'jpg';
	var $extension = '.jpg';
	
    function startup(&amp;amp;$controller)
    {
        // This method takes a reference to the controller which is loading it.
        // Perform controller initialization here.
    }
    
    /**
     * Returns an image resource from a supplied file of type &amp;quot;$type&amp;quot;
     *
     * @param resource $file
     * @param string $type
     * @return resource|boolean
     */
    function createFrom($file,$type)
    {
    	if(substr($type,0,6) == 'image/')
    	{
    		$explode = explode('/',$type);	
    		$type = $explode[1];
    	}
    	    	
    	
       switch($type)
       {
           case 'jpeg':
           return imagecreatefromjpeg($file);
           break;

           case 'pjpeg':
           return imagecreatefromjpeg($file);
           break;
           
           case 'gif';
           return imagecreatefromgif($file);
           break;
           
           case 'png':
           return imagecreatefrompng($file);
           break;
           
           default:
           	return null;
           	break;
       }
       
    }

       
    function supportedFiletype($type)
    {
    	if(in_array($type,$this-&amp;gt;supportedFiletypes))
    	{
    		return true;
    	}
    	else 
    	{
    		return false;
    	}
    }
    
    /**
     * Fits an image to either a max width or height or both.
     * Resizes image to fit proportionally - doesn't crop.
     *
     * @param resource $filein file being modified
     * @param resource $filetype filein's filetype
     * @param resource $fileout file being written
     * @param integer $width max width
     * @param integer $height max height
     * @param integer $quality output jpeg quality - default 75
     * @param integer $resample if 1 use resample (better quality), if 0 use resize (faster)
     * 
     * @return boolean
     */
    function fitTo($filein,$filetype,$fileout,$width=null,$height=null,$quality=75,$resample=1)
    {
    	// make sure at least width or height was passed in
    	if($width == null &amp;amp;&amp;amp; $height == null)
    	{
    		return null;    		
    	}
    	
    	$new_width = null;
    	$new_height = null;
    	$width_orig = null;
    	$height_orig = null;
    	$orig_image = null;
    	
    	$orig_image = $this-&amp;gt;createFrom($filein,$filetype);
    	list($width_orig, $height_orig) = getimagesize($filein);
    	
    	if(($width &amp;amp;&amp;amp; !$height) || (($width &amp;amp;&amp;amp; $height) &amp;amp;&amp;amp; ($width_orig &amp;gt;= $height_orig)))
    	{
			// if width set and not height,
			// -OR- width &amp;amp; height are set and original document width &amp;gt; original document height
			// size width to passed in width and scale height proportionally
    		$new_width = $width;
    		$prcnt_change = $width / $width_orig;
    		$new_height = $height_orig * $prcnt_change;
    	}
    	elseif($height &amp;amp;&amp;amp; !$width || (($width &amp;amp;&amp;amp; $height) &amp;amp;&amp;amp; ($height_orig &amp;gt;= $width_orig)))
    	{
			// if height set and not width,
			// -OR- width &amp;amp; height are set and original document height &amp;gt; original document width
			// size height to passed in height and scale width proportionally
    		$new_height = $height;
    		$prcnt_change = $height / $height_orig;
    		$new_width = $width_orig * $prcnt_change;
    	}
    	else
    	{
			// no width and no height - should've been caught above,
			// but just in case, return null
			return null;    		
    	}
    	
    	$sized_image = imagecreatetruecolor($new_width, $new_height);
    	if($resample)
    	{
    		// better quality output
    		imagecopyresampled($sized_image,$orig_image,0,0,0,0,$new_width,$new_height,$width_orig,$height_orig);
    	}
    	else
    	{
    		// faster
    		imagecopyresize($sized_image,$orig_image,0,0,0,0,$new_width,$new_height,$width_orig,$height_orig);
    	}
    	
    	// output
    	return imagejpeg($sized_image,$fileout,$quality);
    	
    }
 
	/**
	 * Crops image to passed in height &amp;amp; width.
	 * Automatically detects width &amp;lt;&amp;gt; height and sizes larger dimension first,
	 * then crops the other.
	 *
	 * @param resource $filein file being modified
	 * @param resource $filetype type of file being modified
	 * @param resource $fileout file being written
	 * @param integer $imagethumbsize_w desired width 
	 * @param integer $imagethumbsize_h desired height
	 * @param integer $quality output quality - default 75
	 * @param integer $resample if 1 use resample (better quality), if 0 use resize (faster); default 1 
	 * @param integer $red ? - i believe these control the output color levels; i have all default to 255
	 * @param integer $green ?
	 * @param integer $blue ?
	 * 
	 * @return boolean
	 */
	function resize_then_crop($filein,$filetype,$fileout,$imagethumbsize_w,$imagethumbsize_h,$quality=75,$resample=1,$red=255,$green=255,$blue=255)
	{
			  
		$image = $this-&amp;gt;createFrom($filein,$filetype);
		
		$width = $imagethumbsize_w ;
		$height = $imagethumbsize_h ;
		list($width_orig, $height_orig) = getimagesize($filein);
		
		if ($width_orig &amp;lt; $height_orig) {
		  $height = ($imagethumbsize_w / $width_orig) * $height_orig;
		} else {
		   $width = ($imagethumbsize_h / $height_orig) * $width_orig;
		}
		
		if ($width &amp;lt; $imagethumbsize_w)
		//if the width is smaller than supplied thumbnail size
		{
		$width = $imagethumbsize_w;
		$height = ($imagethumbsize_w/ $width_orig) * $height_orig;
		}
		
		if ($height &amp;lt; $imagethumbsize_h)
		//if the height is smaller than supplied thumbnail size
		{
		$height = $imagethumbsize_h;
		$width = ($imagethumbsize_h / $height_orig) * $width_orig;
		}
		
		$thumb = imagecreatetruecolor($width , $height); 
		$bgcolor = imagecolorallocate($thumb, $red, $green, $blue); 
		ImageFilledRectangle($thumb, 0, 0, $width, $height, $bgcolor);
		imagealphablending($thumb, true);
		
		if($resample)
		{
			imagecopyresampled($thumb, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);	
		}
		else
		{
			imagecopyresized($thumb, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);	
		}
		
		$thumb2 = imagecreatetruecolor($imagethumbsize_w , $imagethumbsize_h);
		// true color for best quality
		$bgcolor = imagecolorallocate($thumb2, $red, $green, $blue); 
		ImageFilledRectangle($thumb2, 0, 0,
		$imagethumbsize_w , $imagethumbsize_h , $bgcolor);
		imagealphablending($thumb2, true);
		
		$w1 =($width/2) - ($imagethumbsize_w/2);
		$h1 = ($height/2) - ($imagethumbsize_h/2);
		
		if($resample)
		{
			imagecopyresampled($thumb2, $thumb, 0,0, $w1, $h1, $imagethumbsize_w , $imagethumbsize_h ,$imagethumbsize_w, $imagethumbsize_h);
		}
		else
		{
			imagecopyresized($thumb2, $thumb, 0,0, $w1, $h1, $imagethumbsize_w , $imagethumbsize_h ,$imagethumbsize_w, $imagethumbsize_h);
		}
		
		// Output
		return imagejpeg($thumb2,$fileout,$quality); 
	}
	
	/**
	 * Resizes image proportionally to a max dimension.
	 * Sets height or width to $size, whichever dimension is larger.
	 */
	function maxDimension($filein, $filetype, $fileout, $size)
	{
		// check which dimenion greater
		list($width_orig, $height_orig) = getimagesize($filein);
		
		if($width_orig &amp;gt;= $height_orig)
		{
			// fit to width = $size
			$this-&amp;gt;fitTo($filein, $filetype, $fileout, $width=$size, $height=null);
		}
		else
		{
			// fit to height = $size
			$this-&amp;gt;fitTo($filein, $filetype, $fileout, $width=null, $height=$size);
		}
	}
}

?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='cutid1-end'&gt;&lt;/a&gt;</content>
  </entry>
</feed>
