{"id":374,"date":"2012-04-22T23:42:07","date_gmt":"2012-04-23T06:42:07","guid":{"rendered":"http:\/\/www.hongyu.org\/wordpress\/?p=374"},"modified":"2012-04-24T22:39:47","modified_gmt":"2012-04-25T05:39:47","slug":"zend-framework-quick-start","status":"publish","type":"post","link":"https:\/\/www.hongyu.org\/wordpress\/?p=374","title":{"rendered":"Zend Framework quick start"},"content":{"rendered":"<li>create project<br \/>\n    [sourcecode]zf.sh create project rsvp[\/sourcecode]\n<\/li>\n<li>Link library<br \/>\n    [sourcecode]ln -s \/path\/to\/ZendFramework-1.11.11-minimal\/library\/Zend .[\/sourcecode]\n<\/li>\n<li>set up access permission for application\/ folder by add .htaccess file with line:<br \/>\n    [sourcecode]deny from all[\/sourcecode]\n<\/li>\n<li>To set the project as a sub-folder instead of document root (common in shared hosting), one has to set up path redirect. First, we need to change .htaccess file under the project folder to add path rewrite function (Note: need to make sure apache httpd.conf has the &#8220;AllowOverride  All&#8221; set for the folder)\n<p>[sourcecode]<br \/>\nRewriteRule (.*) .\/public\/$1<br \/>\n[\/sourcecode]<\/p>\n<p>Second, we can edit configs\/application.ini and add a line<br \/>\n[sourcecode]settings.baseUrl = &quot;\/rsvp&quot;[\/sourcecode]<\/p>\n<p>Third, edit Bootstrap.php and add a function<br \/>\n[sourcecode]<br \/>\n\tprotected function _initBaseUrl()<br \/>\n\t{<br \/>\n\t\t$options = $this-&gt;getOptions();<br \/>\n\t\t$baseUrl = isset($options[&#8216;settings&#8217;][&#8216;baseUrl&#8217;])<br \/>\n\t\t\t? $options[&#8216;settings&#8217;][&#8216;baseUrl&#8217;]<br \/>\n\t\t\t: null;  \/\/ null tells front controller to use autodiscovery, the default<br \/>\n\t\t$this-&gt;bootstrap(&#8216;frontcontroller&#8217;);<br \/>\n\t\t$front = $this-&gt;getResource(&#8216;frontcontroller&#8217;);<br \/>\n\t\t$front-&gt;setBaseUrl($baseUrl);<br \/>\n\t}<br \/>\n[\/sourcecode]<\/p>\n<\/li>\n<li> create layout<br \/>\n    [sourcecode]zf.sh enable layout[\/sourcecode]<br \/>\n    and then edit application\/layouts\/layout.phtml to add necessary header\/footer inclusion.\n    <\/li>\n<li>set up database by editing application\/configs\/application.ini file<br \/>\n[sourcecode]<br \/>\nresources.db.adapter = PDO_MYSQL<br \/>\nresources.db.params.host = localhost<br \/>\nresources.db.params.username = my_username<br \/>\nresources.db.params.password = my_password<br \/>\nresources.db.params.dbname = my_db<br \/>\n[\/sourcecode]<\/p>\n<\/li>\n<li>create controller<br \/>\n    [sourcecode]zf.sh create controller controllername[\/sourcecode]\n<\/li>\n<li>create action<br \/>\n    [sourcecode]<br \/>\nzf.sh create action add controllername<br \/>\nzf.sh create action edit controllername<br \/>\nzf.sh create action delete controllername<br \/>\n[\/sourcecode]\n<\/li>\n<li> create model<br \/>\n[sourcecode]<br \/>\nzf.sh create db-table controlername db_table_name<br \/>\n[\/sourcecode]<\/p>\n<p>and then modify application\/models\/DbTable\/ProjectName.php to add CRUD DB functions.<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>create project [sourcecode]zf.sh create project rsvp[\/sourcecode] Link library [sourcecode]ln -s \/path\/to\/ZendFramework-1.11.11-minimal\/library\/Zend .[\/sourcecode] set up access permission for application\/ folder by add .htaccess file with line: [sourcecode]deny from all[\/sourcecode] To set the project as a sub-folder instead of document root (common in shared hosting), one has to set up path redirect. First, we need to change &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.hongyu.org\/wordpress\/?p=374\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Zend Framework quick start&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/374"}],"collection":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=374"}],"version-history":[{"count":17,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":383,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/374\/revisions\/383"}],"wp:attachment":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}