Yii

How to install the AWS SDK in Yii

谁说我不能喝 提交于 2020-01-01 11:48:28
问题 I would like to use the Amazon AWS SDK for PHP in my Yii project, however I get all kinds of include errors (such as include(CFCredentials.php): failed to open stream: No such file or directory ). I think it may be related to Yii's assumption that class names must match file names... What can we do?? 回答1: I've made that: spl_autoload_unregister(array('YiiBase', 'autoload')); require_once PATH_TO_AWS_SDK . 'sdk.class.php'; // I write down in PATH_TO_AWS_SDK.'config.inc.php' my CFCredentials

Error 400 Invalid request YII for deleting a record

…衆ロ難τιáo~ 提交于 2020-01-01 11:33:50
问题 I am trying to delete a record in Yii, which throws a Error 400. Please do not repeat this request again. It's checking for a post variable, my controller file has if(Yii::app()->request->isPostRequest) When I echo my post variable it's blank whereas $_GET has the id which I want to delete, my View file looks like, echo CHtml::link(CHtml::encode('Delete image'), array('image/delete', 'id'=>$image->id), array('class' => 'delete','confirm'=>'This will remove the image. Are you sure?')); The

%40 on click turns to %2540

做~自己de王妃 提交于 2020-01-01 09:40:10
问题 when the link is clicked containing the @ symbol, the url gives me %40, which is what I want. But once I click it, one second later it changes to %2540 right after I click. The click is within an email, then directed to the site, where %40 changes to %2540. How can I make it stop changing? it is getting the params like this now: $email=Yii::app()->request->getParam('email'); not sure what other information i should provide. 回答1: The issue is that your %40 is url-encoded again (since % encodes

Yii framework Many to Many relationships

雨燕双飞 提交于 2020-01-01 08:46:57
问题 What is the method to save and update Many to Many relationship in Yii framework? 回答1: There is a better implementation as behavior. http://www.yiiframework.com/forum/index.php?/topic/6905-please-test-my-ar-enhancement-automatically-sync-many-many-table-when-calling-save/ 回答2: Unless you create a model for the table between the two main tables, your only option is to use DAO (Database Access Object) and specify SQLs with it. Have a look at how blog demo accomplishes this task. 回答3: use MANY

Many to Many Relationships

我怕爱的太早我们不能终老 提交于 2020-01-01 05:43:17
问题 I'm seeing all sorts of different ways to handle many to many relationships in Yii. However, the examples I'm seeing aren't fully fleshed out and I feel like I'm missing something. For instance, Larry Ullman's tutorial doesn't use the self::MANY_MANY relation - http://www.larryullman.com/2010/08/10/handling-related-models-in-yii-forms/ So as far as adding and retrieving records, whats the standard way for handling Many to Many in the Model, Controller and View? clarification: I suppose Im

How to display data from related tables in CGridview in yii

末鹿安然 提交于 2020-01-01 03:39:24
问题 I am trying to display the results using CGridView. i have two tables Users and products . ExiProducts is the table which maintains the many to many relation between then and let the relation name is 'myrelation' public function actionSearch() { if(isset($_GET['searchButton'] && $_GET['searchType']==='products') { $searchString= trim(strip_tags($_GET['searchValue'])); $model=new Products; $criteria->compare('productName', $searchString, TRUE, 'AND', TRUE); $criteria->compare('productType',

Best way of global registering ClientScript?

拟墨画扇 提交于 2020-01-01 03:34:05
问题 I want to register user script globally, to be available all over the site. Now I insert in every action in my controllers: Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/script.js'); But really I understand that it's not good way... 回答1: If you are looking forward to use themes in your project, i would put some css and scripts in layout file ( views/layouts/my-layout-file.php ). Because if you changing theme you will be using another css and maybe sometimes another

How to specify image paths in CSS files?

僤鯓⒐⒋嵵緔 提交于 2020-01-01 03:13:27
问题 I'm using Yii framework and have a CSS file that uses some images for background and similar. Other PHP code can use Yii::app()->request->baseUrl to prefix the resources with correct path. However, css file is not PHP, so I cannot use the code. I tried with relative paths, but the same css file is accessed by html pages of different depth, for example: http://mysite/controller/action1/10 http://mysite/controller so relative paths don't work (at least, not in all browsers). Is there some Yii

open_basedir restriction in effect and subdomains

空扰寡人 提交于 2019-12-31 07:24:28
问题 For security reasons I have put my yii folder below the html root, so my structure looks like this /conf /httpdocs /httpsdocs /yii when running the site I get an error open_basedir restriction in effect that yii.php which is called by index.php out of httpdocs is not in the allowed path. Because this site is a subdomain do I edit the vhosts.conf of the main domain or of the subdomain? What would the proper setting be to allow /var/www/vhosts/example.com/subdomains/mysubdomain/yii Path to be

YII queries not working [closed]

三世轮回 提交于 2019-12-31 05:39:06
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have a table with around 700,000 rows. Profile::model()->findAll("country='US'") I used this to find all rows that have 'US' as its country. But the execution stopped and I didn't get any result. But then I added limit like below Profile::model()->findAll("country='US' limit 10000") then it worked. why the