yii-extensions

Disable a css for part of the content

只愿长相守 提交于 2019-12-24 00:42:47
问题 I am using Yii-bootstrap extension and I am having some styling problem because bootstrap css files affect the main content of the page. My main content is a map done with OpenLayers so I am having several problems with styles mixing between them. I have tried to do a css file more general, as I have seen they recomend on the web,for applying different styles but as they are two "automatic" libraries is a hard work to try to guess how they work and the classes they use. Is there any way to

Yii Bootstrap not loading JS files

别说谁变了你拦得住时间么 提交于 2019-12-23 03:49:08
问题 I'm using Yii-Bootstrap in my brand new Yii project. I followed the install instructions exactly. On the front page I am using the JS Carousel plugin. $this->widget('bootstrap.widgets.TbCarousel', array( 'items'=>array( array( 'image'=>'http://placehold.it/770x400&text=First+thumbnail', 'label'=>'asdf', 'caption'=>'Cras justo odio, ' ), array( 'image'=>'http://placehold.it/770x400&text=Second+thumbnail', 'label'=>'asdf', 'caption'=>'Cras justo odio, ' ), array( 'image'=>'http://placehold.it

How does a select2 widget gets populated with AJAX?

China☆狼群 提交于 2019-12-21 22:33:03
问题 When I enter a few characters in my widget, I get results like these from AJAX: [{"id":550,"campName":"IB Resi Showtime Rebate Website"},{"id":60,"campName":"OB ACGBK EB"}] However, I'm missing the part on how to populate the widget with those results. Here is the code I use for the widget: $this->widget ( 'ext.ESelect2-master.ESelect2', [ 'selector'=>'#campaigns', 'options'=> [ 'tags'=>$tags, 'allowClear'=>true, 'minimumInputLength' => 2, 'width'=>'300px', 'multiple'=>true, 'placeholder'=>

What is the difference between component, extension & module in Yii

自闭症网瘾萝莉.ら 提交于 2019-12-20 09:22:05
问题 I am new to Yii framework, and just came across module , extension & component inside protected folder. Can anyone please differentiate all these theoretically as well as practically also. 回答1: Components are the classes which can help you write the business logic on the basis of your models. Suppose all of your model files are using the same logic, So that logic can be written inside component instead of writing for each controller. Extensions are like the libraries, which basically are not

Yii Index View Data Rendering With Condition

假如想象 提交于 2019-12-20 07:10:52
问题 I am new to yii framework i have created an yii web application with one module . Now my question is i have added an sample data into my module in my module i have an columns name,dept and and active ,i want to render the data in the grid view only the data where active=0 , Can anyone help me how to change the data rendering query and how to add the condition <div class="block"> <div class="content"> <h2 class="title">Users's details</h2> <div class="inner"> <?php $this->widget('zii.widgets

How do I pass a global variable in Main layout page before $content in Yii2

谁说我不能喝 提交于 2019-12-19 04:14:07
问题 I am trying to create dynamic menu in yii2 using "Nav::widget". Here is my code in menu section in main layout page: echo Nav::widget([ 'options' => ['class' => 'navbar-nav navbar-right'], 'items' => [ ['label' => 'Home', 'url' => ['/site/index']], ['label' => 'About', 'url' => ['/site/about']], Trying to get the solution: Please have a look:: 1 I have created a super controller "components/Controller.php" in app: namespace app\components; use app\models\MenuPanal; class Controller extends

How to validate email and email already exist or not check, in Yii Framework?

风格不统一 提交于 2019-12-18 05:37:36
问题 How to validate email using Yii Model validation rules function code. Also how to check email exist or not using Model validation rules function in Yii. 回答1: You can set your model validations as below public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( //First parameter is your field name of table which has email value array('email', 'email','message'=>"The email isn't correct"), array('email', 'unique','message

Yii Framework form submit button showing error

醉酒当歌 提交于 2019-12-13 04:46:52
问题 I am getting an error Fatal error: Call to a member function hasErrors() on a non-object in F:\xampp\yii\framework\web\helpers\CHtml.php on line 2253 when trying to access the url http://localhost/happybox/index.php/site/cart/3 . The code of my view file cart.php is: Hello, <?php echo ucwords(Yii::app()->user->name); ?>,<br/> This is your cart<br/> Click on Order to Place and Order.<br/> <?php $Orders = Orders::model()->findAll(array( 'select'=>'products_id', 'condition'=>'users_id=:id &&

how to remove module name from url in yii [duplicate]

家住魔仙堡 提交于 2019-12-12 20:25:13
问题 This question already has answers here : Yii - Hiding module name in URL (2 answers) Closed 5 years ago . I try to remove module name from url in YII http://testdomail.com/demo/user/create I want http://testdomail.com/user/create Where demo is my module name. How can I do this? 回答1: You can define any url in your config by making some changes in your configuration file main.php . Please have a look here. 来源: https://stackoverflow.com/questions/24989418/how-to-remove-module-name-from-url-in

Yii2 saving form with multiple models

删除回忆录丶 提交于 2019-12-12 11:35:00
问题 Hi I am very close to finish a project but got stuck saving a from with multiple models. I have a grid that calls a controllers action that calls a form. public function actionToday() { $ID = $_GET["0"]; $modelCustomers = Customers::find()->where(['ID' => $ID])->one();; $today = date("Y-m-d"); $beforeToday = 'DropinDate>'.$today; $modelAttendance = Attendance::find()->where(['CustomersID' => $ID])->andwhere(['DropinDate' => $today])->one(); return $this->render('//attendance/_form-today