[solve] hit halaman yii dengan cmd

halo master2…mau nanya ne gmn si cara hit halaman yii dengan CLI

nah saya coba di yii begini

C:\xampp\php>php.exe C:\xampp\htdocs\cbc\index.php

hasilnya keluar…

nah kalau mau hit misalnya yg di view doang…bisa ga si?

jadi kaya gini

C:\xampp\php>php.exe C:\xampp\htdocs\cbc\protected\views\site\http.php

class yii nya ga kebaca errornya…

mohon bantuanya…plzzz

setau ane gak bisa gan. Apapun itu harus diakses lewat index.php (namanya saja entry-script kalo diterjemah langsung skrip gerbang masuk).

saya mau coba cornJobs di yii…

contoh linknya:

My link

My link1

mau nanya dunk yiic tu apa si…cmn buat mengatur folder sama bikin CRUD n kawan2nya y?

jadi di Yii itu ada 2 mode controller

satu web controller dan satu lagi command controller

web controller itu yg ada di folder /protected/controllers dan diakses via browser

sementara

command controller itu yg ada di folder /protected/commands dan diakses via terminal/commandline

http://www.yiiframework.com/doc/guide/1.1/en/topics.console

kalo mau ngehit halaman web asi aplikasi tapi ngeeksekusinya via terminal/console coba pakai Curl

http://php.net/manual/en/book.curl.php

bikin command yg isinya ngejalanin curl buat ngehit sebuah URL yg dipengen

wah makasi om petra…saya coba baca dl curl ny…;D

halo mau nanya lg ne…kalau mau write file log pas console gmn si

saya da pasang


'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'logFile'=>'LOGFILE',

					'logPath'=>'C:/xampp/htdocs/cbc/',

					'levels'=>'error, warning , trace',

					

				),

				// uncomment the following to show log messages on web pages

				/*

				array(

					'class'=>'CWebLogRoute',

				),*/

				

			),

		),

tapi tidak jalan…padahal di tes di webApplication jalan…

maksudnya gak jalan itu gimana?

bisa diperjelas gak?

kan saya mau pas saya jalanin consolenya dy tulis file log…

pas saya jalanin di console dy ga error…tapi ga nulis log file nya…

ni halaman console.php





<?php


// change the following paths if necessary

$yii=dirname(__FILE__).'/../../../yii/framework/yii.php';

$config=dirname(__FILE__).'/protected/config/console.php';


// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG',TRUE);

// specify how many levels of call stack should be shown in each log message

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);


require_once($yii);

Yii::createConsoleApplication($config)->run();






command/DemooCommand.php




<?php

class DemooCommand extends CConsoleCommand {


	public function run($args)

	{

$connection = Yii::app()->db;

	$sql="select * from tbl_batch where jobs_id = groar ";

	$command = $connection->createCommand($sql)->queryAll();

}

}



config/console.php





<?php


// This is the configuration for yiic console application.

// Any writable CConsoleApplication properties can be configured here.

return array(

	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'My Console Application',

	'params'=>array(

    	'testparam'=>'testvalue',

	),

'import'=>array(

		'application.models.*',

		'application.components.*',

		'application.modules.user.models.*',

    	'application.modules.user.components.*',

		'application.modules.rights.models.*',

    	'application.modules.rights.components.*',

		'application.extensions.*',

		//'application.extensions.menu.*',

		//'application.extensions.menu.resources.*',

		

		//'application.modules.Classes.*',  

		//'application.modules.Classes.PHPExcel.*', 

		

	),


	'modules'=>array(

		// uncomment the following to enable the Gii tool

		'rights'=>array(

			'install'=>true,

			'superuserName'=>'Admin',

		

		'authenticatedName'=>'Authenticated',

		'userClass'=>'Users',//class tablenya

		'userIdColumn'=>'id',

		'userNameColumn'=>'username',

			),

		'user',

		'gii'=>array(

			'class'=>'system.gii.GiiModule',

			'password'=>'superdodo',

     		// If removed, Gii defaults to localhost only. Edit carefully to taste.

			'ipFilters'=>array('127.0.0.1','::1'),

		),

		

	),





	// application components

	'components'=>array(

			

			

            	'user'=>array(

                    	'class'=>'RWebUser',					

                    	'allowAutoLogin'=>true,

                    	'loginUrl' => array('/user/login'),

            	),

            	'authManager'=>array(

				'class'=>'RDbAuthManager',

				'connectionID'=>'db',

				),

		// uncomment the following to enable URLs in path-format

		/*

		'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

			),

		),

		

		'db'=>array(

			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',

		),*/

		// uncomment the following to use a MySQL database

		

		'db'=>array(

			'connectionString' => 'mysql:host=localhost;dbname=cbc',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => '',

			'charset' => 'utf8',

			'tablePrefix' => 'tbl_',

		),

		

		'errorHandler'=>array(

			// use 'site/error' action to display errors

        	'errorAction'=>'site/error',

    	),

		'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'logFile'=>'LOGFILE',

					'logPath'=>'C:/xampp/htdocs/cbc/',

					'levels'=>'error, warning , trace',

					

				),

				// uncomment the following to show log messages on web pages

				/*

				array(

					'class'=>'CWebLogRoute',

				),*/

				

			),

		),

	),

);




saya jalaninya

apa ada yang saya salah tulis??<_<

kalo mau nulis Log kayaknya harus pake Yii::log() deh

da bisa…tinggal update seri ke 1.8 n pindah komp…komp yg dulu ga tau knp ga bisa2…wkwkwk…

tq y gan petra