How can I enable Markdown formatting for a specific column in GridView and ListView?
关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率

已采纳
Yii:使用CGridView和CListView进行CMarkdown
收起
- 写回答
- 好问题 0 提建议
- 关注问题
微信扫一扫
点击复制链接分享
- 邀请回答
- 编辑 收藏 删除 结题
- 收藏 举报
1条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
dsykx64220 2011-07-15 15:54关注You can use custom functions to process columns. If you have PHP 5.3 you can do it the following way:
'columns'=>array( array( 'name'=>'My markdown column', 'value'=> function($data, $row){ $parser = new CMarkdownParser(); // if data is entered by user you can purify it using safeTransform return $parser->transform($data); } ), )
For PHP <5.3 it's the same except you should wrap your code into a string and avoid using anonymous function.
本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏举报微信扫一扫
点击复制链接分享
编辑预览轻敲空格完成输入- 显示为
- 卡片
- 标题
- 链接
评论按下Enter换行,Ctrl+Enter发表内容
编辑
预览

轻敲空格完成输入
- 显示为
- 卡片
- 标题
- 链接
报告相同问题?
提交
- 2013-08-28 19:25回答 3 已采纳 Okay, you will have to get that grid into the create form. To do that, the actionCreate of your Em
- 2015-01-02 05:47回答 2 已采纳 I fixed the problem using a different syntax for the CGridView column: array('name'=>'title',
- 2016-07-16 12:34回答 1 已采纳 While other topics here on SO offer a chincy hack solution, or to simply fetch it through Yii::$ap
- 2014-07-22 15:10weixin_34090562的博客 ClistView同上结合使用,其中的_view中可以用一个$data的变量,代表当前的model数据 如果dataProvider中的pagination,sort设为false,则CliveView中对应的部分也无法使用 $this->widget('zii.widgets.ClistView',...
- 2014-11-26 08:37回答 1 已采纳 If you are using CActiveDataProvider as data provider in your CListView then you must calculate sa
- 2013-11-13 01:31回答 1 已采纳 As you noticed, you'll need flag icons to start with. You could, for example, use these. You may o
- 2016-11-29 04:25回答 1 已采纳 I finally ended up solving it myself. Looks like it needed an ID that contains only integer values
- 2017-09-03 14:55weixin_33816300的博客 CStatePersister是yii的核心组件,提供了基于文件的数据保存方式,可以不在同的请求中使用 COutputCache 即是一个组件,又是一个filter,前者的时候用于在view中缓存内容,后者的时候用于在controller中缓存 ...
- 2015-11-28 04:05回答 2 已采纳 findAll() method retrieves an array of ActiveRecords, so you need a foreach loop. Try: foreach (
- 2014-09-11 05:31回答 2 已采纳 Actually, there is no difference between $class->getAttribute() and $class->attribute. But t
- 2016-04-04 23:08回答 1 已采纳 Instead of Yii::trace(), you can try to use Yii::log(): public function actionCallCommentForm($id
- 2012-11-01 07:34chensong0708的博客 ClistView同上结合使用,其中的_view中可以用一个$data的变量,代表当前的model数据 如果dataProvider中的pagination,sort设为false,则CliveView中对应的部分也无法使用 $this->widget('zii.widgets.ClistView',...
- 2013-02-12 16:27jiufreeman的博客 关于widgets,他们在yii中的关系如下 system.web.widgets 系统自带最基本的widget zii.widgets 是基本扩展 zii.widgets.grid 是基本扩展的重要分支 zii.widgets.jui 是插件扩展 一,system.web.widgets ...
- 2014-03-22 06:19xiangpingeasy的博客 ClistView同上结合使用,其中的_view中可以用一个$data的变量,代表当前的model数据 如果dataProvider中的pagination,sort设为false,则CliveView中对应的部分也无法使用 $this->widget('zii.widgets....
- 2012-01-10 09:24uiexp的博客 CgridView必序和data provider一起使用 最简单的用法 $dataprovider = new CActiveDataProvider('Post'); $this->widget('zii.widgets.grid.CGridView',array( 'dataProvider'=>$dataprovider, )); 这会用表格的方式...
- 没有解决我的问题, 去提问
联系我们(工作时间:8:30-22:00)
400-660-0108kefu@csdn.net在线客服
- 京ICP备19004658号
- 经营性网站备案信息
公安备案号11010502030143
- 营业执照
- 北京互联网违法和不良信息举报中心
- 家长监护
- 中国互联网举报中心
- 网络110报警服务
- Chrome商店下载
- 账号管理规范
- 版权与免责声明
- 版权申诉
- 出版物许可证
- ©1999-2025北京创新乐知网络技术有限公司