Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* /application/configs/application.ini */
- resources.db.adapter = "mysqli"
- resources.db.params.host = "localhost"
- resources.db.params.username = "horarioe_root"
- resources.db.params.password = "******"
- resources.db.params.dbname = "horarioe_cadastro"
- resources.db.params.default = "true"
- resources.multidb.wpress.adapter = "mysqli"
- resources.multidb.wpress.host = "localhost"
- resources.multidb.wpress.username = "horarioe_word"
- resources.multidb.wpress.password = "*****"
- resources.multidb.wpress.dbname = "horarioe_wordpress"
- /* /application/modules/default/controllers/BlogController.php */
- <?php
- class Default_BlogController extends Zend_Controller_Action
- {
- /*
- * @TODO: Estilizar posts
- * @TODO: Criar pagina��o
- */
- /*
- * @returns Zend_Db_Adapter_Mysqli
- */
- private $db;
- public function init()
- {
- /* Initialize action controller here */
- $configs = new Zend_Config_Ini(APPLICATION_PATH."/configs/application.ini",APPLICATION_ENV);
- $config = $configs->get('resources')
- ->get('multidb')
- ->get('wpress');
- $config = $config->toArray();
- $this->db = new Zend_Db_Adapter_Mysqli($config);
- }
- public function indexAction()
- {
- $where = "select post_date, post_title, post_content where post_status = publish";
- $query = $this->db->select()
- ->from('wp_posts',array(
- 'post_date',
- 'post_title',
- 'post_content',
- ))
- ->where('post_status = ?', 'publish')
- ->limit('3')
- ->order('post_date', 'desc')
- ->query();
- $this->view->posts = $query;
- }
- }
Add Comment
Please, Sign In to add comment