问题标签 [yii]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
860 浏览

php - 如何进行多插入并获取ID

我想在表格中插入一些数据

使用多插入

是否可以获得最后插入的 id 表?

我问是因为我不确定是否所有人都会以这种形式出现:(n,n+1,n+2)。

我使用mysql inodb。

0 投票
3 回答
23358 浏览

php - 如何自定义 Yii CGridView Pager?

如何自定义 Yii CGridView Pager 的位置、css、模板?

0 投票
2 回答
897 浏览

forms - User settings mechanism for Yii

I need some help with user settings mechanism for my Yii-based application.

I've created the following db structure to store user settings:

  1. table user with the following fields

    id | username | email | etc.

  2. table settingslist (to store a list of all possible settings with descriptions) with the following fields

    id | code | name | description

  3. table settings (to store all user settings) with the following fields

    id | userid | settingslistcode | value

Now I'm stuck with the form which allows user to change his settings. I had to deal before with the regular models (i.e. for posts, comments, etc.) where every new model had only one row in the database (Post model - id | title | body |) with the certain amount of attributes (fields of the table). But now I need to store user settings in 10-15 rows and I don't know how to apply Yii model mechanism to work with this, so I can retrieve those settings in a single form (so user could change his preferences).

Any suggestions are greatly appreciated.

Thank you!

0 投票
5 回答
9420 浏览

php - 如何在 yii 框架控制器中传递参数以访问规则表达式

ow to pass arguments to accessRules experessions 下面的代码不起作用,因为 $owner_id 未在评估表达式的类中定义。任何想法如何解决它?

0 投票
8 回答
35066 浏览

php - A CMS based on Yii?

i've been with Yii for a few months and before I use main CodeIgniter, SilverStripe in my projects. Does anyone know a good Yii based CMS such as SilverStripe based on Sapphire or EE based on CodeIgniter ?

My experience is working with Yii is much more easier and straightforward assuming you are good OOP coder but Yii is still young and there are not lot of samples that I can put together quickly for a real prodcution project.

A couple of YII based CMS I spotted at do not look really promising or maybe at a very early stage such as dotPlant, Web3CMS.

0 投票
2 回答
792 浏览

php - YII中保存多层次模型的问题

我的用户表结构及其地址详细信息如下

关系如下 用户有多个联系人,即永久地址、当前地址、办公地址。每个联系人都有州和城市。

用户->联系人->这样的状态

如何一次性保存这种结构的模型。

请尽快回复

0 投票
2 回答
986 浏览

php - 如何在 Yii 中引发 CComponent 事件

假设我在页面上呈现了组件(比如像 Yahoo Finance 这样的图表)。组件视图模板包含一堆 a_hrefs,我想在图中切换周期。我在组件中创建了事件和事件处理程序。我有两个问题:

  1. 如何通过这些 a_hrefs 在 Graph Component 上引发事件(它们应该是 Graph 的一部分吗?)?
  2. 如何在不丢失当前页面上下文(部分、过滤器 - 指定为 $_GET 值)的情况下重绘图表?

我的图形组件如下所示:

0 投票
1 回答
1443 浏览

php - Yii $loginUrl='/' 问题(没有重定向到登录页面)

我注意到如果您的站点位于域的根目录,例如 www.example.com 而不是 www.example.com/website/ 那么如果您在 Yii 的配置中设置了 $loginUrl='/',重定向将不起作用,因为处理时 url 被剥离为空字符串。为了克服我添加的

在我的 WebUser.php

我希望这对某人有帮助。

但是,有没有人知道更好的方法

在控制器中而不是

0 投票
1 回答
18448 浏览

php - Can I refresh a Yii CGridView from js?

When a "Create" modal dialog is submitted via XHR Then the rows in a Yii CGridView should be refreshed.

I've tried to achieve this by rendering the new gridview in the XHR "create" action and then inserting it into the page via $("#list").html(response), but rendering a CGridView causes jQuery <script> include tags to be registered for inclusion, and so when I introduce those tags into the page they reload jQuery, which wipes out my live event handlers, so a bunch of stuff breaks.

Which has me thinking, "the GridView knows how to refresh itself. heck, it does all the time on sort or page."

So I can click a sort button in the GridView from js, but thats less than Ideal. I'd prefer to say

$("#list").gridview('reload') or $.fn.gridview.reload("#list") or some such sense.

Or do the way cool thing that is soo much simpler that you thought of just now.

0 投票
7 回答
30939 浏览

php - 在哪里学习 Yii?

我一直在尝试学习 Yii,但没有运气。我发现 Zend Framework、Kohana、Code Igniter 等其他框架比 Yii 更容易学习。该文档也 su**s。您可以发布易于理解且编写良好的教程/文章的链接吗?官方文档里写满了语法错误,似乎很仓促……