Codxplore.com

Latest news:

Quran ul karim is a free Quran application for android. This application is advertisement free application for android smartphone. Download from https://play.google.com/store/apps/details?id=com.akramhossain.quranulkarim&hl=en

3067
Views
php export csv utf 8

php export csv utf 8

While generating a CSV using PHP sometimes we stumbled upon one common problem  where any special character like £ becomes ASCII in generated CSV file,  the reason behind this is the encoding of generated CSV is wrong and  we need to output CSV in UTF8 format, so we will be able to use special ASCII characters in CSV file. Using example below we can encode UTF8 generated CSV file,  We ne
2233
Views
Yii2 Scenarios validate only create Action

Yii2 Scenarios validate only create Action

Yii2 model scenarios can be used differently. Lets say, we have a model as Customer Which can be used to store customer sign-in inputs, but it can be also used for the customer sign-up purpose. In different scenarios, Yii2 model can be used in multiple business rules and logic.the email attribute may be required during customer sign-up, but not required customer sign-in. Yii2 model uses the y
2415
Views
 Yii2 - Get Current Action ID in main.php

Yii2 - Get Current Action ID in main.php

Yii2 web application project, sometimes we need to current controller ID, action ID. Specially when we need role based access control, we need to check the controller ID as well as action ID. Using Yii2 view context api we can get these data. for example if we need controller ID we can use below code $controller = $this->context->action->controller->id; if we need action ID only we can use as
1572
Views
jQuery text(), html(), and val() Usages

jQuery text(), html(), and val() Usages

In this blog post i will try to explain jQuery text(), html(), and val()  methods, there defination and uses. jQuery text(): From the matched element jQuery text() method get the text contents of the particular element or Sets or returns the text content of selected elements The following example demonstrates how to set content with the jQuery text() $("#btn1").click(function(){    $("#test
2762
Views
Yii2 pagination

Yii2 pagination

Today we will discuss how to implement pagination to any Yii2 web application. The pagination represents information relevant to pagination of data items fetch from any data sources. When we need data to be rendered in multiple pages,this can be used to display information such as total item count, page size, current page. Pagination implementation has two steps. Fetch data from data source
1462
Views
 How to create virtual column using MySQL SELECT?

How to create virtual column using MySQL SELECT?

Virtual column in MySQL is generated column, this column data or value comes from expression or function or other columns. The difference between virtual column and normal column is normal table column value saved to disk but virtual column value generated dynamically from any expression or function or from other columns. So the virtual column has following characteristics Virtual column is
1876
Views
Yii2 joinWith(), innerJoinWith(), join(), leftJoin()

Yii2 joinWith(), innerJoinWith(), join(), leftJoin()

Yii2 active record has powerful built-in feature to join database table. In this post we will learn some of the useful features joinWith() innerJoinWith(), join() leftJoin() join using query builder Example of joinWith(): $model = Users::find()                ->joinWith('posts', false, 'INNER JOIN')                ->all(); Example of innerJoinWith(): $mod
1437
Views
Yii2 GridView sorting and pagination using pajax

Yii2 GridView sorting and pagination using pajax

In this article we will learn how to use Pjax for Yii2 grid view sorting and pagination. Pjax is a jquery plugin which progressively enhances website page loads and behave more like single-page web application. We need to these steps to enable Pjax in yii2 web page Import yii\widgets\Pjax class Begin Pjax widget using Pjax::begin() Code block which needs to be rendered using Pjax Close Pja
992
Views
Yii2 Turning on Pretty URLs

Yii2 Turning on Pretty URLs

In this blog post i will discuss about Yii2's pretty URLs. Yii2 pretty URLs relies on mod_rewrite module on apache or httpd server. Without Yii2 pretty URLs if you click on any link for example About Us menu, the URL will be something like http://localhost/hello/web/index.php?r=site/about.  I'd like to change that to http://localhost/hello/web/site/about. The config subdirectory includes env
876
Views
Yii ajax form submit

Yii ajax form submit

In many cases we need to submit form using jQuery ajax. Yii has built-in support for this funtionality. In this blog post i will try to cover this topic. In the view form section at first we need to call form widget $form = $this->beginWidget('CActiveForm', array(    'id' => 'formId',    'enableAjaxValidation' => false,)); CActiveForm widget accepts multiple parameters, we will use two of
625
Views
jQuery ui date picker in Yii

jQuery ui date picker in Yii

In this blog post we will learn how to add jQuery UI date picker to Yii application. To display jQuery UI date picker in the view page we need to call Yii built-in function widget. This widget function accepts following parameters Widget Name Widget Options Widget options also accepts multiple parameters it depends on widget class like Model object Attribute Name Options htmlOption
611
Views
Yii load data into select box from database

Yii load data into select box from database

In this article we will learn how to load data into yii select box from database. We will follow below steps Create a function in model class Call that function to view page to get the data Lets say we have a table as pos_mac, now we will add a method named as getMacList() in POS_MAC model class. This method will load the all table data of pos_mac. Yii CHtml::listData function convert thi

Subscribe Us


Follow Us