drmonkeyninja/cakephp-rss 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drmonkeyninja/cakephp-rss

Composer 安装命令:

composer require drmonkeyninja/cakephp-rss

包简介

CakePHP RSS datasource

README 文档

README

RSS datasource plugin for CakePHP 2.

Installation

License Build Status

This plugin can be installed using Composer:-

composer require drmonkeyninja/cakephp-rss

Alternatively copy the plugin to your app/Plugin directory and rename the plugin's directory 'Rss'.

Then add the following line to your bootstrap.php to load the plugin.

CakePlugin::load('Rss');

Usage

The values shown below under the Optional comment will be set to the values you see there if they are left out. The required options must exist. If you wish, you can make different database config property for each different feed you would like to work with. The feedUrl is an optional parameter that will be used by default if it is not set in the model.

<?php
// app/config/database.php
class DATABASE_CONFIG {
	public $feedSource = array(

		/** Required **/
		'datasource' => 'Rss.RssSource',
		'database' => false,

		/** Optional **/
		'feedUrl' => 'http://feedurl',
		'encoding' => 'UTF-8',
		'cacheTime' => '+1 day',
	);
}

Inside of each model that will consume an RSS feed, change the $useDbConfig property to the appropriate feed property from the database.php file. If you are instead using a single database config property, you would set the feed url in the model. The public $feedUrl is read before a read, and takes priority over the feedUrl set in the database config property.

<?php
// app/Model/Feed.php
class Feed extends AppModel {
	public $useDbConfig = 'feedSource';
	/** Optional **/
	public $feedUrl = 'http://feedUrl';
}

Then in your controller that uses the model, simply use the $this->Model->find('all');

<?php
// app/Controller/FeedsController.php
class FeedsController extends AppController {
	public function index() {
		$this->set('feeds', $this->Feed->find('all'));
		return;
	}
}

统计信息

  • 总下载量: 833
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固