Questions tagged [yii]

Inquire here about any iteration of Yii, an innovative PHP5 open-source MVC framework exclusively designed for crafting cutting-edge web 2.0 applications.

Is it possible to establish GEO filters for distance searches utilizing Yii2-Sphinx?

I've been having success with the Yii2-sphinx extension, but now I'm looking to implement distance search using sphinx. Specifically, I need to set latitude and longitude filters for a given postcode on my index. How can I go about setting up the ...

Utilizing Yii to Partially Render and Send JSON Response via AJAX

My current issue is regarding the return of data. When attempting to send the rendered partial view data from my controller to AJAX, the code provided below will be utilized. JQuery AJAX: $.ajax({ url: "<?php echo $this->createUrl('aj ...

Tips for dynamically updating Yii Error Handler?

Within Yii's config.php file, there is a statement that specifies the default Controller and only Error-Handler in the application: 'errorHandler' => array( 'errorAction' => 'site/error', ), In order to display error messages on my site, I need ...

Having trouble with Yii login authentication, encountering this issue

In Yii, I have successfully implemented my project with working login authentication on one system. However, when I copied the same project to another system, I encountered the following error: session_regenerate_id(): Cannot regenerate session id - heade ...

The executable file specified in "@php_bin@" is not a valid command recognized as being internal or external, operable program, or batch file

Recently, I have been using PHPUnit and Selenium Server for testing my Yii Application on a Windows XP operating system. I installed PHPUnit_Selenium (1.0.1) and followed the instructions provided in this forum post to set everything up: http://www.yiifram ...

Solving the Conundrum: User Authentication Failure in Yii

When I try to log into an application built on the Yii framework, it appears that the login process gets stuck at either the validation or the login function in my site controller. The login never goes through and nothing useful happens. There are no error ...

Modifying the HTML Structure in Yii's CListView

I need help with modifying the HTML output of my CList view when there is pagination present. Currently, it displays: Showing 1-3 out of 5 items. However, I want to remove this message from the top of the pagination. Can someone guide me on how to achie ...

Guide on updating the database connection in YII

I am currently working on a Yii application and I need to update the database connection. Initially, my app was connected to the 'trackstar' database, but now I want to switch it to the 'taskmanagement' database. To make this change, a ...

Displaying the Yii form directly on the page upon loading, rather than enclosed within a jQuery dialog box

After studying this yii wiki page, I encountered an issue where the form is supposed to appear within a jQuery dialog box, but it opens immediately when the page loads instead. Upon further investigation, I discovered that removing the success callback fr ...

Proper navigation for Yii functional testing

Currently, I am working on running Selenium tests for my Yii application. I have successfully executed a simple test where I open the entry page and verify the presence of a specific text. Let's take a look at the snippet of the test: class ItemTest exte ...

Using Yii: Steps to incorporate a CSS class into a dropdown menu

I am currently working with Yii 1.1.10 and I am interested in learning how to incorporate a CSS class into a dropdown list while using a CActiveForm. For instance, how could I go about adding a CSS class to the following dropdown list? <?php echo $for ...

PostgreSQL and Large CSV Files

Hey there, I'm in need of some help or advice. Currently, I am trying to manage a PostgreSQL database table using CSV files that contain over 500,000 records on average. Previously, I was able to use the Yii Framework to have an administrator handle t ...

Adding numerous rows simultaneously in YII framework

After reviewing the material on I am confused by this line of code: $items=$this->getItemsToUpdate(); What exactly does the $this->getItemsToUpdate() function do? My goal is to insert multiple rows dynamically at once. I have managed to use jQuer ...

Combining the Power of Bootstrap with Yii Framework

As a newcomer to the Yii framework, I am looking to incorporate my Bootstrap design into this platform. One issue I have encountered is related to my custom CSS. In Bootstrap, we use navbar-default for styling the navbar. I customized my navbar color by ...

Implementing websocket functionality in Yii framework

I am currently working on integrating websocket functionality into my web application using PHP and as an extension for Yii. This will allow me to create a notification system similar to what I have in mind. My starting point is the code available at the ...

Exploring the wonders of jQuery Ajax within Yii

I am developing a custom shop application and I have a query. In my project, the implementation of Ajax in Yii involves: <?php echo CHtml::ajaxLink( '', array("cart/add/id/$item->id"), array( ' ...

Distinguishing Between init() and __construct() in Yii2: A Comprehensive Comparison

Initialize() method : public function initialize() { } Constructor() method: public function constructor() { } Therefore, what sets them apart and which one should be employed? ...

Submitting a Yii 2 form automatically when it loads

Pjax::begin(); $form = ActiveForm::begin(); echo $form->field($model, 'testdata', [ 'inputOptions' => [ 'class' => 'form-control input-xsmall input-inline' ], ])->label(Yii::t('app', 'Record ...

Exploring the uses of looping and conditional statements within PHP arrays

How can I create a loop and condition in an array to generate a schedule calendar? $this->widget('ext.yiicalendar.YiiCalendar', array ( 'linksArray'=>array ( '2014-12-13'=>array ( ...

The concept of method overloading within the Yii framework model

I am interested in implementing method overloading within a Yii framework model. Similar to Java, where method overloading allows for multiple methods with the same name but different parameters, I am curious if this concept can be applied in PHP Yii fram ...

Sending mail to multiple recipients using Yii mailer

Looking for help on sending mail to multiple recipients using Yii mailer. I have written code that successfully sends emails to a single recipient, but I am struggling to make it work for multiple recipients. $mail_ids = $_POST['invitefriend']; ...

Conditional validation for uploading image files using Yii2

As a beginner in Yii, I am seeking guidance on applying image validation for .svg and .png files only when the user selects an image. public function rules() { return [ [['logo'], 'file', 'extensions'=&g ...

Creating dynamic JavaScript widgets with Yii's partial rendering functionality

Having an issue with dynamically reloading areas in an HTML file using an Ajax-based approach. Although I am able to successfully update the desired area (HTML div tag), a new JavaScript file is downloaded and processed each time, which adds unnecessary pr ...

Improving User Experience with Yii's Dynamic Form Validation using Ajax

As someone new to Yii, I am facing a challenge with my form. The form is designed as an admin-backend type with several buttons, each linked to a specific action in the controller. My goal is to validate the form elements based on different scenarios and d ...

What is the best way to update a dropdown field in a form without having to refresh the entire form by utilizing ajax?

Within a form, there is a dropdown field populated with item names from a database. If a new item needs to be added, the user can click on the "Add New" button to open a pop-up window and save the new item. After saving the new item in the database, it d ...

Popup window for Ajax pagination in CgridView

In my project, I am displaying a set of data in a pop-up window using cgridview. However, when I attempted to implement ajax pagination, it failed to work properly. To address this issue, I created a view called listInvoices that contains only the cgrid da ...

Yii: the sequel to the query parameter

I am attempting to query my database in Yii framework. $query = Task::find() ->where([Task::tableName().'.parent_id' => 0]); $query->leftJoin(TaskModel::tableName(), [TaskModel::tableName().'.task_id' => Task::table ...

Creating a centralized controllers folder for a yii2 project

I am looking to integrate a shared controller directory into my Yii2 project. Inside my frontend/config/main.php file, I have the following setting: 'controllerNamespace' => 'frontend\controllers', My goal is to include both ...

Problems encountered when transferring information from jQuery to PHP through .ajax request

Hey there! I am currently working with Yii and facing an issue while trying to pass some data to a controller method called events. This is how my jQuery ajax call looks like: var objectToSend = { "categories" : [selectedOption],"datefrom" : month + "" + ...

What is the best way to extract a single variable's value from var_dump in PHP?

Within the Yii framework, I have a variable called $var->VerseTranslations. When I use var_dump on it. For example: var_dump($var->VerseTranslations); It returns an array as shown below. array (size=3) 0 => object(VerseTranslations)[96] ...

Unable to display results in YII query Builder

I am facing an issue with using two different syntaxes of the Yii query builder. The first syntax works perfectly but I cannot use variables inside the SQL. $connection = Yii::app()->db; $sql='SELECT id_activo, nom_activo, valor_activo, cod_amenaza, t ...

After performing a URL rewrite, the Yii Ajax save operation returns a 301 response

I've implemented an inline editor that utilizes AJAX to save content by calling a Yii controller. The process works perfectly fine. However, after shortening my URLs using .htaccess and Yii urlManager, I encountered a 301 response when trying to save ...

Is there a way to retrieve the total number of result sets in Yii Framework?

When using the Yii Framework, I executed an SQL procedure called getData() and successfully obtained multiple result sets by using the code below: $resultSets = Yii::app()->db->createCommand("call getData()")->query(); I am now wondering how I c ...

Exploring data retrieval through relationships in the Yii PHP framework

Greetings, I am facing an issue with my database where I utilize a link table to establish connections between products and categories. The relational structure is as follows: Product ProductCategories Category Id Id ...

I am looking to retrieve a list of all actions that a user has the authorization to carry out in Yii

How do I retrieve the actions that I have defined in my accessRules function? public function accessRules(){ return array( 'allow', 'actions'=>array('create','update' ...), ...

"Incorporating a new column into the database through the model and controller in Yii

When working in the Yii MVC framework, I decided to add a new column to my database model using the following code: $success = Yii::app()->ft_website_prod->createCommand()->addColumn('ft_website.users', 'columnname', 'varchar(64)'); Now, I am f ...

Challenges with CJuiDialog pop-up feature

As a beginner in AJAX, jQuery and similar technologies, I am currently working on a project that involves creating a calendar where substitutes can indicate their availability for specific days and time periods. However, I am facing an issue with implement ...

How can you use ajax to update the content of a single div in Yii?

I encountered a little issue when attempting to refresh the content of my div using Ajax, as it ends up replacing the entire page within that div. This is causing some trouble for me. Here is a snapshot of the problem: Problem Screenshot You can view my ...

Tips for properly using parent:: within beforeSave, beforeValidate, afterSave, and similar methods

While exploring the Yii documentation, one common piece of advice that frequently comes up is to "Make sure you call the parent implementation so that the event is raised properly" for methods like beforeSave, beforeValidate, and afterSave. In a Yii Blog ...

How to Implement Ajax in Datatables within the Yii Framework

Currently, I am delving into the world of the EDatatables extension for Yii. My main query revolves around where the ajaxUrl should be pointed to and how one should effectively handle the ajaxRequests. Despite the fact that the Datatable is visible on my ...

Struggling with issues during the testing of your Yii application on Selenium?

I am currently using selenium-server-standalone-2.44.0.jar to conduct tests on my Yii application. When I run it in the console without any parameters: java -jar selenium-server-standalone-2.44.0.jar I encounter a few issues: Firefox hangs.In the c ...

Verify if the relationship is established with the value attribute of CDataColumn

Is it possible to use a conditional statement within the value attribute of CDataColumn to verify if a model has a value set before displaying it? For example, I have a model Source with an optional relation 'country' that is not always set for e ...

Yii validation rule for ensuring uniqueness

In the Yii framework, is it possible to use a unique validation rule to check the uniqueness of a field under certain conditions (I am aware of criteria, but this condition is a bit complex)? For example, I want to ensure that the 'num_days' value is uniqu ...

yii ajaxurl customization for table sorting

Here is some code I have: ajaxUrl : '<?php echo Yii::app()->createUrl("abc/def");?>&page={page}&size={size}&{sortList:col}&{filterList:fcol} ', Referenced from: http://mottie.github.io/tablesorter/docs/example-pager-aj ...

Enhancing Form Fields Dynamically using AJAX and JSON

I'm trying to update specific fields in my form after fetching data from a database using AJAX and JSON. Here is the code snippet: In my form: <div class="form"> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'anagrafica- ...

Make an ajax request to a method in YII framework

I need to send an AJAX call to a function within the directory structure outlined below: Yii::$app->request->absoluteUrl."protected/humhub/modules/post/controllers/PostController/UploadMusicFile"; Here is my view function: function uploadImage ...

Obtain the model's name in a different format using Yii

I have a model called model1 which can have multiple pages associated with it. When creating a 'model1' instance, users are able to create pages under that specific model. Within this creation form, the user must fill out a form which requires fetching the ...

The jQuery function .val()/.text() is unable to retrieve information from a particular section of HTML

Implementing HandlebarsJS with PHP and Yii to generate a page. Here is a snippet of the html/handlebars code on the page {{#if embed_link}} <p class='f_hidden_p'> <a href='{{embed_link}}'> {{ ...

retrieve a compilation of all files located within a designated directory that is separate from the system folder

Hello, I am a beginner with yii and I am trying to retrieve a list of files from a directory located outside of the system folder. I have attempted to do so with the following code snippet: $fileListOfDirectory = array(); $pathTofileListDi ...

Rails GridView inspired by Yii framework

I have been using Yii for a considerable amount of time, but now I am interested in exploring the possibilities with Ruby on Rails. Although I have always had a fondness for Yii's GridView because of its simplicity in displaying records from the database ...

Obtaining the uploaded file in the Controller that was uploaded using the yiihelpersHtml::fileInput method in Yii2

I included the following code in my form: <?php echo Html::fileInput('imageFile', '', array('id' => 'contentForm_imageFile' )) ?> Then, I attempted to retrieve the file in the controller using this code: $newsModel->imageFile=UploadedFile::g ...

Using the Zend HTTP library, Privoxy, Tor, and cURL work together seamlessly

Seeking expert assistance as I am confronted with a puzzling situation. Allow me to provide some context on what I am attempting and the current setup. Initially, I had a script that successfully posted over an https form using Zend_Http_Client. My server ...

Creating a custom rule in Yii's URLManager to handle multiple parameters for controller actions

I'm looking to utilize the following URL: index.php/form/2/fields/all In order to display a list of fields with the same form ID. At present, I have a Form CRUD and a Fields CRUD. FieldsController.php public function actionAll() { if (isset($_GE ...

If the value is not set for $_POST when sent via an AJAX request

I have set up a zii.widgets.jui.CJuiDialog to send a form via ajax to my controller. However, I am facing an issue where the post variable if(isset($_POST['Item'])) does not seem to be present when I test for it in the controller. I am trying to ...

What is the best method to create a URL slug similar to Quora's using the Yii framework?

After using Quora, I started to question how they create their unique identifiers known as slugs such as quora.com/topics-slugs, quora.com/questions-slug, or quora.com/usernames-slug. I am currently working on an application using the yii framework and I ...

PHP 5.6: Issue with array_column function returning empty arrays

When working in a production environment utilizing the Yii1 framework and PHP 5.6.40, an issue arises where the array_column function returns an empty array. The array consists of CActiveRecords from another CActiveRecord's HAS_MANY relation. Interestingl ...

yii date validation guidelines

Facing an issue with date validation rules. When I input an invalid date like 'xxxx', the validator doesn't work, but it's functioning for other fields with required validation. The Form ?php $form=$this->beginWidget('CActiveForm', array( 'id'=> ...

What exactly do you mean by "controller views" in Yii?

Currently diving into the realm of Yii URL management through Yii's online guide: http://www.yiiframework.com/doc/guide/1.1/en/topics.url. There is a particular line that caught my attention: While URLs can be fixed in controller views, it is ofte ...

Generate code in Yii2 using the active form

This is the code I am using in Yii2: <?= $form->field($model, 'username')->label(false); ?> <?= $form->field($model, 'password')->label(false); ?> It produces the following output: <div class="form-group field-validate-usernam ...

Sharing transient information with concealed field in Yii

Trying to transfer temporary data from my form to my model is proving to be a challenge. Despite having hidden data in the form, it fails to retrieve any values from the model. The form code looks like this: <?php echo $form->hiddenField($model, 'f ...

Storing information in a database using Ajax in the Yii Framework

I am looking to extend the validity of a specific post by updating its toDate field and adding 1 month. Initially, I display all available posts with a button beside each one that, when clicked, triggers the update process. In the code snippet below, clic ...

What are the steps for applying validation successfully?

Hello, I have a table containing various fields and I am looking to implement validation on these fields. The fields in question are as follows: user_mobile admin_mobile user_email admin_email All of these fields are stored in the same database. I would ...

Display Custom Form Fields Based on Radio Button Selection

Being a new user of Yii, I've been immersed in it for less than 2 months. Currently, my focus is on creating a registration form that initially displays only 2 radio buttons - one representing a Person and the other an Organization. Upon selecting either o ...

Is it possible to use JavaScript to clear a field that was generated by Yii CRUD?

Issue with Yii's GRUD field generated and Firefox HTML: <?= $form->field($model, 'productId')->textInput(['maxlength' => true]) ?> Comparison of PHP generated code to Firefox HTML: <input id="taolistforcreate-productid" class="form-con ...

Utilize PHP to assign a variable to a different PHP condition

Perhaps this question is quite straightforward... I am currently utilizing the yii framework for my development work. Below is an excerpt of my code: Within the Controller: $gamecat = GamesDevelopersApp::model()->find($app_id); $cat = CH ...

Finding a date after a specific time period using PHP

I am currently utilizing the Yii framework and I have a query regarding getting the current date in PHP (Yii framework) using the following code snippet: $date = new CDbExpression('NOW()'); When executed, it returns the date in the format of "2013-04-27 ...

How to Toggle the Submit Button Using jQuery

I have implemented a feature using jQuery to disable the submit button and display a loading image. Here is how I have set it up: The HTML structure for the submit button looks like this: <div id="registerbtn" name="registerbtn"> <input typ ...

Retrieving URL parameters in YII Framework

As a complete beginner in Yii, my professor tasked us with creating a school project after showing us three tasks to do in Yii. Looking at two classes I have, StudProg and NivoStudija, I am trying to pass the 'naziv' attribute from nivoStudija/admin to stu ...

Transfer information via ajax to yii controller

Thank you all for your assistance, it has been incredibly helpful. I am new to yii and feeling a bit overwhelmed at the moment. I have created a jQuery script to validate a form and then send it to my controller to process and save in the database. Howev ...

Accessing data from an ever-changing table

I am currently working with a dynamically created table using Datatables. foreach ($results as $value) { echo ' <tr> <td>'.$value->object_name.'</td> <td& ...

Having trouble with Yii's RenderPartial CActiveDataProvider pagination?

Here is the code from my controller: public function actionRead() { $criteria=new CDbCriteria(array( 'order'=>'id desc', )); $enP=new CActiveDataProvider('Re ...

Searching for URL slug using preg_match

Looking for a URL slug pattern that matches the following: apple-india apple-price-in-india domain.com/apple-India domain.com/apple-price-in-india Restrictions: only small characters and - allowed in the slug. Seeking guidance on how to achieve this us ...