Tutorial: Getting Started with Zend Framework 1.10

This tutorial is intended to give an introduction to using Zend Framework to write a simple database driven application. It has been updated for version 1.10 of the framework and takes full advantage of the Zend_Tool command line script and Zend_Application for bootstrapping. Other components used include Zend_Controller, Zend_View, Zend_Db_Table and Zend_Form.
This tutorial has been tested on version 1.10 of Zend Framework. It will not work on any version prior to version 1.10.
If you are deploying to a "user" site (e.g. http://localhost/~rob), then you need a RewriteBase line in your .htaccess file that looks something like: RewriteBase /~rob/zf-tutorial/public/.
English version: Dowload the PDF (v1.7.4).
Code
The associated code is available:
Further reading
Once you have finished this tutorial, consider buying my book, Zend Framework in Action. Also, the Quick Start is worth reading.
Chris Kirk has kindly provided a Q&A PDF for the 1.8 version of the tutorial which may help if you are having problems.
Previous versions of this tutorial
There have been three previous versions of this tutorial:
- tutorial for Zend Framework 1.8 and 1.9
- tutorial for Zend Framework 1.5, 1.6 and 1.7
- tutorial for Zend Framework 1.0
Changelog
- 1.7.4 (25/Jul/2010)
- Move setting the title to the view scripts and use zf create dbtable to create the table class
- 1.7.3 (29/Jun/2010)
- Typographical fixes
- 1.7.2 (17/Apr/2010)
- Typographical fixes and use Zend_Form's init() method
- 1.7.1 (11/Feb/2010)
- Fix code in deleteAction to use the correct model name
- 1.7.0 (7/Feb/2010)
- Significantly revised for Zend Framework 1.10

February 8th, 2010 at 09:37 #
[...] Akrabat's blog: As a result, I have updated my Zend Framework tutorial so that it is completely current. The main change I made was to remove the _init methods in the [...]
February 9th, 2010 at 10:51 #
Thank you very much, great stuff, again.
One minor problem in the zip files though:
IndexController.php line 91 (deleteAction)
$albums = new Model_DbTable_Albums();
generates an error
forgot the 'Application_'?
greets,
el mich
February 9th, 2010 at 11:09 #
Thanks for letting me know. I've updated the zip files.
Regards,
Rob...
February 9th, 2010 at 14:33 #
thanks ... ever helping tutorial :)
February 10th, 2010 at 15:26 #
You'll better correct the pdf version number and the download link from 1.7.0 to 1.10.0 .
Regards,
Italo A.
February 11th, 2010 at 17:15 #
I'm getting a 'Class 'Application_Model_DbTable_Albums' not found in C:\wamp\www\zf-tutorial\application\controllers\IndexController.php'
after following up to page 12 of this tutorial!
Can you help?
February 12th, 2010 at 09:48 #
I'm new to object-oriented php and Zend Framwork and I found this tutorial very useful, thanks a lot.
I'm running this on the newest Zend Server CE as a virtual host and it works like a charm. :-)
February 13th, 2010 at 12:35 #
Error is happeing because class name is wrong
Solution
Rename Model_DbTable_Albums to Application_Model_DbTable_Albums in controllers/IndexController.php
February 13th, 2010 at 18:45 #
I believe the correct location for the layout.phtml file shown on pages 10 and 11 of the tutorial should be:
zf-tutorial/application/layouts/scripts/layout.phtml
February 13th, 2010 at 20:38 #
This is the tutorial Zend Framework newbies have been seeking! A complete working project interspersed with useful explanations.
Very well done, thanks!
iMac 10.6.2 Snow Leopard
MacPorts install of Apache, MySQL, PHP and phpMyAdmin.
February 14th, 2010 at 19:57 #
In your tutorial, the Application_Model_DbTable_Albums class could be created with the zf command line tool:
'zf create dbtable Albums albums'
February 15th, 2010 at 21:39 #
Thanks a lot for this tutorial, I was looking for some good and straight to the point explanations to start with Zend and this is pretty good stuff!
February 17th, 2010 at 12:24 #
Hi again,
It's been a few days I try to augment and modify this simple application to make a real (but still relatively simple) administration console.
This is a was also to get more familiar with Zend.
Sincerely it is a PAIN, when something does not work I just have "Application Error" displayed, or worse, most of the time, a white page!
Even if I code pure PHP from scratch will I have better indication of what is wrong when there is an error!
The question would be: where the hell do the error messages go?
(I am trying to simply upload a picture, rename it and move it to a folder I create on the fly, and resize it. But moving and renaming the file just does not work, and I tried many things I saw in tutorials etc... I am a bit disappointed as I expected this to be basic stuff for zend)
February 17th, 2010 at 23:57 #
Hi David,
I guess you are using the "production" setting, which has display_errors = 0. I suggest using the "development" enviroment setting instead.
check your index.php code
on line 8.
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
February 18th, 2010 at 13:23 #
Thanks MayorBrain! ok I changed to development, I guess it should be better like this.
Anyway when I do a echo "string" in the IndexController.php code I never see my "string" displayed when executing the code.. any idea where it goes?
Also a problem with form is that sometimes I press the submit button and it stays blocked on the page, like if it was loading something forever. I need to press the submit button a second time to have the form processed and go back to the index page. I think it is specific to the file upload I added in the form, and seems to happen when I upload 2 times the same file..
Has anyone ever seen experienced this?
As there is absolutely no message displayed (even in development) it is hard to know what is wrong..
And finally (and I promise I am going to stop here:),
-What development environnement would you recommand to develop with zend? Is there any way to have autocompletion of some sort, or do we have to look everytime at the manual for each parameters etc.. ?
I am on mac os, using dreamweaver to edit my php but I am thinking on moving to eclipse with php.
A tutorial to setup a good working environment for zend development would be awesome!
-What forum who be the best to adress those kinds of issues specifically with zend?
Thanks !
February 20th, 2010 at 13:11 #
I've met the same problem as David. In project created with Zend_Tool only Application Error message is shown without any details. I am sure I've set my APPLICATION_ENV to development. Can this be in case of custom .htaccess file in project directory? It just redirect all queries to /public/ since the baseurl part is not empty.
February 23rd, 2010 at 11:42 #
After 2 weeks with Zend, I found the learning curve pretty steep, especially because the supposedely simplest things won't ever work the first time.
After a bit of a struggle my zend back-end works fine locally. Then I want to upload it to the REAL web server because the client asks for it this week.
So I do it and bam! New errors, open_dir restriction. I replaced the following line in index.php:
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
with simply:
set_include_path(realpath(APPLICATION_PATH . '/../library'));
it works!
At least I got rid of the open_dir restriction warnings.
But now when I try to use my back end, the first call to an action in any controller brings me a 404 file not found page!!
Why is that??
Every forum I find seems to speak of local configurations, where we should edit httpd conf to allow override all etc..
But is there any real case of people using Zend for a public website?
Any help would be greatly appreciated!
Thanks again
David
February 24th, 2010 at 21:01 #
Good tutorial. Better than the guide on the Zend site. Only noticed one minor error on page 8. "Count not find row $id" should probably be "Could not find row $id".
February 25th, 2010 at 10:53 #
Fatal error: Class 'Application_Model_DbTable_Albums' not found in C:\Program Files\Zend\Apache2\htdocs\my\application\controllers\IndexController.php on line 16
This is the error, though i have the 'Application_Model_DbTable_Albums' class written in application\models\DbTable\Albums.php and using same in IndexController.php
March 2nd, 2010 at 19:34 #
Thanks for this great tutorial, it was really usefull, I can now create a basic app with Zend Framework.
Is there some slightly more advanced tutorial that you could advise me?
March 4th, 2010 at 12:14 #
Can somebody please tell me how to implement modules in Zend 1.10 ?
I need a detailed tutorial because I have tried many on the web buty seem to be outdated.
March 7th, 2010 at 10:41 #
HiRob,
I'd reccomend you to tell something about setting up a virtual host in this tutorial. I've got the example application up and running quite easy but when I'd like to add more controllers and functionallity I ran into a lot of troubles and it was a heavy search to get things solved. After I've found the information about setting up a virtual host thing got easy.
But thanks, your tutorial was very helpfull to me!
Cheers!
March 8th, 2010 at 14:26 #
Crispijn,
Why? A virtual host is not required for ZF. I know this as I don't use them for local development :)
Regards,
Rob...
March 8th, 2010 at 20:15 #
Hi Rob,
I ran into trouble when I added custom controllers to my application. When I had the virtual host up and running these problems were solved... Don't know why, I'm not a ZF guru, but it was.
Could you tell me why I ran into trouble? The troubles where that all the request I've made at http://localhost/~myname/controllername/actionname I got a 404 error but your tutorial app was up and running so I guess that the overwrite setting was just as you suggested.
Regards,
Crispijn
March 9th, 2010 at 08:40 #
Hi,
beautiful guide, but I've this error:
Fatal error: Class 'Application_Model_DbTable_Albums' not found. But the class name is correct (Application_Model_DbTable_Albums). What's the problem? I've used the downloadable example..
I've a lot of problem with a modules.. with a framework 1.10 the project's structure is significantly changed..
Thank you!
March 11th, 2010 at 20:06 #
Great! Does anyone know how to extend this tutorial with active record validation?
I am trying to inplemend Zend_Validate_Db_NoRecordExists so that it won't be possible to insert a new record while a record with an identical name field already exists. This works fine in case of inserts, but When the form is used to edit a record it will find itself and fail validation.
I know I need to set an exception for th active record. The problem is that I simply don't know how to pass a variable (id) from the controller into the form.
It should be pretty basic OOP I guess but I tried everything I could think off for more than a few nights now. I just don't see it. The manual describes this validator but somehow I can't manage to set it up. All I want is to pass a id from the controller to the form and use it.
My form currently uses the init() method. I also tried overriding the constructor __construct($id) as well but that's no good practice as far as I am aware and it did broke the 'save' method. The init() function is for convenience according to the documentation. But I have no idea what they mean. Then there's is this configuration object which can be passed to the constructor. And there is a setAttrib method. I am completely lost.
Any suggestions on using a constructor in stead of init() functions as in this tutorial? Could I use setAttrib for this purpose? Or implementing getter setter methods? Any help would be greatly appreciated!
March 13th, 2010 at 12:03 #
SELECT * FROM emp WHERE ename='smith' AND id=520
please tell me how to implement this qury in zend frame work
March 14th, 2010 at 17:51 #
Thank you for the tutorial.
When I'm trying to delete a record I get following
Fatal error: Class 'Model_DbTable_Albums' not found in \application\controllers\IndexController.php on line 91
(File from source downloaded)
This line should read:
$albums = new Application_Model_DbTable_Albums();
Regards.
March 20th, 2010 at 20:01 #
please help,
Fatal error: Class 'Model_DbTable_Albums' not found in \application\controllers\IndexController.php on line 91
March 21st, 2010 at 11:03 #
Hi Rob,
Now there's a Bootstrap.php file I'm a little confused as to how to implement custom routing, mainly what method to override in the above class to get access to my router and enter custom routes.
Do you have any tips on this?
Thanks.
March 22nd, 2010 at 11:31 #
This PDF tutorial need an update for Zend framework version of 1.10 in form class. Instead of __constructor() function we should use init() function otherwise script will consume memory space or can give memory limit exhausted error.
March 22nd, 2010 at 22:57 #
Hi Rob,
A lot of people seem to have problems with the database class not being found. I have the same issue. With the scripts downloaded I get the error:
Fatal error: Class 'Application_Model_DbTable_Albums' not found in /Users/michael/Sites/zf-test/application/controllers/IndexController.php on line 16
Can you please advice on this?
Thanks in advance!
March 23rd, 2010 at 09:37 #
Hi.
I read your guide and i like it.
I have a question: can u make an example with different views?
I am building a website with 3 section but i have only one index in /public.
How can i change views?
March 23rd, 2010 at 15:30 #
For people not able to load the Application_Model_DbTable_Albums class, please check that you have the correct case for the directory and file.
It should be:
application/models/DbTable/Albums.php
Note that capital D, T and A.
Regards,
Rob...
March 23rd, 2010 at 18:36 #
@Rob
I'm not sure if the issue is with the capitals. As I found out it has something to do with the version of Zend Framework.
If I use 1.10.0 all works fine. With 1.10.2 I get the error as described above.
March 24th, 2010 at 10:15 #
@Rob
The path is like you say. Besides, I did not touch downloaded files. I just unzip the file to my local server and make database configuration.
The class in application/Bootstrap.php is empty... is this cause the error I write above?
regards
March 24th, 2010 at 20:25 #
True, i'm getting the same fatal error (Fatal error: Class 'Application_Model_DbTable_Albums' not found in E:\sites\zf\zf-tut\application\controllers\IndexController.php on line 16)
I'm also using ZF 1.10.2. What's up with this? Classname is correct, i can Ctrl+click it in my eclipse, so there's no problem there...
March 24th, 2010 at 20:53 #
I copied the files from the zip into the application-directory and now it works. Haven't found what i've been missing so far, maybe i was too eager and should finish the whole tutorial before i check my browser?
March 26th, 2010 at 06:36 #
im unable to run after placing the file onto the server and facing error in path in public/index.php
March 26th, 2010 at 15:57 #
Hi and thanks a lot for your work.
Sorry for my english, i'm a poor frenchie.
Just one problem for me : isn't it possible to have datas in utf-8 in views AND in database. It was with ZF 1.9.x < 1.9.7 but now, it's just a mad thing.
Try when Edit for example "Soldier of Love" and transform in "Soldier of Lovéàè". You obtain in MySQL : "Soldier of Lové"
Regards.
March 27th, 2010 at 00:54 #
For some reason, specifying "localhost" in my hosts file, setting ServerName localhost and calling http://localhost resulted in a server not found.
Once I changed my hosts file to point zf-tutorial.localhost to the proper ip and specified ServerName zf-tutorial.localhost, the server was found.
There seems to be some inconsistency in how these settings are referred to in the tutorial. eg. http://localhost/zf-tutorial
Also, the url(s) on page 6 eg. http://localhost/zf-tutorial/public/index/add should not have the 'public' directory specified as the server configuration already specifies it.
March 27th, 2010 at 08:26 #
matt,
I'm glad you got it working. However, you should not need to set localhost in your hosts file as it should already be set. Also, you do not need to create a virtual host for localhost as http://locallhost should go to the root directory of your web server by default. For most Linux boxes, that is /var/www or /var/www/html. For a Mac, it's /Library/WebServer/Documents. On a Windows box, with IIS, it's c:\inetpub\wwwroot. If you aren't using the default web server for the OS (which is likely with Windows as it doesn't ship with Apache), then it depends on which Apache package you installed.
On page 2, the tutorial says to create your ZF project "zf-tutorial" in the root directory of your web server. This is so that navigating to http://localhost/zf-tutorial/public will find the index.php file that is automatically created by the zf command line tool and avoids the need to create a VirtualHost within the Apache settings.
Of course, if you follow the "Note" at the bottom of page 3 about live websites and create your own VirtualHost, then it points out that the url would change to http://zf-tutorial.localhost/ but that this format would not be used in the rest of the tutorial.
Regards,
Rob...
March 27th, 2010 at 08:42 #
Thanks a lot for this tutorial.
For those that have the "Fatal error: Class 'Application_Model_DbTable_Albums' not found in IndexController.php on line 16", I fixed mine by adding that within the Bootstrap.php
protected function _initFoo()
{
$loader = new Zend_Loader_Autoloader_Resource (array (
'basePath' => APPLICATION_PATH,
'namespace' => 'Application',
));
$loader->addResourceType( 'model', 'models', 'Model');
}
If someone can explain me why we have to add something like that to load correctly the resources, I will ty in advance.
March 27th, 2010 at 08:47 #
In complement of my previous comment, you will also have to add that in the above function to have the forms working:
$loader->addResourceType( 'form', 'forms', 'Form');
March 27th, 2010 at 08:56 #
@ GoldenD
You can retrieve your data in utf-8 by adding the line below within your application.ini
resources.db.params.charset = "utf8"
Try again to input foreign characters in the form and then display the result, all should be ok if you have the right mysql collation, e.g. utf8_unicode_ci
March 27th, 2010 at 09:04 #
@ Sensi
Thanks for Answer but not ok. I've tried with
resources.db.params.charset = "utf8"
and
resources.db.params.driver_options.1002 = "SET NAMES utf8;"
without success. It was good before ZF 1.9.7 but not since.
March 27th, 2010 at 09:30 #
@ GoldenD
Hello GoldenD, being french too it was the only thing i had to add to have it working.
What do you have in your mysql\bin\my.ini configuration file?
I have this for both (maybe redundant) [client] and [mysqld]:
default-character-set=utf8
collation_server=utf8_unicode_ci
character_set_server=utf8
March 27th, 2010 at 11:02 #
@ Sensi
hmmm,
i've no mysql\bin\my.ini.
I've mysql5.1.36\my.ini but without these keys and values.
In phpAdmin, all is at good statement with utf everywhere.
In fact, the tutorial works well : the only thing is when you save data, in mysql database zf-tutorial, datas are not readable chars, �à � for example.
And my problem is that i have a project with more than 100 000 rows but datas are corrects in base, and with this zf version, they don't appear in forms. And you can test with this zf tutorial, it's the same if you write directly àéè... in mysql and try to read them with this sample. Nothing appears.
March 27th, 2010 at 20:40 #
@ GoldenD
Well at least the problem should not come from this tutorial, because again I was able to save and display that same french characters (avec accents, etc) with zf-tutorial by just adding resources.db.params.charset = "utf8" in application.in, my database and its table being in utf8_unicode_ci
Do try -if not already tried- to put the previously mentioned settings within your mysql5.1.36\my.ini, restart mysql, check your database charsets with e.g. the free MySQL-Administrator windows application (Health -> System variables -> SQL -> charsets), check again your page/browser character encoding, and insert a new entry through the zf-tutorial.
Otherwise sorry but I am a bit out of ideas. :)
March 28th, 2010 at 11:59 #
hey guys,
i dont get the command line tool working as it should. i'm using win7 and xampp. when i try to create a project with the command line tool, it is always created in c:\users\\ but i have my projects in c:\xampp\htdocs. okay, i can set the path in the create command, but when i'm trying to create a controller with "zf create action add Index" it always say something like "no project found".
i searched the web a few hours but couldn't find any solution...
hope anybody can help me?
thanks!
March 29th, 2010 at 07:08 #
@ Sensi,
Thanks a lot Sensi.
Like you and I said, it was not the fault of this tutorial, we are agree.
I try again step by step and the solution was in my.ini as you said.
With
default-character-set=utf8
collation_server=utf8_unicode_ci
character_set_server=utf8
in mysqld, it's ok.
No need in [Client].
A lot of thanks for your time and tests. Thanks.
March 29th, 2010 at 13:12 #
Hi,
Your tutorial is too good…but my problem is, actully i want to use multiple database at the same time or we can say use multiple database simultaneously…like using cross database join query.
please help me or suggest me what i do……
Thanks
Regards,
Vicky…
March 30th, 2010 at 11:25 #
Great tutorial!
The best that I did find, helped me a lot!
They should use this one instead of the "quickstart" that they have on zendframework...
The only mistake I did find was that the layout directory is "zf-tutorial/application/layouts/scripts/layout.phtml"
not "zf-tutorial/application/layouts/layout.phtml"
Thanks for great work!!!
April 2nd, 2010 at 01:17 #
One of the first lines in this totorial is "If you are getting 404 errors when going to any page other than the home page, please make sure that you have set AllowOverride to All in your Apache configuration and have enabled the mod_rewrite extension."
I do not know how to do this, I am a zend newbie. What I found via google didn't sound like something I could trust. I could guess around, but then if I get it wrong, I'm still back to the same thing - Having to ask anyway.
April 2nd, 2010 at 03:38 #
Good tutorial. I was able to get the Framework started with the help of your tutorial.
After setting up, I got this error message when I looked up index.php
"Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (zf-tutorial)' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Controller\Dispatcher\Standard.php:242 Stack trace: #0 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\index.php(42): Zend_Controller_Front->dispatch() #2 {main} thrown in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Controller\Dispatcher\Standard.php on line 242
"
If I ran index.php from the command line php index.php - it reported that it was not able load some DB adapters.
Seems that I did not have the php_pdo.dll and php_pdo_mysql.dll extensions in the php.ini.
In fact, this line was not even present in the php.ini.
Adding these lines to the php.ini resolved it.
Next I encountered this error when I tried to bring up zf-turorial/index.php
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (zf-tutorial)' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Controller\Dispatcher\Standard.php:242 Stack trace: #0 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Controller\Front.php(954):
I had to add this line to the index.php
$frontController->setParam( 'useDefaultControllerAlways', true );
Only then was I able to see the first page rendered with no issues.
April 7th, 2010 at 20:16 #
Thanks,everything is ok, except in IndexController at line 91.Y've to change Model_DbTable_Albums() to Application_Model_DbTable_Albums().
Nothing else !!!!
April 15th, 2010 at 19:48 #
good tutorial! im still a zend newbie and i need abit of some help, i keep on getting this error Warning: Invalid argument supplied for foreach() in /studhome/1/0802811/public_html/thisis50/application/views/scripts/index/index.phtml on line 42
and this is on line 42 albums as $album) : ?>
for some reason it wont display the infromation in my database only that error message keeps on coming up!!
any help please
thanks
April 15th, 2010 at 20:08 #
marcus,
Put your IndexController.php and index.phtml files up on a pastebin somewhere and link them here :)
Rob...
April 16th, 2010 at 07:23 #
Hi,
Zend Newbie here as well, I get application error with your tutorial. It seems there is a problem with database connection I m trying to run it on xampp on ubuntu . what shall I do ?
April 16th, 2010 at 08:42 #
hi here are my files
index.phtml
http://www.sendspace.com/file/zv7u01
IndexController.php
http://www.sendspace.com/file/pams6x
thanks
April 17th, 2010 at 17:44 #
Your tutorial beats zend's quickstart hands down, good detail, good explanation.
Thank you
April 18th, 2010 at 00:54 #
Rob,
I had purchased Zend Framework in Action last year and got a lot of information from it. Do you have any plans on another book covering ZF 1.10 ?
April 19th, 2010 at 14:46 #
Hi Rob, Congratulations for the tutorial and the book too. Is there a way to execute a join between two tables then fetch data from both tables?
I've tried findDependentRowSet() (as shown in the book at Chapter 6) without success.
Thank you in advance
April 19th, 2010 at 14:52 #
uastasi,
Use a Zend_Db_Table_Select object with join() and setIntegrityCheck(false).
Regards,
Rob...
April 25th, 2010 at 13:01 #
Hi
Awesome guide and book (ZFiA).
Today I went back to try the Zend_Tool beginning in your guide rev. 1.7.2 and I stumble on a problem during the "Testing Zend_Tool".
zf show version gives me:
"Zend Framework version 1.9.4" and stated in the guide it should be version 1.10.0.
Do I have some error on my side? I have tried to reinsatll ZF several times and removed all earlier installtions of ZendFramework aswell but still get the 1.9.4 print out. I'm on Ubuntu 9.10.
Thanks for any reply
April 26th, 2010 at 08:18 #
@Christoffer: if you have installed xampp or any similar environment you have a Zend folder into ..\xampp\php\PEAR\Zend that prompts out that lines. Check it and eventually replace it with a newer Zend version.
April 27th, 2010 at 23:28 #
After creating the actions for Index and trying to go to: zf-tutorial/public/index/add I get the page not found 404 error.
I uncommented the mod_rewrite line in httpd_conf file.
I added this to default and documentroot settings
Options All
AllowOverride All
Order allow,deny
Allow from all
i restarted apache and i still get 404 error
April 29th, 2010 at 04:41 #
I found the problem. On windows machines you cannot have .htaccess with no file name. In the http_conf file there is a line that specifies the file name for access files.
AccessFileName ht.htaccess
i just put ht in front and 404 error be gone.
April 29th, 2010 at 11:27 #
Thanks for all this tutorials. It helps a lot to get started on this tech. Your explanations are very precise and I understanded all of the tutorial. Thanks for spending effort on doing this for free.
April 29th, 2010 at 11:30 #
what/where the hell is Drinkers end? =)
April 30th, 2010 at 04:24 #
got the 'Mysql driver not found error' when trying to view the albums
You have to include the pdo.dll's in php.ini
extension=php_pdo.dll
extension=php_pdo_mysql.dll
apparently doesnt use the regular mysql driver
April 30th, 2010 at 18:12 #
I made it to displaying the album records and followed the directions to setup the Add Form. But when I click on Add Album It just displays 'Add New Album' title on top and blank screen below. There is no form controls. I followed the directions exactly.
May 3rd, 2010 at 12:52 #
Thanks for this great tut.
It's the first one that's been helpful so far and I tried a few...
May 5th, 2010 at 10:22 #
erratum:
Page 4. The htaccess file does not set the env to development. You need to add it:
SetEnv APPLICATION_ENV development
May 6th, 2010 at 14:47 #
I have been struggling since an upgrade from 1.9.x to 1.10.x with my mysql data which is iso-8859-1. If you need iso-8859-1, as I do, then you now have to explicitly tell your Zend_View resource about it. In the _initView() in your Bootstrap.php:
$view->setEncoding('iso-8859-1');
May 10th, 2010 at 08:31 #
If you come across "Application error" , then make sure the have Allowoverride ALL in httpd.conf. It solves the issues. Also in IndexController , for delete actions make sure to correct actions to Application_Model_DbTable_Albums
May 14th, 2010 at 02:04 #
Are there plans to do this tutorial with the zend layout of modules?
/modules/default for this and
/modules/admin or something for your Zend_Auth example
May 17th, 2010 at 08:00 #
I try to implement exemple from ch 04
with a sqlite3 database
and with zendframework 1.10
and the part with menu not work .
How can I make work this example
using zendframework 1.10
May 22nd, 2010 at 20:36 #
Very nice tutorial, well written. Thank you very much :-)
May 23rd, 2010 at 18:19 #
Hi Rob, thanks for the great tutorial. In my opinion it's better than the official quickstart one, as Zend complains less and there are more solutions.
My problem right now is with the addAction() function in IndexController. I keep getting this error after I add an album:
Fatal error: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in D:\ZendFramework\bin\quickstart\application\controllers\IndexController.php, line 66' in D:\ZendFramework\bin\quickstart\library\Zend\Controller\Response\Abstract.php:321 Stack trace: #0 D:\ZendFramework\bin\quickstart\library\Zend\Controller\Response\Abstract.php(339): Zend_Controller_Response_Abstract->canSendHeaders(true) #1 D:\ZendFramework\bin\quickstart\library\Zend\Controller\Response\Abstract.php(766): Zend_Controller_Response_Abstract->sendHeaders() #2 D:\ZendFramework\bin\quickstart\library\Zend\Controller\Front.php(992): Zend_Controller_Response_Abstract->sendResponse() #3 D:\ZendFramework\bin\quickstart\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch() #4 D:\ZendFramework\bin\quickstart\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #5 D:\ZendFramework\bin\quickstart\public\index.php(26): Zend_Application->run() #6 in D:\ZendFramework\bin\quickstart\library\Zend\Controller\Response\Abstract.php on line 321
I'm betting this is because of $this->_helper->redirector('index') - when I remove it I'm neither redirected back nor getting the error. Also, despite the error, the Album does get added to the main database.
How do I solve this?
May 23rd, 2010 at 18:20 #
Also, I couldn't get $this->getRequest->isPost() to work, so I'm using $_SERVER['REQUEST_METHOD'] == 'POST' instead.
May 23rd, 2010 at 18:31 #
Andre,
Redirect issue is because you have some whitespace before the opening
No idea about second one though :(
Regards,
Rob...
May 28th, 2010 at 10:54 #
your right rob, andre is some missing space before sending location header to buffer. i have error like this an a few hours ago. thanx rob..
May 29th, 2010 at 03:27 #
I use
$this->_request->isPost()
works for me
May 29th, 2010 at 08:38 #
Solving problem like this
Fatal error: Class 'Model_DbTable_Albums' not found in D:\Web\Progs\wamp\www\TestProject\application\controllers\IndexController.php on line 91
when delete album
Just replace line 91 in
application\controllers\IndexController.php
from $albums = new Model_DbTable_Albums();
to
$albums = new Application_Model_DbTable_Albums();
June 6th, 2010 at 16:18 #
I'm using ZF 1.10.4 so I repeated this tutorial as a replacement to chapters 2, 3 and 4 of the book.
This quickstart is head and shoulders above the rest that are available online or in print!
Off now to chapter 5 of ZFiA!
June 7th, 2010 at 13:09 #
hi,,rob..
I have followed the tutorial you get 12 pages, at first I was using netbeans 6.8 .. but when I try running, no output at all .. then I tried again until 12 pages using notepad + +, there is output data to a database but not out ,,
Can you explain why Rob?
June 8th, 2010 at 19:29 #
Rob,
This tutorial have been very usefully in my learning. I followed all the steps and it is running fine.
The problem comes when I want to categorize the project into modules. I never get it running.
1. I tried to add Dojo features to make it more attractive but I have never get this one working. I have tried several tutorial but never worked.
Can you recommend a tutorial like this which I can learn Dojo and using module?
John
June 11th, 2010 at 21:18 #
Well, I think Zend company should hire your company to write the technical manual for their framework. Thanks guys!!!
June 15th, 2010 at 00:57 #
Near the top of page 5 of 18 it states:
"The, application.ini, that is stored in the application/configs directory is loaded using the
Zend_Config_Ini component."
I can see how Zend/Application.php is created configured from public/index.php. But I don't see how Zend_Config_Ini.php is called. I see no reference to it from Zend_Application.php.
What am I missing?
June 16th, 2010 at 17:11 #
VERY GOOOD FOR BEGINNER THANKS FOR SHARING THIS.
June 17th, 2010 at 07:50 #
Hi Rob,
Thanks very much. I am a beginner, this tutorial is an eye opener to zend mvc.
Cheers!
June 19th, 2010 at 20:53 #
Its really fantastic. You just made the Zend installation and the application so simple. Great
June 23rd, 2010 at 22:18 #
On Page 5 you have a "Boostrap" which I assume is like a Bootstrap, but more like a Booze Trap
June 24th, 2010 at 06:20 #
Frank,
It's loaded by Zend_Application, in the _loadConfig() method.
Jim,
Thanks! I've updated the master document.
Regards,
Rob...
June 24th, 2010 at 08:04 #
[...] Und natürlich wurde ich auch nicht auf den ZEND Seiten fündig, sondern in Kommentar Nr. 45 auf Rob Allen's Dev Notes. [...]
June 25th, 2010 at 03:16 #
Hi Rob. Thanks very much for this awesome and clear tutorial. It has helped me get my CRUD functionality off the ground. I have one question:
1. I am using this crud functionality on two controllers. The form for one controller needs a select box populated with the data from the second controller. If possible, can you show us a good way to implement this?
Thank you kindly!
June 25th, 2010 at 09:42 #
Once copied ZF tutorial, even though I set everything exactly as it should be after clicking on add new record throws me error that the page does not exist. Not sure where the problem may be. Thank you in advance for answering.
This is error : http://www.xxx.xx/public/index/add
June 25th, 2010 at 09:44 #
Even number of errors :-) Not Found - 404
July 2nd, 2010 at 01:32 #
Alternative solution for those that have the "Fatal error: Class 'Application_Model_DbTable_Albums' not found in IndexController.php on line 16", I fixed mine by adding that within the Bootstrap.php Bootstrap class
protected function _initAutoload() {
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Application',
'basePath' => APPLICATION_PATH));
/** auto load */
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
return $moduleLoader;
}
Thanks to mikemmx on http://www.zendcasts.com/forum/topic/23/class-not-found/ for this.
July 2nd, 2010 at 08:51 #
Further to my last comment, you can simply add:
protected function _initAutoload() {
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Application',
'basePath' => APPLICATION_PATH));
return $moduleLoader;
}
July 6th, 2010 at 14:48 #
Dear Rob,
Thanks for this tutorial. (I enjoy with it, and I'm waiting for "Zend framework in action" that I've just ordered.)
Here is my problem about the tutorial:
1) I've done all what you said about UTF8 and french characters and it works perfectly for "éèïî'öùü" but not for "à".
2) If the string ends with two "à"; the last "à" is not recorded.
3) If the string ends with one "à", when I click edit, nothing is displayed !!!
Is that a bug ???
My PHP version is 5.3.2.
Sorry for my "light" english, I am French.
July 7th, 2010 at 14:14 #
Thanks for this tutorial.
I typed correctly, but encountered an error:
"Notice: Undefined index: in /sites/zend4/library/Zend/Form.php on line 1052 Fatal error: Call to a member function getOrder() on a non-object in /sites/zend4/library/Zend/Form.php on line 1052 "
Este erro ocorre quando chamo o addAction. Como resolver?
obs: PHP Version 5.3.2-1
ZF Version 1.10.6
Thanks.
July 7th, 2010 at 16:23 #
Sorry, I typed the last phrase in portuguese. The correctly is: "This error occurs when I call the addAction. How to solve?"
July 14th, 2010 at 07:53 #
[...] [...]
July 15th, 2010 at 15:31 #
Very nice tutorial bro ..... keep it up!
July 16th, 2010 at 17:13 #
Rob,
Thanks for this tutorial. It's way better than the one on zend.com. Not that the zend.com tutorial is all that bad, but they throw in way too many unnecessary things that makes newbies think that that is the way to use Zend. Your tutorial sticks to the bare minimum to get started.
My one request is that you convert the PDF to a website of some sort! I've been referencing your PDF so much and it's much harder to navigate the PDF than it would be to navigate a website.
Thanks again.
July 16th, 2010 at 17:45 #
To use this tutorial with Oracle Database here are the changes that
need to be made. They were based on Rob's document version 1.7.2. I
used Zend Server 5.0.2 (PHP 5.3) which had Zend Framework 1.10.3 and
the Oracle OCI8 extension enabled. (I also used the built-in support
for ZF that comes in NetBean's 6.9 PHP edition.)
In application.ini I set the DB parameters to:
resources.db.adapter = "Oracle"
resources.db.params.dbname = "localhost/XE"
resources.db.params.username = "cjones"
resources.db.params.password = "secret"
To aid trouble shooting I found setting displayExceptions to 1 was useful:
resources.frontController.params.displayExceptions = 1
The Oracle SQL to create the example table is:
drop trigger album_trg;
drop sequence albums_seq;
drop table albums;
create table albums (
id number not null,
artist varchar2(100) not null,
title varchar2(100) not null,
primary key (id)
);
create sequence albums_seq;
create or replace trigger album_trg
before insert on albums for each row
begin
select albums_seq.nextval into :new.id from dual;
end;
/
insert into albums (artist, title) values ('Paolo Nutine', 'Sunny Side Up');
insert into albums (artist, title) values ('Florence + The Machine', 'Lungs');
insert into albums (artist, title) values ('Massive Attack', 'Heligoland');
insert into albums (artist, title) values ('Andre Rieu', 'Forever Vienna');
insert into albums (artist, title) values ('Sade', 'Soldier of Love');
commit;
Because Oracle identifiers get described in upper case and because of
the way quoting occurs in Zend_Db, references to identifiers in PHP
code need to be changed to upper case as you do each stage. Below is
a diff of the final files. I did not set db.params.options.caseFolding
or db.params.options.autoQuoteIdentifiers.
Album.php --- Album.php 2010-07-15 16:36:53.537110261 -0700 +++ ../orcl/Album.php 2010-07-15 16:36:16.364995146 -0700 @@ -4,23 +4,23 @@ { public function init() { - $this->setName('album'); - $id = new Zend_Form_Element_Hidden('id'); + $this->setName('ALBUM'); + $id = new Zend_Form_Element_Hidden('ID'); $id->addFilter('Int'); - $artist = new Zend_Form_Element_Text('artist'); + $artist = new Zend_Form_Element_Text('ARTIST'); $artist->setLabel('Artist') ->setRequired(true) ->addFilter('StripTags') ->addFilter('StringTrim') ->addValidator('NotEmpty'); - $title = new Zend_Form_Element_Text('title'); + $title = new Zend_Form_Element_Text('TITLE'); $title->setLabel('Title') ->setRequired(true) ->addFilter('StripTags') ->addFilter('StringTrim') ->addValidator('NotEmpty'); $submit = new Zend_Form_Element_Submit('submit'); - $submit->setAttrib('id', 'submitbutton'); + $submit->setAttrib('ID', 'submitbutton'); $this->addElements(array($id, $artist, $title, $submit)); } } Albums.php --- Albums.php 2010-07-15 16:36:56.801733183 -0700 +++ ../orcl/Albums.php 2010-07-15 16:37:51.013015527 -0700 @@ -2,12 +2,12 @@ class Application_Model_DbTable_Albums extends Zend_Db_Table_Abstract { - protected $_name = 'albums'; + protected $_name = 'ALBUMS'; public function getAlbum($id) { $id = (int)$id; - $row = $this->fetchRow('id = ' . $id); + $row = $this->fetchRow('ID = ' . $id); if (!$row) { throw new Exception("Could not find row $id"); } @@ -17,8 +17,8 @@ public function addAlbum($artist, $title) { $data = array( - 'artist' => $artist, - 'title' => $title, + 'ARTIST' => $artist, + 'TITLE' => $title, ); $this->insert($data); } @@ -26,14 +26,14 @@ public function updateAlbum($id, $artist, $title) { $data = array( - 'artist' => $artist, - 'title' => $title, + 'ARTIST' => $artist, + 'TITLE' => $title, ); - $this->update($data, 'id = ' . (int)$id); + $this->update($data, 'ID = ' . (int) $id); } public function deleteAlbum($id) { - $this->delete('id =' . (int)$id); + $this->delete('ID =' . (int)$id); } } IndexController.php --- IndexController.php 2010-07-15 16:37:00.281133620 -0700 +++ ../orcl/IndexController.php 2010-07-15 16:38:27.594053181 -0700 @@ -26,8 +26,8 @@ if ($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if ($form->isValid($formData)) { - $artist = $form->getValue('artist'); - $title = $form->getValue('title'); + $artist = $form->getValue('ARTIST'); + $title = $form->getValue('TITLE'); $albums = new Application_Model_DbTable_Albums(); $albums->addAlbum($artist, $title); $this->_helper->redirector('index'); @@ -47,9 +47,9 @@ if ($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if ($form->isValid($formData)) { - $id = (int)$form->getValue('id'); - $artist = $form->getValue('artist'); - $title = $form->getValue('title'); + $id = (int) $form->getValue('ID'); + $artist = $form->getValue('ARTIST'); + $title = $form->getValue('TITLE'); $albums = new Application_Model_DbTable_Albums(); $albums->updateAlbum($id, $artist, $title); $this->_helper->redirector('index'); @@ -57,7 +57,7 @@ $form->populate($formData); } } else { - $id = $this->_getParam('id', 0); + $id = $this->_getParam('ID', 0); if ($id > 0) { $albums = new Application_Model_DbTable_Albums(); $form->populate($albums->getAlbum($id)); @@ -72,13 +72,13 @@ if ($this->getRequest()->isPost()) { $del = $this->getRequest()->getPost('del'); if ($del == 'Yes') { - $id = $this->getRequest()->getPost('id'); + $id = $this->getRequest()->getPost('ID'); $albums = new Application_Model_DbTable_Albums(); $albums->deleteAlbum($id); } $this->_helper->redirector('index'); } else { - $id = $this->_getParam('id', 0); + $id = $this->_getParam('ID', 0); $albums = new Application_Model_DbTable_Albums(); $this->view->album = $albums->getAlbum($id); } delete.phtml --- delete.phtml 2010-07-15 16:11:13.981296550 -0700 +++ ../orcl/delete.phtml 2010-07-15 16:06:05.009061440 -0700 @@ -1,10 +1,10 @@ Are you sure that you want to delete - 'escape($this->album['title']); ?>' by - 'escape($this->album['artist']); ?>'? + 'escape($this->album['TITLE']); ?>' by + 'escape($this->album['ARTIST']); ?>'? <form action="url(array('action'=>'delete')); ?>" method="post"> - <input type="hidden" name="id" value="album['id']; ?>" /> + <input type="hidden" name="ID" value="album['ID']; ?>" /> index.phtml --- index.phtml 2010-07-15 16:39:00.320998284 -0700 +++ ../orcl/index.phtml 2010-07-15 16:38:43.321084453 -0700 @@ -1,5 +1,5 @@ <a href="url(array('controller'=>'index', - 'action'=>'add'));?>">Add new album + 'action'=>'add'));?>">Add new album Title @@ -8,13 +8,13 @@ albums as $album) : ?> - escape($album->title);?> - escape($album->artist);?> + escape($album->TITLE);?> + escape($album->ARTIST);?> <a href="url(array('controller'=>'index', - 'action'=>'edit', 'id'=>$album->id));?>">Edit + 'action'=>'edit', 'ID'=>$album->ID));?>">Edit <a href="url(array('controller'=>'index', - 'action'=>'delete', 'id'=>$album->id));?>">Delete + 'action'=>'delete', 'ID'=>$album->ID));?>">DeleteJuly 16th, 2010 at 23:18 #
hi,
i try this tutorial to learn zend. But i've a problem in the models, when i delete the function in my form and zdtable model,i can display the albums but when i write all the functions in these models, the home page is empty, it's display nothing.
So please help me ;)
Thx
July 17th, 2010 at 23:05 #
I have problem with special chars.
I want use populate() method, but this no have success when data from database return special chars. Example:
'cloud', 'céu', 'table', 'mesa'
in above list only input form for 'céu' is empty.
Help me please.
Thanks
July 19th, 2010 at 06:07 #
for the "Fatal error: Class 'Application_Model_DbTable_Albums' not found" error. I found that when I downloaded the files from this site the Albums.php file was in a subdir named 'DbTable' and not directly inside the 'models' dir.
Once I created the 'DbTable' dir and put the Albums.php inside that it all worked. I see I missed that in the pdf tutorial, maybe you have too ? hth :)
July 20th, 2010 at 04:23 #
[...] 接下來的內容將會利"Zend Framework 1.10.6來建立一個簡"的網站,一邊看教學文件為Tutorial: Getting Started with Zend Framework 1.10 by Rob Allen,並"一邊註解筆記。 [...]
July 20th, 2010 at 14:48 #
Thank you for the tutorial which I found really helpful.
I am having a small bit of trouble with the last bit. The application doesn't seem to be building an incorrect sql statement to fetchrows.
The SQL it builds to get a row from this url is
http://quickstart.local/index/delete/id/6
string(49) "SELECT `albums`.* FROM `albums` WHERE (6) LIMIT 1"
the where clause should be id=6, but it's just 6 and it always returns the first record in the resultset.
I know its difficult to debug, I just thought maybe you might have an idea.
Thanks
July 20th, 2010 at 15:04 #
Tom,
Need to see the source code - pastebin it.
Regards,
Rob...
July 21st, 2010 at 08:52 #
Hi Rob
Thanks for the quick reply. It must be just a small typo in my code or something like that. I replaced my files with the files from the tutorial and it all works fine now, so that will be enough to get me going.
Thanks for the tutorial
Tom
July 23rd, 2010 at 10:28 #
[...] 在前一篇寫到建立Action的部分,在這篇將會繼續利"Zend Framework 1.10.6來建立一個簡"的網站,一邊看教學文件為Tutorial: Getting Started with Zend Framework 1.10 by Rob Allen,並"一邊註解筆記。 [...]
July 25th, 2010 at 12:23 #
Hi Rob,
Excellent tutorial, thank you very much. I have had to comment out one line though while going through..
$form = new Application_Form_Album();
//$form->submit->setLabel("Add"); <-----
in addAction method of IndexController.
Even though Eclipse does say I can use "setLabel" I still get a fatal error:
Fatal error: Call to a member function setLabel() on a non-object in C:\work\zftest\application\controllers\IndexController.php on line 29
I just commented it out for now to come back to later anyway.
Best tutorial yet. Gonna get yer book :D
July 25th, 2010 at 12:27 #
@betogroo
Make sure in application/forms/Album.php that you haven't put:
$this->addElement(array($id, $artist, $title, $submit));
it needs to be addElements <- note the S
July 27th, 2010 at 07:30 #
I have been unsuccessful in making zend framework 1.10 talking to db2 express-c edition ver 9.7.
I also used zend studio for development. Zend studio gave me a few dlls to put in php.ini, which I did.
When i tried to run the tutorial application from akarabat.com it says The IBM driver is not currently installed for 'pdo_ibm'
For 'db2' adapter it says The IBM DB2 extension is required for this adapter but the extension is not loaded .
When i checked the PHP error logs it says the following/
PHP Startup: Unable to load dynamic library 'D:\Zend\ZendServer\lib\phpext\php_ibm_db2.dll' - The specified module could not be found.
in Unknown on line 0
When i tried to change the dll file with the one that i got with zend studio it give sthe error message
[27-Jul-2010 11:23:30] PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Zend\ZendServer\lib\phpext\php_pdo_ibm_5.2.2.dll' - The specified module could not be found.
in Unknown on line 0
[27-Jul-2010 11:23:30] PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Zend\ZendServer\lib\phpext\php_ibm_db2_5.2.2.dll' - The specified module could not be found.
In a few forums i found that i have to have the db2 client installed if i am connecting to a db2 installed in a different machine. So i installed
the runtime client with the control center, and I am able to query my tables using the same. But Zend is still giving the same error messages .
I also had included the path 'D:\Zend\ZendServer\lib\phpext' in the system variables. But still Zend is gives the same error messages.
Is it possible to make Zend FWK 1.10 talkt o db2express-c9.7 ?
July 27th, 2010 at 16:33 #
Thanks for this tutorial Rob!
August 3rd, 2010 at 07:07 #
after installing zend server in the same machine as the db machine everything works. However the db runtime client that comes with zend server doesnt seem to connect to db2 express-c.
August 3rd, 2010 at 12:26 #
@Alex
Tks! It's works!
August 3rd, 2010 at 23:22 #
when connecting to thedatabase, would there be any differences if I was trying to map to a database view instead of a table? thanks!
btw, excellent tutorial Rob! Thanks!
August 6th, 2010 at 13:37 #
Hey Rob,
This tutorial is AWESOME!!!
August 6th, 2010 at 22:23 #
First off thanks Rob for a great tutorial! For everyone getting the Application_Model_DbTable_Albums error, the issue is Rob forgot to mention in the pdf that he modified the default namespace! To fix either add appnamespace = "Application" to your application.ini or change the name of the class to Default_Model_DbTable_Albums in both the Albums.php file and in the IndexController.php file.
August 7th, 2010 at 07:28 #
James,
With ZF 1.10.x, the zf command line tool sets the namespace to "Application" in the ini file though. What I can't work out is why this isn't happening for some people!
Rob...
August 9th, 2010 at 16:25 #
My mistake... did not notice the version you where using. The issue might be the error is caused by users running xampp, there is a zf.bat / zf.php in their xampp/php folder that is likely over-riding the up-to-date zf.bat / zf.php file in their C:\Program Files\ZendFrameworkCli\bin folder.
August 12th, 2010 at 12:21 #
I have the same error as Crispijn (post 24)
can anyone point me to the right direction
thanks
August 12th, 2010 at 21:07 #
i have found that i did not configure my httpd.conf properly. it was pointing elsewhere where i had the same project. did not need any virtualhost. hope it helps another dizzy :-)
August 13th, 2010 at 02:12 #
help me!
I don't know error!
class Application_Model_DbTable_Users extends Zend_Db_Table_Abstract {
protected $_name='Users';
public function addAlbum($artist, $title)
{
$data = array(
'artist' => $artist,
'title' => $title,
);
$this->insert($data);
}
}
when i adduser error masages
Catchable fatal error: Object of class Application_Model_DbTable_Users could not be converted to string in F:\xampp\htdocs\zfManager\library\Zend\Db\Statement\Pdo.php on line 228
August 13th, 2010 at 02:57 #
sorry
class Application_Model_DbTable_Users extends Zend_Db_Table_Abstract {
protected $_name='Users';
public function saveUser($user,$pass,$fname,$infor,$cityid,$roleid)
{
//$db = $this->getDefaultAdapter();
$data=array(
'UserName'=>$user,
'Password'=>$pass,
'FullName'=>$fname,
'Address'=>$infor,
'Cityid'=>$cityid,
'RoleId'=>$roleid,
'Information'=>$infor,
);
$this->insert($data);
}
August 16th, 2010 at 10:19 #
Thanks a lot for this tutorial, I manage to make everything except the style:
in layout.phtm i have:
headLink()->prependStylesheet($this->baseUrl().'/css/site.css'); ?> in section
in apache error log i have:
127.0.0.1 - - [*/*/*] "GET /zf-tutorial/public/css/site.css HTTP/1.1" 404 1602
what I need to do to get the css file to work ??
August 16th, 2010 at 12:21 #
solved, I made a mistake in .htaccess file in public folder.
Once more thanks for this tutorial.
August 17th, 2010 at 16:45 #
Thank you for the tutorial. Will you make a fresh HTML tutorial any time soon?
August 18th, 2010 at 14:44 #
thanks for this wonderful tutorial, I had problems with configuring my httpdconf in the start but your tutorial helped and later I found that xampp itself comes with a ZF installation (I never understood why) but yes I was able to quickly go off the ground because of this tutorial. Thanks a lot again
August 19th, 2010 at 03:55 #
thank you so much for this tutorial!!!
August 22nd, 2010 at 21:04 #
Thank you so much for this tutorial. I have one question though which I couldnt find solution for: If I want to have a common directory within the application in a modular structure how can I auto load this resource, for example in the application folder I have a folder called project and in this project I have common classes/models that is specific to the project I am working, how can I get to autoload this class?
Thanks
August 26th, 2010 at 11:16 #
Hallo Rob .thx for ure marvellous tutorial...its the first too become run on my machine..its like a milestone to build enterprise solutions with ZF....
thanx n best regards from germany...
September 1st, 2010 at 14:28 #
Great tutorial. But I hope you could help me on my concern. I am having problem with using the $this->dispatch(‘/path/to/action’) method. I am not redirected to the post-login page. I know I am passing proper credentials in and everything. What could have I done wrong?
September 1st, 2010 at 14:34 #
Steve,
Try using the Redirector.
Regards,
Rob...