yii2

Unknown Property – yii\base\UnknownPropertyException ::discription:html

孤人 提交于 2019-12-23 04:29:37
问题 This is the continuation of this question How to hide detail view labels on yii2 <?= DetailView::widget([ 'model' => $model, 'template' => '<tr><td{contentOptions}>{value}</td></tr>', 'attributes' => [ [ 'attribute' => 'discription:html', 'label' => '' ] ], ]) ?> The description is supposed to render in HTML only So the above code is but if I use the above code I am ending up in at this error. Unknown Property – yii\base\UnknownPropertyException 回答1: Each attribute may has own settings which

Yii2 modal with composite key

巧了我就是萌 提交于 2019-12-23 04:22:30
问题 Can anyone help me with the composite key? I am not able to function properly. function init_click_handlers(){ $(".button-endereco").click(function(e) { var fcodigo = $(this).closest("tr").data("codigo"); var fcodigopessoa = $(this).closest("tr").data("codigopessoa"); var map = {codigo: $(this).closest("tr").data("codigo"), codigopessoa: $(this).closest("tr").data("codigopessoa")}; $.get( "update ", { codigo: fcodigo codigopessoa: fcodigopessoa }, function (data) { $("#endereco-modal").find("

In Yii2 framework, better place to define common function which is accessible everywhere like controller, model, view

做~自己de王妃 提交于 2019-12-23 03:26:42
问题 Like i want to create function with name "dt()" function dt(){ return date('Y-m-d H:i:s'); } and want to access it like this:- echo dt(); //retrun current date and time format Which is better place in Yii2 framework to do that? 回答1: You can use it this way: http://www.yiiframework.com/extension/yii2-helpers/ Create a folder /common/helpers/ , then create a helper class there and add your static methods. namespace common\helpers; class DateHelper { public static function dt(){ return date('Y-m

Displaying PostGIS Data with Leafletjs

浪尽此生 提交于 2019-12-23 03:13:22
问题 I'm learning GIS with PostGIS and I wanted to try something funny so I downloaded shape files from OSM, imported in PostGres with PostGIS extension and now I want to represent data from PostGIS visually. I have Pulled data with Query SELECT ST_AsGeoJSON(geom) FROM "dar-es-salaam_tanzania.land_coast; I got bunch of GeoJSON and wanted to show them to user. Unfortunately it does not show it. I use Yii2 to write codes that pulls the data. Here is the controller code: public function actionIndex()

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

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 open view page in popup in yii2?

纵饮孤独 提交于 2019-12-23 02:04:00
问题 I have to open view page contain in popup instead of page.After click on view open view contain in popup yii2 回答1: You should try this code for opening popup. and also you need to render with ajax view using this $this->renderAjax() . controller public function actionView($id) { if (Yii::$app->request->isAjax) { return $this->renderAjax('view', [ 'model' => $this->findModel($id), ]); } else { return $this->render('view', [ 'model' => $this->findModel($id), ]); } } View <?= GridView::widget([

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

Init application component with config from database

a 夏天 提交于 2019-12-22 17:02:03
问题 I'm building a Yii2 application that sends email through the swiftmailer extension. I store the email settings (smtp, ssl, username, etc..) in a database table, to be able to edit them with an apposite view. How can I init swiftmailer with config from the db table? Thank you. 回答1: You can initialize application components using set() method available through application object Yii::$app : use Yii; ... // Get config from db here Yii::$app->set('mailer', [ 'class' => 'yii\swiftmailer\Mailer',

how can I add modal to navbar in yii2 using yii2 -bootstrap extension?

丶灬走出姿态 提交于 2019-12-22 15:49:50
问题 I'm trying to put modal in a navbar in my yii2 project. I'm using yii2-bootstrap extension. Code for my nav: NavBar::begin([ 'brandLabel' => 'My Company', 'brandUrl' => Yii::$app->homeUrl, 'options' => [ 'class' => 'navbar-inverse navbar-fixed-top', ], ]); $menuItems = [ ['label' => 'Home', 'url' => ['/site/index']], //['label' => 'facilities', 'url' => ['/facilities/index']], ['label' => 'Hotel', 'items' => [ ['label' => 'Facilities', 'url' => ['/facilities/index']], // '<li class="divider">