File not found error

Hi,

I currently come across a common error but yet i can’t find the source of problem. In my controller, i actually redirect the smsbroadcast/create page to smsbroadcast/create2&p=<encrypted value> but i got this error. By right it only says the redirect page don’t exists but i have the layout,page correctly. can anyone advise?

error:




PHP Error

Description


include(Campaign.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

Source File


C:\Users\Jack Sng\Desktop\apache_server\yii\framework\YiiBase.php(337)


00325:      * @param string class name

00326:      * @return boolean whether the class has been loaded successfully

00327:      */

00328:     public static function autoload($className)

00329:     {

00330:         // use include so that the error PHP file may appear

00331:         if(isset(self::$_coreClasses[$className]))

00332:             include(YII_PATH.self::$_coreClasses[$className]);

00333:         else if(isset(self::$_classes[$className]))

00334:             include(self::$_classes[$className]);

00335:         else

00336:         {

00337: include($className.'.php');

00338:             return class_exists($className,false) || interface_exists($className,false);

00339:         }

00340:         return true;

00341:     }

00342: 

00343:     /**

00344:      * Writes a trace message.

00345:      * This method will only log a message when the application is in debug mode.

00346:      * @param string message to be logged

00347:      * @param string category of the message

00348:      * @see log

00349:      */


Stack Trace


#0 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\YiiBase.php(337): autoload()

#1 unknown(0): autoload()

#2 C:\Users\Jack Sng\Desktop\apache_server\gblast3\protected\controllers\SmsBroadcastController.php(79): spl_autoload_call()

#3 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\actions\CInlineAction.php(32): SmsBroadcastController->actionCreate2()

#4 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\CController.php(300): CInlineAction->run()

#5 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\filters\CFilterChain.php(129): SmsBroadcastController->runAction()

#6 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\filters\CFilter.php(41): CFilterChain->run()

#7 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\CController.php(957): CAccessControlFilter->filter()

#8 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\filters\CInlineFilter.php(59): SmsBroadcastController->filterAccessControl()

#9 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\filters\CFilterChain.php(126): CInlineFilter->filter()

#10 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\CController.php(283): CFilterChain->run()

#11 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\CController.php(257): SmsBroadcastController->runActionWithFilters()

#12 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\CWebApplication.php(310): SmsBroadcastController->run()

#13 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\web\CWebApplication.php(120): CWebApplication->runController()

#14 C:\Users\Jack Sng\Desktop\apache_server\yii\framework\base\CApplication.php(135): CWebApplication->processRequest()

#15 C:\Users\Jack Sng\Desktop\apache_server\gblast3\index.php(11): CWebApplication->run()



Controller:




<?php


class SmsBroadcastController extends CController

{

  public $layout='campaign';

  protected $category_limit=50;	// number of category display

  protected $contact_limit=50;	// number of contact display

	

  // all filters

  public function filters()

  {

    return array(

       'accessControl',

    );

  }

	

  // access control

  public function accessRules()

  {

    return array(

       array(

	'deny',

	'users'=>array('?'),

       ),

       array(

        'allow',

        'users'=>array('@'),

       ),

   );

 }


  /* ===== SMS BROADCAST CREATION SECTION ===== */

  // campaign sms broadcast create, step 1

  public function actionCreate()

  {

    $form=new SMSBroadcastForm();

    $campaign=new SmsCampaign();

		

    if(isset($_GET['p']))

    {

      $form->id=$_GET['p'];

      $campaign=Campaign::model()->findByPk($form->getId());

      $form->set(1,$campaign);

    }

    else

      $form->optout=$form->getMyOptoutKeyword();


    if(isset($_POST['SMSBroadcastForm']))

    {

      $form->attributes=$_POST['SMSBroadcastForm'];

			

      if($form->validate('create1'))

      {

        if($form->run(1,$campaign))

           $this->redirect(array('create2','p'=>$form->id));

      }

    }

		

    $this->render('create',array(

       'form'=>$form,

       'templates'=>Template::model()->published()->with('user_owned')->findAll(),

    ));

  }


  // campaign sms broadcast create, step 2

  public function actionCreate2()

  {

    $form=new SMSBroadcastForm();

		

    if(isset($_GET['p']))

    {

      $form->id=$_GET['p'];

      $campaign=Campaign::model()->findByPk($form->getId());

      $form->set(1,$campaign);

    }

   //else

      //$this->redirect(array('create'));

		

   if(isset($_POST['SMSBroadcastForm']))

   {

     $form->attributes=$_POST['SMSBroadcastForm'];

			

     if(!$form->validate('create1'))

        $this->redirect(array('create'));

     else if($form->validate('create2'))

     {

        if($form->run(2,$campaign))

	   $this->redirect(array('create3','p'=>$form->id));

     }

   }

		

   $this->render('create2',array(

      'form'=>$form,

      'categories'=>$this->getCategoryRecords('mobile'),

      'category_page'=>$this->getCategoryPagination('mobile'),

      'contacts'=>$this->getContactRecords('mobile'),

      'contact_page'=>$this->getContactPagination('mobile'),

   ));

  }



model:




<?php


class SMSBroadcastForm extends CFormModel

{

	// registered fields

	public $id;

	public $name;

	public $optout;

	public $numbermask;

	public $content;

	public $receivers;

	public $duplicate;

	public $date;

	public $time;

	

	// return original id

	protected function getId()

	{

		$security=Yii::app()->getSecurityManager();

		$bin=$this->hex2bin($this->id);

		return $security->decrypt($bin);

	}

	

	// hexidecimal to binary string

	private function hex2bin($str) 

	{

		$bin='';

		$i=0;

		

		do 

		{

			$bin.=chr(hexdec($str{$i}.$str{($i + 1)}));

			$i+=2;

		}

		while($i<strlen($str));

		return $bin;

	}



But have you placed model file

Campaign.php

in right place ?

campaign.php is not a model file. it is a layout file and in a right place :) . because i tested without GET params, the page actually appears.