Tuesday, May 7, 2019

YII2 Installation Steps

https://thishosting.rocks/install-php-on-ubuntu/

https://vegibit.com/how-to-install-the-advanced-template-in-yii2/

sudo a2dismod php7.0
sudo a2enmod php7.2
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.2
sudo service apache2 restart


composer global require "fxp/composer-asset-plugin:^1.2.0"

http://demos.krajee.com/grid-demo

use yii\web\IdentityInterface;


https://stackoverflow.com/questions/27742533/how-to-reset-to-default-colors-of-text-editor-in-netbeans
https://websiteforstudents.com/how-to-install-netbeans-on-ubuntu-16-04-17-10-18-04/


$query = ChallengeComment::find()
               ->alias('cm')
               ->select(['cm.*', 'user.vUserName', 'user.vProfilePic'])
               ->leftJoin('user_master user', 'user.iUserId = cm.iUserId')
               ->where(['cm.iChallengeId' => $iChallengeId]);

$totalCount = $query->count();
$query = $query->offset($offset)->limit($limit)->asArray()->all();



https://vegibit.com/how-to-install-the-advanced-template-in-yii2/


country :   return array(
            'states' => array(self::HAS_MANY, 'State', 'country_id'),
        );

state:  return array(
            'country' => array(self::BELONGS_TO, 'Country', 'country_id'),
        );

<?= $form->field($model, 'parent_id') ->dropDownList( ArrayHelper::map(Product::find()->asArray()->all(), 'parent_id', 'name') ) ?>
['prompt'=>'Select Option']

=============================================================================================================

https://stackoverflow.com/questions/26407888/yii-model-not-bulid-relation-automatically-using-gii
   'ipFilters'=>array('127.0.0.1','::1','192.168.3.71'),
country =
return array(
'testParents' => array(self::HAS_MANY, 'TestParent', 'id'),
);
parent
return array(
'id0' => array(self::BELONGS_TO, 'TestStudent', 'id'),
);
<?php echo $form->dropDownList($model,'item_type_id', CHtml::listData(ItemType::model()->findAll(), 'id', 'type'), array('empty'=>'select Type')); ?>
'Rel_User', [ 'attribute' => 'Rel_User', 'value' => function ($model) { return $model->relUser->getFullName(); }, ],
  [
               'attribute' => 'iCountryId',
               'value' => function($model) {
                   return $model->iCountry->vCountryName;
               }
           ],

==================================================================================================================

https://vegibit.com/how-to-install-the-advanced-template-in-yii2/
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
===================
Options -Indexes

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{REQUEST_URI} /(uploads)
RewriteRule ^uploads/(.*)$ uploads/$1 [L]

# End the processing, if a rewrite already occurred
RewriteRule ^(frontend|backend)/web/ - [L]

# Handle the case of backend, skip ([S=1]) the following rule, if current matched
RewriteRule ^backend(/(.*))?$ backend/web/$2 [NC,L]

# handle the case of frontend
RewriteRule .* frontend/web/$0

RewriteRule ^api(/(.*))?$ api/$3

</IfModule>

# Deny accessing below extensions
#<Files ~ "(.json|.lock|.git)">
#Order allow,deny
#Deny from all
#</Files>

# Deny accessing dot files
#RewriteRule (^\.|/\.) - [F]
======================
<?php
use \yii\web\Request;

$params = array_merge(
       require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'
);

return [
   'id' => 'app-frontend',
   'basePath' => dirname(__DIR__),
   'bootstrap' => ['log'],
   'controllerNamespace' => 'frontend\controllers',
   'components' => [
       'request' => [
           'csrfParam' => '_csrf-carco-frontend',
           'baseUrl' => str_replace('/frontend/web', '', (new Request)->getBaseUrl()),
       ],
       'user' => [
           'identityClass' => 'common\models\User',
           'enableAutoLogin' => true,
           'identityCookie' => ['name' => '_identity-trending-frontend', 'httpOnly' => true],
       ],
       'session' => [
           // this is the name of the session cookie used for login on the frontend
           'name' => 'advanced-trending-frontend',
       ],
       'log' => [
           'traceLevel' => YII_DEBUG ? 3 : 0,
           'targets' => [
               [
                   'class' => 'yii\log\FileTarget',
                   'levels' => ['error', 'warning'],
               ],
           ],
       ],
       'errorHandler' => [
           'errorAction' => 'site/error',
       ],
       'urlManager' => [
           'enablePrettyUrl' => true,
           'showScriptName' => false,
           //'enableStrictParsing' => true,
           'rules' => [
               '/' => 'site/index',
               'reset-password' => 'site/reset-password',
               'logout' => 'site/logout',
               '<controller:\w+>/<id:\d+>' => '<controller>/view',
               '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
               '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
           ],
       ],
   ],
   'params' => $params,
];
=================
sudo nano /etc/apache2/mods-enabled/dir.conf
sudo nano /etc/apache2/apache2.conf
==============================
<?php

$params = array_merge(
       require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'
);

use \yii\web\Request;

$baseUrl = str_replace('/backend/web', '/backend', (new Request)->getBaseUrl());
return [
   'id' => 'app-backend',
   'basePath' => dirname(__DIR__),
   'controllerNamespace' => 'backend\controllers',
   'bootstrap' => ['log'],
   'modules' => [
       'gridview' => [
           'class' => '\kartik\grid\Module'
       ]
   ],
   'components' => [
       'assetManager' => [
           'class' => 'yii\web\AssetManager',
           'forceCopy' => true,
       ],
       'request' => [
           'baseUrl' => $baseUrl,
       ],
       'user' => [
           'identityClass' => 'common\models\User',
           'enableAutoLogin' => true,
           //'authTimeout' => 172800, // 48 hour
           'identityCookie' => ['name' => '_identity-trending-backend', 'httpOnly' => true],
       ],
       'session' => [
// this is the name of the session cookie used for login on the backend
           'name' => 'trending-backend',
       //'savePath' => sys_get_temp_dir(),
       ],
       'log' => [
           'traceLevel' => YII_DEBUG ? 3 : 0,
           'targets' => [
               [
                   'class' => 'yii\log\FileTarget',
                   'levels' => ['error', 'warning'],
               ],
           ],
       ],
       'errorHandler' => [
           'errorAction' => 'site/error',
       ],
       'urlManager' => [
           'enablePrettyUrl' => true,
           'showScriptName' => false,
           //'enableStrictParsing' => true,
           'baseUrl' => $baseUrl,
           'rules' => [
               '/' => 'site/index',
               'logout' => 'site/logout',
               // users
               'users' => 'users/index',
               // tips
               'tips' => 'tips/index',
               'reports' => 'reports/index',
               'mails' => 'mail-content/create',
               'withdraw' => 'withdraw/index',
               '<controller:\w+>/<id:\d+>' => '<controller>/view',
               '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
               '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
           ],
       ],
   ],
   'params' => $params,
];
https://www.bluematador.com/blog/postman-how-to-install-on-ubuntu-1604

Thursday, March 5, 2015

Step to Configure Codeigniter Application

            Steps for configuring Codeigniter Project

step-1: First download source for codeigniter from here  Click Here or visit site,
            www.codeigniter.com.


step-2: extract codeigniter zip file in www folder rename default name with your
             project name.


step-3: Now open application folder from your project.
             here you find config folder.


             inside config folder find config.php file and open it.



step-4: change your application base_url  configuration in config file application/config.php.

            $config['base_url'] = '';


                                                   To

           $config['base_url'] = 'http://localhost/codeigniter/';
          //replace project name codeigniter with your project name


                                                     OR

              Run your project and then copy url from browser and paste in config.php file
             



Now you complete your codeigniter application configuration. Thanks for the visiting this blog.