Monday 22 Oct 2012

Monday 22 Oct 2012


apache2 zendframework zendframework-bin mysql-server php5-mysql ssh

a2enmod rewrite

create project

zf create project zf vi zf/public/.htaccess AllowOverride All


create databsae

mysql -u root -p create database site_db create database site_db_testing create database site_db_dev

zf configure db-adapter 'adapter=PDO_MYSQL&dbname="sites_db"&host="localhost"&username="root"&password="nchcnchc"' production zf configure db-adapter 'adapter=PDO_MYSQL&dbname="sites_db_testing"&host="localhost"&username="root"&password="nchcnchc"' testing zf configure db-adapter 'adapter=PDO_MYSQL&dbname="sites_db_dev"&host="localhost"&username="root"&password="nchcnchc"' development

less application/configs/application.ini

load database and data

see news.sql

DROP TABLE IF EXISTS news; CREATE TABLE IF NOT EXISTS news ( id int(50) NOT NULL AUTO_INCREMENT, site int(50) COLLATE utf8_unicode_ci NOT NULL, title longtext COLLATE utf8_unicode_ci NOT NULL, date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE INDEX "id" ON "news" ("id");

INSERT INTO `news` (`id`, `site`, `title`, `date`, `note`) VALUES (1, 0, 'test title', '2012-10-22 11:07:31', 'test note'), (2, 0, 'test title 2, how long this text area. 說明中文最新消息', '2012-10-22 11:08:53', '測試中文');

zf create db-table News news

model and mapper?? ?

if abstract??/default api not enough; try create mapper and model


action: list news add news edit news delete news

zf create controller News zf create action add News zf create action edit News zf create action delete News