dtsjq28482 2012-02-21 10:40
浏览 46

使用Cakephp从Wordpress中提取博客文章

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.

  • 写回答

1条回答 默认 最新

  • drmcm84800 2012-02-21 11:17
    关注

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

    http://book.cakephp.org/1.3/view/1058/useDbConfig

    评论

报告相同问题?

悬赏问题

  • ¥15 对于这个复杂问题的解释说明
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败