Yii

how get parameters from compose() in view Yii-2?

不打扰是莪最后的温柔 提交于 2019-12-23 02:43:07
问题 how get parameters from compose() in view Yii-2? I try: /controllers/SiteController Yii::$app->mailer->compose('layouts/html.php', ['model' => 'trtrtrtrt',]) ->setFrom('ergegergerger@gmail.com') ->setTo('ergergergegerg@mail.ru') ->setSubject('TEST') ->send(); mail/layouts/html.php <?php use yii\helpers\Html; use yii\mail\BaseMailer; /* @var $this \yii\web\View view component instance */ /* @var $message \yii\mail\MessageInterface the message being composed */ /* @var $content string main view

To add remainder email in yii using crontab

早过忘川 提交于 2019-12-23 02:42:53
问题 as suggested I created a File MessengerCommand.php under protected/commands as class MessengerCommand extends CConsoleCommand { public function run($args) { /* if(ERunActions::runBackground()) { */ $mail=Yii::app()->Smtpmail; $mail->SetFrom("tsadmin@softthink.com", 'From NAme'); $mail->Subject ="hello"; $mail->MsgHTML("haiii workd"); $mail->AddAddress("rajesh.udutha@itaugments.com", ""); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; }else { echo "Message sent!"; } } } and

Yii query returning no results

假如想象 提交于 2019-12-23 02:19:19
问题 I'm struggling to create the correct query in Yii, I believe I'm making progress though. I need to check a related table and only want to return records that don't have a record in the related table. This was answered here- Yii determining existence of related models What is complicating this and I'm unsure how to overcome it, is that multiple users can have records in this related table. Therefore the full requirement is to return records where no related record exists, but only counting

How do I combine & minify JS and CSS for a Yii app on Heroku?

谁说胖子不能爱 提交于 2019-12-23 02:13:08
问题 I tried to follow the instructions in the guide, but I got an error. http://www.yiiframework.com/doc-2.0/guide-structure-assets.html#combining-and-compressing-assets $ yii asset assets.php config/assets-prod.php Loading configuration from 'assets.php'... Collecting source bundles information... Creating output bundle 'all': Compressing JavaScript files... PHP Warning 'yii\base\ErrorException' with message 'file_put_contents(/cygdrive/c/Users/Chloe/workspace/xxxxxx/web/assets/js/all-temp.js

How to assign unique id attribute to each table row of a CGridView?

拈花ヽ惹草 提交于 2019-12-23 02:03:11
问题 I am attempting to assign a unique id to each table row in Yii's CGridView . Preferably something like $data->id from the database table. I have been unsuccessful at adding an id attribute to each rendered <tr> . Any suggestions would be most appreciated. 回答1: CGridView have an option called 'rowHtmlOptionsExpression' , you can declare like the followings to assign row an id 'rowHtmlOptionsExpression' => 'array("id"=>$data->id)', It's better than hacking into 'rowCssClassExpression' Good luck

Yii::app()->db->createCommand($sql1)->queryAll() is not returning whole table [closed]

流过昼夜 提交于 2019-12-23 01:54:43
问题 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 6 years ago . $rows = Yii::app()->db->createCommand()->select('*')->from('states')->queryAll(); above code returns only single first row, while according to documentation it should return all rows. 回答1: queryAll() returns an array and u need to iterate in order to get all the records foreach($rows as $row){ //do something }

Can someone explain how Yii minimizing assets is supposed to work on Heroku?

浪尽此生 提交于 2019-12-23 01:41:58
问题 I just got through getting the minification to work (How do I combine & minify JS and CSS for a Yii app on Heroku?) locally. However, it creates the all-1bc649be34b1e6afc9b2419687cde016.js file under web/assets/ . Yii creates a .gitignore to ignore everything in that directory. None of the files will make it to Heroku. Even if I use heroku run yii asset assets.php config/assets-prod.php it will only create ephemeral files that are not accessible to the web dynos. (As suspected it does fail in

Yii determining existence of related models

本小妞迷上赌 提交于 2019-12-23 01:40:11
问题 I want to run a findAll query that that only returns records where a related record doesn't exist. Can anyone tell me how this is done in Yii? Just a little bit of context in case it helps- I'm working on a survey application, the objects I'm working with are- QuestionSurvey AnsweredQuestion SurveyQuestion HAS_MANY AnsweredQuestion I therefore want to return QuestionSurvey models where no related AnsweredQuestion exists. Thanks in advance, Nick 回答1: If you SurveyQuestion::model()->with(

yii import extension not finding class

拜拜、爱过 提交于 2019-12-23 00:43:29
问题 I am using the Facebook SDK For PHP. I added the facebook php SDk in the yii app protected/extension folder and imported it in config/main.php as follow. 'import' => array( 'application.extensions.facebook.*', ), my problem is that the app is not finding the classes in the sdk when i create the object as follows: $session = new FacebookSession($access_token); it is giving error as follow: Fatal error: Class 'FacebookSession' not found .... if I try using include_once() or require_once() then

Dynamic added form fields based on 1-to-n relation - What framework alternatives? [closed]

让人想犯罪 __ 提交于 2019-12-22 18:51:11
问题 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 . We have to develop a multi-model form that should use ajax calls to dynamically add or remove, sub-model fieldsets. For example, let's imagine this team form scenario : Team: Team Name: Team Country: Members: Member A name: Member A age: [add another member] [REGISTER TEAM AND MEMBERS] We are using Yii at the