Questions tagged [yii-components]

Yii is an open source, object-oriented, component-based MVC PHP web application framework. Yii is pronounced as "Yee" or [ji:] and it's an acronym for "Yes It Is!"

For more information on Yii components, please see the Yii documentation at:

http://www.yiiframework.com/doc/guide/1.1/en/basics.component

434 questions
2
votes
2 answers

How to validate a variable in PHP using standard Yii2 validators without creating a model?

By the book, you suppose to manage post requests with core validators and rules that are described within a model. The problem comes up if you want to use a separate variable elsewhere. First you get it from the request i.e. $var =…
Danil
  • 3,348
  • 2
  • 20
  • 16
2
votes
1 answer

How to configure cache for nodge eauth in Yii2

Now, I use default cache for all: 'cache' => [ 'class' => 'yii\caching\FileCache', ], And I use nodge eauth for registration users. Default config nodge: 'components' => [ 'eauth' => array( 'class' => 'nodge\eauth\EAuth', 'popup' =>…
Mс1er
  • 59
  • 5
2
votes
2 answers

Yii 2 use same controller method / action in multiple controllers

I have a method checking whether user is logged in in my UserController.I need the same method in all the other controllers.How can I do the same without copy pasting the code to all controllers. The controller method looks like public function…
Jinu Joseph Daniel
  • 5,864
  • 15
  • 60
  • 90
2
votes
1 answer

Property CWebApplication.Cookies is not defined

I am using this link to use the cookies functionality in yii framework. When I accessed the application in localhost it gives following error: Property CWebApplication.Cookies is not defined. Please help me guys that where I am doing mistake. I…
Tausif Anwar
  • 1,237
  • 1
  • 10
  • 21
2
votes
2 answers

How to read excel file and display data in Yii 2?

I have tried to use PHPExcel library to read the excel file and display data from the file. But it was not working for me. I have also tried using yii2-phpexcel extension also other some ways but nothing worked for me. I hope I would get help from…
The Coder
  • 618
  • 3
  • 10
  • 22
2
votes
2 answers

How to create table from PDO in yii2?

Hy guys, How to create table in PDO yii2? this code in my controller $db = new yii\db\Connection([ 'dsn' => 'pgsql:host=localhost;dbname=mydata', 'username' => 'local', 'password' => 'bukapeta', 'charset' => 'utf8', …
2
votes
1 answer

Yii2 Advanced Template Customization

Is there a way in which to combine the Yii2 Advanced Framework with both a custom frontend (PHP/HTML) template as well as a second custom backend (PHP/HTML) template so that it truly resembles and behaves like these Pixelcave Templates? I have…
mijopabe
  • 646
  • 5
  • 23
2
votes
1 answer

Login form in header on every page in yii2

How can I display a login form in header navigation on every page using Yii2? I tried to use: $form = ActiveForm::begin(..); $form->field(..); ActiveForm:end(); But I'll have to add LoginForm model for each page in site controller. Is there a…
Mihail0v
  • 93
  • 1
  • 6
2
votes
3 answers

Conditional model rules in Yii

I'd like to add some extra validation to a Yii model. I know it is simple enough to add in some logic to say a form field must be an exact length of 6 characters, however is it possible to set the rule to say the following: if ($_POST['code'] ==…
Zabs
  • 13,852
  • 45
  • 173
  • 297
2
votes
1 answer

require_once(PHPUnit/Extensions/SeleniumTestCase.php) in yii

i'm trying to use phpunit in yii i followed the instruction to install it from http://phpunit.de/manual/4.1/en/installation.html when i'm doing this phpunit protected/tests/unit/ this error happend PHP Warning: …
Hossam Aldeen Ahmed
  • 772
  • 1
  • 8
  • 20
2
votes
1 answer

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

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' => [ …
user3265065
2
votes
3 answers

Display GMT time zone in php

How can I display like this CountryName GMT +5.30 timezone in php? . The country names are fetching from the database and GMT calculations must be displayed based on the country name. I tried different functions like get_defaulttimezone, But they…
Lakshmi
  • 85
  • 2
  • 7
2
votes
1 answer

CHtml Link returns null for parent

I created a url using Chtml::Link like this: CHtml::link("Remove", '#', array('class' => 'delete'))) Now, when user clicks it i send a ajax request like this: $('.delete').click(function(e) { e.preventDefault(); $.ajax({ url:'" .…
2
votes
1 answer

Yii Jasphp Reporting Extension :: Usage

I just installed yii jasPHP extenstion for reporting my application. I need some guide or example to use more. I can send a string to pdf. But I need a complete table from database. How can I do that... ? please help me out My Controller public…
Selim Reza
  • 372
  • 8
  • 20
2
votes
2 answers

How to create a confirm dialog box before submit in Yii framework

I'm new to Yii framework, I need to create a confirm dialog to pop up before I submit a form. Below is the code of the form used to approve and reject. I need a pop up to appear before I submit to confirm whether approved or rejected.
user2770039
  • 59
  • 1
  • 2
  • 14