Tutorial: Getting Started with Zend Framework 1.10

Screen short of Zend Framework tutorial

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 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.

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:

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

140 Responses to “Tutorial: Getting Started with Zend Framework 1.10”

  1. 1 eKini Web Developer Blog » Akra’s Zend Framework 1.10 Tutorial

    [...] 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 [...]

  2. 2 elmich

    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

  3. 3 Rob...

    Thanks for letting me know. I've updated the zip files.

    Regards,

    Rob...

  4. 4 Ahsan Shahad

    thanks ... ever helping tutorial :)

  5. 5 Italo A.

    You'll better correct the pdf version number and the download link from 1.7.0 to 1.10.0 .

    Regards,
    Italo A.

  6. 6 Dan

    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?

  7. 7 Trond Torkildsen

    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. :-)

  8. 8 Renjith

    Error is happeing because class name is wrong
    Solution
    Rename Model_DbTable_Albums to Application_Model_DbTable_Albums in controllers/IndexController.php

  9. 9 Frank

    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

  10. 10 Frank

    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.

  11. 11 Ivan

    In your tutorial, the Application_Model_DbTable_Albums class could be created with the zf command line tool:
    'zf create dbtable Albums albums'

  12. 12 David

    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!

  13. 13 David

    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)

  14. 14 MayorBrain

    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'));

  15. 15 David

    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 !

  16. 16 Viatcheslav

    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.

  17. 17 David

    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

  18. 18 J

    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".

  19. 19 Jay

    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

  20. 20 Skoua

    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?

  21. 21 Rob

    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.

  22. 22 Crispijn

    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!

  23. 23 Rob...

    Crispijn,

    Why? A virtual host is not required for ZF. I know this as I don't use them for local development :)

    Regards,

    Rob...

  24. 24 Crispijn

    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

  25. 25 Luca

    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!

  26. 26 Marijn As

    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!

  27. 27 venkat

    SELECT * FROM emp WHERE ename='smith' AND id=520

    please tell me how to implement this qury in zend frame work

  28. 28 jacek

    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.

  29. 29 ibrahim

    please help,

    Fatal error: Class 'Model_DbTable_Albums' not found in \application\controllers\IndexController.php on line 91

  30. 30 Tom

    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.

  31. 31 krishan gopal

    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.

  32. 32 Michael Kaandorp

    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!

  33. 33 Marco Salvadori

    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?

  34. 34 Rob...

    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...

  35. 35 Michael Kaandorp

    @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.

  36. 36 ibrahim

    @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

  37. 37 Flat

    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...

  38. 38 Flat

    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?

  39. 39 elisha

    im unable to run after placing the file onto the server and facing error in path in public/index.php

  40. 40 GoldenD

    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.

  41. 41 matt

    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.

  42. 42 Rob...

    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...

  43. 43 Sensi

    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.

  44. 44 Sensi

    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');

  45. 45 Sensi

    @ 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

  46. 46 GoldenD

    @ 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.

  47. 47 Sensi

    @ 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

  48. 48 GoldenD

    @ 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.

  49. 49 Sensi

    @ 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. :)

  50. 50 Daniel

    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!

  51. 51 GoldenD

    @ 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.

  52. 52 vicky

    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…

  53. 53 Lorcan

    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!!!

  54. 54 Garry Freemyer

    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.

  55. 55 Sam

    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.

  56. 56 Henri NDIAYE

    Thanks,everything is ok, except in IndexController at line 91.Y've to change Model_DbTable_Albums() to Application_Model_DbTable_Albums().
    Nothing else !!!!

  57. 57 marcus

    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

  58. 58 Rob...

    marcus,

    Put your IndexController.php and index.phtml files up on a pastebin somewhere and link them here :)

    Rob...

  59. 59 Sagar

    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 ?

  60. 60 marcus

    hi here are my files

    index.phtml
    http://www.sendspace.com/file/zv7u01

    IndexController.php
    http://www.sendspace.com/file/pams6x

    thanks

  61. 61 Bledi

    Your tutorial beats zend's quickstart hands down, good detail, good explanation.
    Thank you

  62. 62 Paul

    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 ?

  63. 63 uastasi

    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

  64. 64 Rob...

    uastasi,

    Use a Zend_Db_Table_Select object with join() and setIntegrityCheck(false).

    Regards,

    Rob...

  65. 65 Christoffer

    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

  66. 66 uastasi

    @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.

  67. 67 andy

    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

  68. 68 andy

    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.

  69. 69 PFernandes

    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.

  70. 70 PFernandes

    what/where the hell is Drinkers end? =)

  71. 71 andy

    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

  72. 72 andy

    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.

  73. 73 Enrique

    Thanks for this great tut.
    It's the first one that's been helpful so far and I tried a few...

  74. 74 Luke Mackenzie

    erratum:

    Page 4. The htaccess file does not set the env to development. You need to add it:

    SetEnv APPLICATION_ENV development

  75. 75 David Mintz

    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');

  76. 76 Nagaraju

    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

  77. 77 Rick

    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

  78. 78 Florin

    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

  79. 79 Jan 'luckyduck' Brinkmann

    Very nice tutorial, well written. Thank you very much :-)

  80. 80 Andre

    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?

  81. 81 Andre

    Also, I couldn't get $this->getRequest->isPost() to work, so I'm using $_SERVER['REQUEST_METHOD'] == 'POST' instead.

  82. 82 Rob...

    Andre,

    Redirect issue is because you have some whitespace before the opening

    No idea about second one though :(

    Regards,

    Rob...

  83. 83 indir

    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..

  84. 84 andy

    I use

    $this->_request->isPost()

    works for me

  85. 85 Tester

    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();

  86. 86 Frank

    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!

  87. 87 adiputra

    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?

  88. 88 JOHN

    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

  89. 89 karan

    Well, I think Zend company should hire your company to write the technical manual for their framework. Thanks guys!!!

  90. 90 Frank

    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?

  91. 91 Muzafar Ali

    VERY GOOOD FOR BEGINNER THANKS FOR SHARING THIS.

  92. 92 Yelba

    Hi Rob,
    Thanks very much. I am a beginner, this tutorial is an eye opener to zend mvc.

    Cheers!

  93. 93 subbu

    Its really fantastic. You just made the Zend installation and the application so simple. Great

  94. 94 Jim

    On Page 5 you have a "Boostrap" which I assume is like a Bootstrap, but more like a Booze Trap

  95. 95 Rob...

    Frank,

    It's loaded by Zend_Application, in the _loadConfig() method.

    Jim,

    Thanks! I've updated the master document.

    Regards,

    Rob...

  96. 96 Zend Framework – Gemischt UTF-8 & ISO-8859-15 | Rund Um Linux

    [...] Und natürlich wurde ich auch nicht auf den ZEND Seiten fündig, sondern in Kommentar Nr. 45 auf Rob Allen's Dev Notes. [...]

  97. 97 Mark

    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!

  98. 98 robo

    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

  99. 99 robo

    Even number of errors :-) Not Found - 404

  100. 100 BenP

    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.

  101. 101 BenP

    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;
    }

  102. 102 Philippe

    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.

  103. 103 betogroo

    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.

  104. 104 betogroo

    Sorry, I typed the last phrase in portuguese. The correctly is: "This error occurs when I call the addAction. How to solve?"

  105. 105 Anonymous

    [...] [...]

  106. 106 Waqas Ali

    Very nice tutorial bro ..... keep it up!

  107. 107 Gerard

    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.

  108. 108 Christopher Jones

    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));?>">Delete
    
  109. 109 lupin

    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

  110. 110 Max

    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

  111. 111 shoo

    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 :)

  112. 112 [php] Zend Framework初心者入門 (版本1.10) – part 1 | 不務正業

    [...] 接下來的內容將會利"Zend Framework 1.10.6來建立一個簡"的網站,一邊看教學文件為Tutorial: Getting Started with Zend Framework 1.10 by Rob Allen,並"一邊註解筆記。 [...]

  113. 113 Tom

    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

  114. 114 Rob...

    Tom,

    Need to see the source code - pastebin it.
    Regards,

    Rob...

  115. 115 Tom

    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

  116. 116 [php] Zend Framework初心者入門 (版本1.10) – part 2 | 不務正業

    [...] 在前一篇寫到建立Action的部分,在這篇將會繼續利"Zend Framework 1.10.6來建立一個簡"的網站,一邊看教學文件為Tutorial: Getting Started with Zend Framework 1.10 by Rob Allen,並"一邊註解筆記。 [...]

  117. 117 Alex

    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

  118. 118 Alex

    @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

  119. 119 Dd

    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 ?

  120. 120 Gladson

    Thanks for this tutorial Rob!

  121. 121 Dd

    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.

  122. 122 betogroo

    @Alex

    Tks! It's works!

  123. 123 jw

    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!

  124. 124 Luis

    Hey Rob,
    This tutorial is AWESOME!!!

  125. 125 James

    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.

  126. 126 Rob...

    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...

  127. 127 James

    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.

  128. 128 loic

    I have the same error as Crispijn (post 24)
    can anyone point me to the right direction
    thanks

  129. 129 loic

    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 :-)

  130. 130 neo

    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

  131. 131 neo

    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);
    }

  132. 132 koobalt

    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 ??

  133. 133 koobalt

    solved, I made a mistake in .htaccess file in public folder.

    Once more thanks for this tutorial.

  134. 134 Hai Melius

    Thank you for the tutorial. Will you make a fresh HTML tutorial any time soon?

  135. 135 zend framework tutorial

    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

  136. 136 dpthuy

    thank you so much for this tutorial!!!

  137. 137 ayman

    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

  138. 138 scarli

    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...

  139. 139 TheDietMafiaHitman

    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?

  140. 140 Rob...

    Steve,

    Try using the Redirector.

    Regards,

    Rob...

The views expressed in these comments are not the views of the publisher. However, we believe in the rights of others to express their legitimate views and concerns. Any legitimate complaint emailed to rob@akrabat.com will be seriously considered and the post reviewed as desirable and necessary.

Leave a Reply

Buy now!