I've created a cakephp component called 'Wordpress' in order to pull the top X posts from my wordpress install on the same domain.
Which model should I use for something like this? I don't actually have a WordPress model, as obviously its a different database schema.
Whats the best way to do something like this?
EDIT: I found this: http://www.kyletyoung.com/code/cakephp_wordpress_component
However, I'd still be interested to know about this situation, where you connect to a non-cake DB.
If you want to connect to second database directly (Wordpress one), you can set up a model for a table from that database and set it to use a different database connection.
To do that, you have to define additional database connection in database configuration file. http://book.cakephp.org/1.3/en/view/922/Database-Configuration
And then set your model to use that configuration.
var $useDbConfig = 'alternate';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.