Placed in: Home arrow Programming arrow Building a blog with CakePHP - Part 1: Getting started
Building a blog with CakePHP - Part 1: Getting started

For those people that are following me already on Twitter will know that I'm working with the amazing CakePHP framework on my webdevelopment / webdesign job.

CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. Using commonly known design patterns like MVC and ORM within the convention over configuration paradigm, CakePHP reduces development costs and helps developers write less code.

This tutorial will give you a good start in the world of CakePHP, just to learn the basics of the framework. The official CakePHP Blog tutorial (For Cake 1.1) gives you a good idea, but this tutorial will take it a couple of steps further (and in the next parts way beyond the official tutorial). Don't worry: This article will perfectly guide to making your first steps on baking some code.

Building a blog with CakePHP

Download the source code I created directly if you don't want to write anything yourself, but still want to learn. I do recommend you to read the full article to understand the whole code. Take note that this tutorial is written for Cake version 1.2 (Using 1.2.0.7692 RC3 to be precise).

Download the source code for this tutorial

There we go! Strap on your cooks hat; We're going to bake some delicious Blog-cake.

The setup

First, download and install the latest release of Cake. NETTUTS created an excellent article how to get started with the framework. I suggest that you read the article, set up your database connection and get it running.

For the database, we're going to use the following MySQL script. You can execute this in your phpMyAdmin.

 
CREATE TABLE IF NOT EXISTS `blogs` (
  `id` int(255) NOT NULL auto_increment,
  `date` date NOT NULL,
  `title` varchar(255) NOT NULL,
  `introtext` text NOT NULL,
  `maintext` text NOT NULL,
  PRIMARY KEY  (`id`)
)

We'll now fill the database with some sample data.

 
INSERT INTO `blogs` (`id`, `date`, `title`, `introtext`, `maintext`) VALUES
(1, '2008-10-24', 'My first blog post', '<h1>Hello World!</h1>\r\n<p>This
is my first article using the CakePHP framework. I hope you like it.</p>',
'<h2>This text will only be visible on the second page.</h2>\r\n<h3>It''s
just like how <a href="http://joomla.org/" title="Joomla! CMS">Joomla!</a> works!</h3>'),
(2, '2008-10-27', '2nd article', '<p>This is my second article, just to
test the amazingly cool CakePHP framework.</p>', '<p>Even the <em>read more</em> works!</p>'),
(3, '2008-11-02', 'Last article', '<p>Sorry guys, this will be my last
article. Make sure you check out <a href="http://www.marcofolio.net/" 
title="Marcofolio">Marcofolio</a> for more interesting articles!</p>', '<p>
And in the future: Making this blog bigger & better!</p>');

OK, all preperations are made: Let's get down to business and code some PHP. Comments are added in some sections to explain what the code does.

Clearing the errors

We can easily create a blog in the /blog/ section of the site (The URL will look like this: http://yourdomain.com/blog/). You must remember the syntax of an URL for CakePHP: http://yourdomain.com/CONTROLLER/FUNCTION/ARG1/ARG2/ etc. Anyway, when you now visit the /blog/ section of your site, you'll see the following error (with the default download package).

Building a blog with CakePHP 01

What a nice error message! It's telling us that Cake is missing the BlogController, together with the filename it's searching for and the default code. Let's follow this error message by creating a "blog_controller.php" file in the app/controllers directory. This file will have the following code:

 
<?php
class BlogController extends AppController {
 
  var $name = 'Blog';
  
  // Used when indexing the page (http://yourdomain.com/blog/)
  function index() {
 
  }
}
?>

When done correctly, the following error should show up: The view is missing.

Building a blog with CakePHP 02

To fix this problem, go to your app/views folder. Create a new folder called blog inside of the views folder. Inside the /blog/ folder, create a file called index.ctp (CTP = Cake Template). Leave the file empty for now.

Pfew, all of the errors are gone now. Now we can really start writing some code.

The "Blog" model

The model in a MVC-pattern (Model-View-Controller) represents the storage type. In Cake, the model is the final place before data enteres the actual database (or the first when data is retrieved from the database). We want to create a Blog model to retrieve Blog data from the database.

To achieve this, create blog.php inside the app/models folder. This file will contain the following code:

 
<?php
class Blog extends AppModel
{
  var $name = 'Blog';
  var $primaryKey = 'id';
}
?>

Now we'll have to "tell" the controller to use the model. To do so, add the following line to your blog_controller.php, right under the $name variable.

 
var $uses = array('Blog');

To check if the controller is now connected to the model, change your blog_controller.php and add the following inside the index() function:

debug($this->Blog->findAll());

This code will ask the Blog-model to do a "findAll()" (standard model function in CakePHP) to retrieve all the data the model can get from the database (in this case: Everything from the "blogs" table). The debug() function will give you a human readable output to check your output.

When you now visit your blog (http://yourdomain.com/blog/), you should be able to read all information from the "blogs" table in your database in several arrays. If so, we can move on!

Controller to view

The controller now has a connection with the correct model. Now we'll need to connect the controller information with the view. To do so, add the following line to your index() function of blog_controller.php:

 
$this->set('articles', $this->Blog->findAll());

Now the "articles" variable for the object "Blog" will contain all blog posts retrieved from the database. Open the index.ctp file, located in views/blog. To test if it worked, add the following line to the file:

 
<?php debug($articles) ?>

When you now view the page in your browser (http://yourdomain.com/blog/), you should once again see all articles in the form of an array. There is one difference from the previous version tough: You're now getting the data from the view.

Delete the "debug()" in your index.ctp file to create a real view. This is how a view for the blog could look like.

 
<div id="blog">
<?php foreach ($articles as $article) { ?>
    <div class="article">
    <h1><a href="blog/index/<?= $article['Blog']['id'] ?>"
    title="<?= $article['Blog']['title'] ?>"><?= $article['Blog']['title'] ?></a></h1>
    <p class="date"><?= $article['Blog']['date'] ?></p>
    <p><?= $article['Blog']['introtext'] ?><a 
    href="blog/index/<?= $article['Blog']['id'] ?>" title="<?= $article['Blog']['title'] ?>"
    class="readon">Read more...</a></p>
    </div>
<?php } ?>
</div>

When you now look at your /blog/, you would now be able to really see your blog alive! This is starting to get somewhere, doesn't it.

Building a blog with CakePHP 03

The "view" parameter

As you now can see, the title and the "read more..." are linked to the following URL: http://yourdomain.com/blog/ID, where ID is the ID of the article. This is the URL to show the full article.

To make this work, we'll need to make changes to the controller and add a view. We'll start with the controller, so open blog_controller.php. Make the following changes to your index() function:

 
function index($view = null) {
    // What to do if a view is set
    if (isset($view))
    {
      $this->set('article', $this->Blog->find("id = $view"));
      $this->render('article');
    }
    else
    {
      $this->set('articles', $this->Blog->findAll());
    }
  }

Let me get into some detail on this one. The $view = null tells CakePHP that this parameter is optional. Using isset() you can check if the $view paramter has been set. If none is found, we'll do a findAll() on the model to retrieve all data and render the index.ctp view.

If the view is set, we'll find the article by using the ID (by asking it to the model) and we'll render the "article" layout. "But there isn't an article layout?" I hear you say. Correct: We'll need to create it. So, create a article.ctp inside the app/views/blog/ folder. Use the debug($article) function to check if the article is loaded.

Assuming everything went well, we can now create the layout for the "article" view. This is how it could look like.

 
<div id="article">
<h1><?= $article['Blog']['title'] ?></h1>
<p class="date"><?= $article['Blog']['date'] ?></p>
<p class="intro"><?= $article['Blog']['introtext'] ?></p>
<p class="main"><?= $article['Blog']['maintext'] ?></p>
</div>

When you now visit the page that contains all the articles (http://yourdomain.com/blog/) and click on one of the titles (or the "read more..." link), you should be able to see the full article (http://yourdomain.com/blog/index/1, where 1 is the ID of the article).

Building a blog with CakePHP 04

Altering the layout & Styling with CSS

So far, we've been using the default layout that comes with CakePHP and no CSS styling was used. Let's change that, making it our real own blog.

We already know that our code is working, so we'll not need to debug anymore or see the queries executed. Open core.php located in app/config. Search for Configure::write('debug', 2); and change the "2" to a "0".

Create a new layout file called default.ctp in the app/views/layouts folder. Add the following code to that file.

 
<html>
<head>
<title>My first CakePHP blog</title>
<?= $html->css('default'); ?>
</head>
<body>
<?= $content_for_layout ?>
</body>
</html>

Make sure you add the DOCTYPE and xmlns etc. to make it valid. In the download code it is set correct, but I had to trim it down here a bit.

Anyway, when you now view your blog (single article and total view) in your browser, you should be able to only see plain HTML (no fancy stuff) since we did't add it. The $html->css('default'); inside the HEAD of default.ctp will create a URI to the "default.css". We didn't make this file (yet), so let's do this in order to style it.

Create default.css inside the app/webroot/css folder. This is the place to put all the CSS at this moment. Remember we had two ID's: #blog and #article. I added the following CSS:

 
/* HTML */
body {
  background-color:#003333;
  font-family:Verdana, Arial, Helvetica, sans-serif;
  font-size:12px;
  color:#CCCCCC;
}
 
a { 
  color:#FFCC33;
}
 
/* Classes */
.date {
  float:right;
  color:#333333;
}
 
.readon {
  background-color:#009966;
  border-style:solid;
  border-color:#000000;
  color:#FFCC33;
  padding:2px;
  font-size:10px;
}
 
/* Blog */
#blog {
  width:500px;
  margin-left:auto;
  margin-right:auto;
  padding-top:15px;
}
 
#blog .article {
  background-color:#336666;
  padding:5px 10px 10px 10px;
}
 
#blog .article h1 a {
  color:#FFCC33;
  text-decoration:none;
}
 
#blog .article h1 a:hover {
  text-decoration:underline;
}
 
/* Article */
#article {
  width:500px;
  margin-left:auto;
  margin-right:auto;
  margin-top:15px;
  background-color:#336666;
  padding:5px 10px 10px 10px;
}

Now I'm sure that there are loads of designers out there that can make this CSS and layout way more fancy, but I hope you get the idea. This article is written for the code, not for the layout.

Building a blog with CakePHP 05

Building a blog with CakePHP 06

Conclusion / Download

There we have it: A fully functional blog that gets his data from the database. Try adding something to the database to see another article added.

Download the source code for this tutorial

In the other parts of this serie we'll make the blog a little bit more SEO, give it an admin panel etc. etc. to make it a fully functional blog that you can use. For now, I hope you learned the basic setup of the wonderful CakePHP framework. Happy baking!


Tags:  cakephp blog webdevelopment programming php

Interested in this topic? You might enjoy another article I've written called

Did you like this article? Subscribe to my feed or email to keep updated on new articles.

Spread the word and submit to:
Digg!Reddit!Del.icio.us!Facebook!StumbleUpon!
Comments
Add NewSearchRSS
cake - cake   2008-10-27 13:03:05
Gravatar image findAll() is depricated, use find('all') and find('first')
Marco - Thanks!   2008-10-27 13:50:00
Gravatar image Hi!

Thank you for that information. Funny fact: I was used to to find("all", ), but other people / tutorials told me to use "findAll()". That's the reason why I'm using that function instead of the other one.

Anyway, thanks for sharing: It's good to learn new stuff everyday :) .

Greetings,
Marco
teknoid   2008-10-28 22:05:35
Gravatar image You really don't need to specify $primaryKey if you follow the convention (which it seems that you do: 'id').

Also, if you name your controller blogs_controller.php (class BlogsController) (i.e. following the conventions again), cake will automagically recognize that it should be using the Blog model. Therefore you don't need to specify $uses in the controller. Not only that, since you don't have anything special in your model, you don't even need to create a model file, as cake will dynamically create a model for you.

Last but not least, if you don't like the fact that the URL would be example.com/blogs/ you can easily change that with a one-liner rule in your routes.
Marco   2008-10-28 23:08:04
Gravatar image Hi Teknoid,

Thank you for that very good feedback about the article / code.

You're right about all things:
- I'm just used to set the $primaryKey as it will give a better overview on what the PK is, especially when not working with "ID" or a PK over multiple columns.

- True, but with Part 2 (and maybe other parts?) of this tutorial, I still left it there, once again for the overview. This indeed is just a matter of taste.

- Also agreed on the routes, but I wanted that to be one of the other things to be placed in the next part(s) of the tutorial.

Still it's great to get such good feedback, thanks for that!

Greetings,,,
Pawan Kumar Choudhary - thank's   2009-01-28 13:47:03
Gravatar image :) thank's marcofolio
Cakephp - Cakephp   2009-05-13 14:46:34
Gravatar image Well Really nice and detailed article thanks for sharing.
Flashtoons - Nice Article   2009-07-20 08:21:30
Gravatar image Very nice and detailed article, Thanks.
Al   2009-07-22 00:12:15
Gravatar image hmm my site http://www.droparecipe.com is made with Cake which I think is also a great tool, but Im not sure if cake is made for blogs, be cause of wordpress which is a perfect soft.
Al   2009-07-22 00:13:51
Gravatar image ohh forgot a thing , dont mess with a free soft wich works so good and with such a developer community
Md Irshad - Insert table in cakephp   2009-08-12 11:17:07
Gravatar image Hi all,
I am very frustrated to add the user data in the table of admin pannel.
I have been create the filr in comtroller and views.On the pages all field show but not insert.

So please advice me.

Thanks
Md. Irshad
Kazi Ataul Bari - web developer   2009-08-12 19:34:39
Gravatar image thanks, nice article
Amit Bohra - Thinking more to do with Cake   2009-11-24 18:19:27
Gravatar image This blog is similar to that explained in CakePHP web site. The need is to elaborate and extend the portion of this blog to a complete blog management system based on Cake.

Then let's see how the Cake is Baked. I would be happy to see some exclusive content on this topic.
Edgar B. - Need help   2009-12-08 06:09:17
Gravatar image Thank you Marco. This is a great post, it helped me to understand CakePHP; but I have a trouble.

Looks like my conf is wrong, because any variable is shown. I.e. shows NOTHING.

I get "Read more..." three times, but the rest is left. I googled a little, but I can't solve this yet. Any idea? Thank you in advance.
geekonweb - My first app in cakephp   2009-12-17 11:30:01
Gravatar image Great article marco :)
I was just looking for a similar one to give me a start up on cakephp.

Thanks :)
Karthik - Amazing   2010-01-21 12:49:35
Gravatar image :whistle: Hi my friend ...

I would like to say thanks to u and ur ideas. It is really helpful to know what is cakePHP. i also prefer this to my guys.

Thanks marco . :woohoo:
washington_from_inMart_Resourc - what is the use of blog.php under Models?   2010-03-23 17:41:49
Gravatar image Hi,

I was trying to bake my first cakephp 1.26, but totally had no idea how to start with. CakePhp's really more difficult than Drupal. I am glad that Google found you.

Out of curiosity I deleted the blog.php under Models directory, and surprisingly I found the deletion of the file did not affect the blog. I can see those pages without any problem by this link:
http://localhost:8080/cake/blog/index/1
http://localhost:8080/cake/blog/index/2
http://localhost:8080/cake/blog/index/3

So what do you have to create blog.php if it has nothing to do with other pages?
washington   2010-03-24 03:49:39
Gravatar image How do you change the reference URL for the css file,
in my first blog, the URL for the CSS file is
href="/cakephp126/css/default.css"
which is the wrong URL.
So how can I change correct the URL to this:
href="/cakephp126/webroot/css/default.css"
washington   2010-03-24 04:53:37
Gravatar image The blog example invloved the use of a few columns in the blog Table.
But how come only the this was used in the Model:
var $primaryKey = 'id';
how about title, introtext, maintext?
Why the blog.php file didn;t have to include something like this:
var $title = 'title';
var $intro = 'introtext';
var $main = 'maintext';
David 'f0ru0l0rd' Turner - Error in handling   2010-03-31 22:56:15
Gravatar image Thank you very much for this tutorial. I can see how it runs similarly to the CakePHP tutorial. You make a great effort to explain things, so that even a noob like me can understand it. Major props for that.

That being said, I have found an error (that may or may not be addressed in the second tutorial).

If I navigate to
Code:
example.com/blog/index
(even though I modified it to follow conventions, and changed some things for my project ;) ), what you find is that when you click on a link, you are redirected to
Code:
example.com/blog/blog/index
. I assume this is a problem from the sneeky redirect
Code:
 $this->set('article', $this->Blog->find("id = $view";));
. I'm sure there are many ways to fix this issue, but the only 2 noobish ideas my poor mind can come up with, is either route it, or find some other way to pass the id (possibly in a before filter, and then send them to the right page. I don't know. I could take a few stabs at it, and probably come up with some ungodly hack that would look atrocious and open up another can of worms. What do you suggest (besides the disclaimer that this shouldn't be used in production)?

David 'f0ru0l0rd' Turner
Krishnan Gireesh   2011-07-12 00:14:44
Gravatar image 1. The links in index.ctp must be changed to /index/
town - using CakePHP   2010-06-29 13:33:59
Gravatar image hi, thx for the code, i'm new user on this programming..
Asgar - Problem findAll()   2010-07-01 04:39:44
Gravatar image Hi,

Im using cakphp 1.3.2 and i used your blog code in my cake application,
I'm getting this error. Please anyone help me.

Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'findAll' at line 1 [CORE/cake/libs/model/datasources/dbo_source.php, line 673]
Code | Context

$out = null;
if ($error) {
trigger_error('' . __('SQL Error:', true) . " {$this->error}", E_USER_WARNING);

$sql = "findAll"
$error = "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'findAll' at line 1"
$out = null

DboSource::showQuery() - CORE/cake/libs/model/datasources/dbo_source.php, line 673
DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 263
DboSource::fetchAll() - CORE/cake/libs/model/datasources/dbo_source.php, line 407
DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php, line 361
Model::call__() - CORE/cake/libs/model/model.php, line 502
Overloadable::__call() - CORE/cake/libs/overloadable_php5.php, line 50
Blog::findAll() - [internal], line ??
BlogsController::index() - APP/controllers/blogs_controller.php, line 19
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83

Query: findAll
matadanrasa   2010-07-08 22:29:46
Gravatar image Hi Asgar,

I'm also using marco's code and also got the same error, then i found out that you have to change findAll() to find('all') to make the code works. i hope that will help you

i'm new to cakephp so many thing i've to learn. thanks for the tutorial and keep it up !
:cheer:
jay bharat - Problem findAll()   2011-10-18 09:38:29
Gravatar image :cheer: Hello Asgar You can use
$this->set('articles', $this->Blog->find('all')); instead of $this->set('articles', $this->Blog->findAll());
Cheers..
indriarko - Thanks :D   2010-07-28 07:52:41
Gravatar image Thanks, pal.. it's really help me as beginner in cakePHP.

but i tried to use findAll(), doesn't work. so i used find('all')
and change the link blog/index/ => index/, because the first one is doesn't work in my Cake (i don't know why)

anyway, thanks bro..
Michael - Yeah!   2011-05-17 18:08:13
Gravatar image Thank you very much for this really great intro to cakephp. And also a big thanx to Indriarko. I was getting the error for days of testing ... I should have read your comment from the start ;-)

Thanx!
srinivas - Hi all   2010-09-27 05:29:33
Gravatar image i have created file index.ctp in the views/blog/ folder but the Missing View message is still appearing, any suggestions?
astro - re: cake   2010-10-28 05:31:00
Gravatar image
cake wrote:
findAll() is depricated, use find('all') and find('first')

1 filas(s) fueron insertadas.
La Id de la fila insertada es: 3
Warning: #1366 Incorrect integer value: '' for column 'total_articulos' at row 1
INSERT INTO `clsnte`.`ws_categories` (
`catid` ,
`category` ,
`inicio` ,
`proyecto_id` ,
`proteccion` ,
`total_articulos`
)
VALUES (
'0', 'Sin Clasificar', '2010-10-27', '0', '', ''
);
dharam   2010-12-16 09:30:12
Gravatar image i hv to prepare a blog sys using cakephp or zend framework will u pls help me
php blog - php blog   2011-01-18 07:12:22
Gravatar image thank you for sharing! It is great helpful for me!
I will keep visit your blog
Bishoy A. Youssef - SQL syntax error!   2011-03-24 19:07:10
Gravatar image Why this error happened when i add"debug($this->Blog->findAll());" in the controller file ..
"Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'findAll' at line 1 [CORE\cake\libs\model\datasources\dbo_source.php, line 684]"
??

Thanks a lot :)
Ida - Miss   2011-03-29 09:16:10
Gravatar image :) I like this example. The only problem I had was with the findAll(). My version did not support it. so I rather used find('all') and it work.

Thanks
kiran - great building a relationship   2011-06-16 12:33:23
Gravatar image Thank you very much for this tutorial. I can see how it runs similarly to the Cake PHP tutorial. You make a great effort to explain things, so that even a noob like me can understand it. Major props for that.
Jay - Thanks god.finally a simple tutorial   2011-06-24 15:37:50
Gravatar image Thanks!So much easier to follow than the official cakephp blog tutorial
Sandeep Rajput - Marco   2011-07-14 11:12:21
Gravatar image Hello Marco,

Thanks for this great 'cake'. I appreciate your work of writing this wonderful article.
Keep it up.

Thanks & Regards
Sandeep Rajput
Aadil Keshwani - Thanxx   2011-08-14 20:18:07
Gravatar image Thank you veryyyyy much i have been searching this tutorial from long time thax buddy for giving me this article thanxxx :lol: :lol: :lol: :lol: :lol: :lol: :lol:
czbxb - bxcvbxcvb   2011-08-24 07:20:13
Gravatar image
dan luther - Thanks Mate   2011-10-25 07:45:58
Gravatar image excellent post. very well laid out, well explained especially on defining the errors. Thank you very much, I learned a lot today, here at your site.

Keep posting nice tutorials. Goodluck
Pawel - issue with blog   2011-10-25 16:44:56
Gravatar image I get to the paragraph "The "Blog" model" and after start my blog it looks like this: "Posted image

Uploaded with ImageShack.us". I supposed it should look like this. But after paragraph "Controller to view" nothing changed, and i still have this strange html code on yellow background. And under this code I have 3 subpages which showing "Error: The action blog is not defined in controller BlogController" and "Error: Create BlogController::blog() in file: app\Controller\BlogController.php.". Somebody could help me? (sorry if my English is not grammatical).
Pawel   2011-10-26 15:04:08
Gravatar image I resolved my problem. Because I am beginner I didn't know I had short_open_tag = Off. Now is everything working.
mike - Web Design Company   2011-11-28 13:39:10
Gravatar image A professional web solution company provides web design and development, content development, SEO services, technical back-up & web maintenance at affordable price.
mike - Web Design Services   2011-12-06 10:04:03
Gravatar image Discover Excellence provide state-of-the-art web solutions for our customers which includes custom website design & development, logo design, banner design, wordpress design and more.
mike - Web Design Services   2011-12-06 10:05:07
Gravatar image Discover Excellence provide state-of-the-art web solutions for our customers which includes custom website design & development, logo design, banner design, wordpress design and more.
Anonymous   2011-12-19 22:34:34
Gravatar image :0 :arrow: :arrow: <img src=ide:' /> <img src=ide:' /> :) :woohoo: :lol: :dry: :dry: :evil:
Yogesh Khatri   2012-01-17 06:50:33
Gravatar image Thanks marco,

Great tutorial..
PHP Developer - PHP Developer Atlanta   2012-01-23 08:43:21
Gravatar image Thanks bro... this is really helpful and also help me solve my problem which i cant solve from some days..
lor - Hola   2012-02-14 10:19:04
Gravatar image tutto ok!
http://www.oakleysunglasseseso   2012-03-01 07:29:03
Gravatar image For sportspersons, sun glasses are a vital adornment as they must enjoy in various ecological situations. peuterey outlet Remembering

these demands, there are a variety of brands which construct exclusive sporting activities sunglasses for him or her.
Peuterey outlet Backyard sporting activities require plenty of demanding exercise as well as areas may bring about

graphic issues. For that it
Ase - Error   2012-03-04 16:02:02
Gravatar image 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'All LIMIT 1' at line 1
Nathan   2012-03-04 16:58:32
Gravatar image Excellent article Marco.. I am getting error messages at the stage where you instruct to 'So, create a article.ctp inside the app/views/blog/ folder. Use the debug($article) function to check if the article is loaded.' The error I get is below.

Notice (8): Undefined index: id = 1 [CORE/Cake/Model/Model.php, line 2519]
Notice (8): Undefined index: id = 1 [CORE/Cake/Model/Model.php, line 2495]
CakePHP: the rapid development php framework

Notice (8): Undefined variable: articles [APP/View/Blog/article.ctp, line 1]
app/View/Blog/article.ctp (line 1)

Can anyone help or offer a suggestion to why I am getting this error?

Thanks
kapil patil - website designing services   2012-03-05 09:55:10
Gravatar image Thanks for this tutorial of blog creation. It helps for website developers.
friv - Friv   2012-04-04 18:04:49
Gravatar image Thanks for the post. I appreciate the info on blog comments and will surely start looking out for people who are using automated programmes for making blog comment posts.! I have never won anything. This is great, I
games - gazo   2012-04-04 18:08:37
Gravatar image Thanks for the share, and for taking the time to do so. Should give me even more work to do now!

Thanks for share this source, do follow link could get us a good rank and pagerank,thank you.
kizi - kizi   2012-07-07 13:09:23
Gravatar image thank you very much!@
kizi - kizi   2012-07-07 13:11:14
Gravatar image thank you very much!@
kizi game - kizi game   2012-07-07 13:50:15
Gravatar image thank you so much!@
gazo 2   2012-07-07 13:52:29
Gravatar image best games online free!@
gazo games - gazo games   2012-07-07 13:53:53
Gravatar image ___??
_________________???
________________?Hello,´?`
_______________?I Have
kizi - kizi   2012-08-23 10:04:35
Gravatar image I just added this feed to my bookmarks. I have to say,
I very much enjoy reading your blogs. Thanks!
kizi - kizi   2012-08-23 10:34:05
Gravatar image I just added this feed to my bookmarks. I have to say,
I very much enjoy reading your blogs. Thanks!
kizi 1 - kizi 1   2012-08-23 10:36:01
Gravatar image Great post,thanks,this is going to help me a lot.Thanks again.
!@
kizi 3 - kizi 3   2012-08-23 10:38:47
Gravatar image I
kizi 4 - kizi 4   2012-08-23 10:39:58
Gravatar image I
Gazo - Gazo Games   2012-08-28 16:20:25
Gravatar image I think this is one of the most interesting articles I
friv 4 - Thanks for your work   2012-09-04 04:03:25
Gravatar image Hi there, I found your website by means of Google while searching for a similar topic, your site got here up, it seems good. I have added to favourites|added to bookmarks.
friv - friv   2012-09-27 03:13:06
Gravatar image I kick myself in the but every-time I see blogs as delightful as this because I should stop browsing and start working on mine
friv - friv   2012-09-27 03:13:37
Gravatar image TY for writing this, it was quite handy and told me very much
Priya   2012-10-11 07:56:24
Gravatar image Try writing articals for CakePhp .It was very helpfull. :)
kizi - kizi 2 - kizi - kizi 2   2013-02-22 02:33:10
Gravatar image I think this is one of the most interesting articles I
kizi - kizi 2 - kizi - kizi 2   2013-02-22 02:34:32
Gravatar image Hi there, I found your website by means of Google while searching for a similar topic
kizi - kizi 2 - kizi - kizi 2   2013-02-22 02:35:06
Gravatar image thinks this is great news that facebook commenting will be indexing at Google! cuz facebook commenting is more easier then wordpress commenting!
kizi - kizi   2013-02-22 02:36:38
Gravatar image thinks this is great news that facebook commenting will be indexing at Google! cuz facebook commenting is more easier then wordpress commenting!
girl games 1 - girl games 1   2013-02-24 04:55:57
Gravatar image I just added this feed to my bookmarks. I have to say,
clothesfashion - aims to play its role as a fast online   2013-03-21 08:38:23
Gravatar image The tight split design turns out to be an essential detail for [b][url=http://www.chicnova.com/]womens clothes

[/url][/b] none the less, which enables the new stars to follow Angelina Jolie
Steven P - cakePHP   2013-04-14 11:43:48
Gravatar image cakePHP sucks. Why? Their own blog tutorial - ambiguously written - results invariably in error messages:

Error: PostsController could not be found.
Error: Create the class PostsController below in file: app\controllers\PostsController.php

If those idiots cannot write out a simple "hello world" tutorial ... one wonders what else they punted on.

PHP is an old, old friend. codeigniter is not, but at least it works out of the box and is documented by humans rather than imbeciles.
friv - friv   2013-05-18 03:29:33
Gravatar image Yes, indeed, a very good article.
friv - friv games   2013-05-18 03:30:34
Gravatar image Yes, indeed, a very good article
friv - friv games   2013-05-18 03:30:56
Gravatar image Yes, indeed, a very good article
jugarfriv - friv games   2013-05-18 03:31:29
Gravatar image Thank you for this post! I am thinking of following the advice that you offered.
Read more...
Name:
Email:
  Gravatar enabled.
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Security Image
Please input the anti-spam code that you can read in the image.
Unsubscribe from e-mail notifications.
 
< Prev   Next >
Subscribe

Subscribe to Marcofolio