phundament / p3widgets
小部件管理器
Requires
- php: >=5.3.0
- bwoester/yii-static-events-component: ~1.0.2
- clevertech/yiibooster: >=1.0,<3.0
- mikehaertl/translatable: 1.*
- phundament/p3extensions: >=0.17.0
- sammaye/auditrail2: 1.*
- schmunk42/access: @stable
- schmunk42/relation: 1.*
- yiiext/status-behavior: 0.7.*
- yiisoft/yii: 1.1.*
This package is auto-updated.
Last update: 2024-09-13 01:12:54 UTC
README
#Phundament 3 - 小部件
P3WidgetsModule 通过小部件容器提供基本的网站内容管理系统 (CMS) 功能,用于前端编辑和管理小部件属性及内容的后端。
小部件容器通过其 id、当前控制器和操作以及可选的请求参数来标记其内容(小部件)。
编辑小部件时,您可以指定其类型(参见配置值 modules[p3widgets].params[widgets]),通过内置的 JSON 编辑器编辑其属性,以及通过内置的 ckeditor 编辑其内容。
使用 yiic migrate 可以轻松完成数据库模式设置。
##资源
插件: 关于通用模块管理和基于 Yii 的 CMS 的深入讨论
##要求
- Yii 1.1.8
- 数据库(已测试 SQLite 和 MySQL)
##安装
解压缩到 'p3widgets'。
运行以下命令创建 webapp
cd p3widgts
/path/to/yii/framework yiic webapp .
使用 yiic 导入数据库模式。注意:此命令将为该模块创建一个独立的迁移表,它不会干扰您的应用程序迁移表!请使用您的应用程序 yiic 命令。
> protected/yiic migrate \
--migrationPath=application.modules.p3widgets.migrations \
--migrationTable=migration_module_p3widgets
将 'p3widgets/config/main.php' 中的内容添加到您的应用程序配置中相应的部分。
return CMap::mergeArray(
require(dirname(__FILE__).'/../modules/p3widgets/config/main.php'),
...
从 Yii、zii 和 yiiext 可用的所有小部件
'modules' => array(
'p3widgets' => array(
'params' => array(
'widgets' => array(
'zii.widgets.CMenu' => 'Menu',
'zii.widgets.CPortlet' => 'Portlet',
'ext.yiiext.widgets.fancybox.EFancyboxWidget' => 'Fancy Box',
'ext.yiiext.widgets.cycle.ECycleWidget' => array(
'name' => 'Cycle',
'checkAccess' => 'Admin'
),
'CFlexWidget' => 'Flex Widget',
'ext.yiiext.widgets.swfobject.ESwfobjectWidget' => 'SWF Object',
'ext.yiiext.widgets.lipsum.ELipsum' => 'Lorem Ipsum Text',
)
)
)
),
如果您想将 'checkAccess' 添加到小部件中,只需使用数组表示法。使用数组键 'name' 作为小部件名称,该名称出现在小部件下拉菜单中。使用数组键 'checkAccess' 只允许特定用户或组访问小部件。
打开 /p3widgets/default/test 或将 P3WidgetContainer 添加到视图中。
[php]
$this->widget(
'p3widgets.components.P3WidgetContainer',
array(
'id'=>'main',
'checkAccess'=>false // disable checkAccess feature for debugging, default 'P3widgets.Widget.*'
)
);
注意:您应该仅禁用 'checkAccess' 功能进行调试或测试。确保同一页面上的容器具有不同的 'id' 值。
##用法
以 'admin' 登录时,您应该会在容器和鼠标悬停时围绕小部件的灰色框中看到管理员控制。您可以在容器之间拖放小部件。要跨页面移动小部件,请编辑它们的控制器、操作或请求Param值。
##小部件示例
小部件类和内容
###CWidget
[html]
<h1>Hello World!</h1>
###ECycleWidget
[html]
<p><img src="http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg" width="75" height="75" alt="" /></p>
<p><img src="http://static.flickr.com/75/199481072_b4a0d09597_s.jpg" width="75" height="75" alt="" /></p>
<p><img src="http://static.flickr.com/57/199481087_33ae73a8de_s.jpg" width="75" height="75" alt="" /></p>
<p><img src="http://static.flickr.com/77/199481108_4359e6b971_s.jpg" width="75" height="75" alt="" /></p>
###EFancyBoxWidget
[html]
<a id="example1" href="http://farm5.static.flickr.com/4058/4252054277_f0fa91e026.jpg"><img alt="example1" src="http://farm5.static.flickr.com/4058/4252054277_f0fa91e026_m.jpg" /></a>
<a id="example2" href="http://farm3.static.flickr.com/2489/4234944202_0fe7930011.jpg"><img alt="example2" src="http://farm3.static.flickr.com/2489/4234944202_0fe7930011_m.jpg" /></a>
<a id="example3" href="http://farm3.static.flickr.com/2647/3867677191_04d8d52b1a.jpg"><img alt="example3" src="http://farm3.static.flickr.com/2647/3867677191_04d8d52b1a_m.jpg" /></a>
从 http://code.google.com/p/yiiext/ 取出的小部件,jQuery 演示页面示例。
##已知问题
如果您的小部件有自定义的 assetsUrl
属性(例如,FancyBoxWidget
),建议使用皮肤文件将此值设置为 NULL
,以避免开发环境和生产环境中值更改时的冲突。
注意:如果您使用主题,请定义活动主题中的皮肤文件,该主题为
p3widgets/p3Widget/...
。
错误:include(LoggableBehavior.php): failed to open stream: No such file or directory
修复:在配置中导入类 vendor.sammaye.auditrail2.behaviors.LoggableBehavior
##开发者
git clone --recursive git://github.com/schmunk42/p3widgets.git \
protected/modules/p3widgets
git clone --recursive git://github.com/schmunk42/p3extensions.git \
protected/extensions/p3extensions
git clone --recursive https://github.com/schmunk42/gii-template-collection \
protected/extensions/gtc
##联系 Tobias Munk
phundament@usrbin.de
http://phundament.com