Yii Framework Forum: $This->Redirect Stop Working - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

$This->Redirect Stop Working Change server and no redirect anymore. Rate Topic: -----

#1 User is offline   Led 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 16-January 12

Posted 01 February 2013 - 03:01 PM

Ok. Localhost it works, shared host windows plan it works.

After change to a linux plan, $this->redirect stop working

$this->redirect(array('reserva/view/', 'id' => $idreserva, 'fromP' => '1'));

0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,670
  • Joined: 04-March 10
  • Location:UK

Posted 01 February 2013 - 04:06 PM

If it works on Windows and not Linux, the first thing to check is capitalisation of your file names. Make sure that your class files follow the expected capitalisation rules.

Are you getting an error?
0

#3 User is offline   Led 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 16-January 12

Posted 01 February 2013 - 04:13 PM

View PostKeith, on 01 February 2013 - 04:06 PM, said:

If it works on Windows and not Linux, the first thing to check is capitalisation of your file names. Make sure that your class files follow the expected capitalisation rules.

Are you getting an error?


Nop. Just a blank screen on the action where the redirect is

thanks in advance.
But really stucked.

It works on my ubuntu lamp, on windows xamp and windows host.Strange.
0

#4 User is offline   Led 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 16-January 12

Posted 01 February 2013 - 04:18 PM

View PostLed, on 01 February 2013 - 04:13 PM, said:

Nop. Just a blank screen on the action where the redirect is

thanks in advance.
But really stucked.

It works on my ubuntu lamp, on windows xamp and windows host.Strange.



if (isset($idreserva)) {
            
            $this->redirect(array('reserva/view/', 'id' => $idreserva, 'fromP' => '1',));
        } else {
            $this->redirect(array('casa/update', 'id' => $cod_casa, 'fromP' => '1',));
        }


but this code in another controller works

                $this->redirect(Yii::app()->createUrl('casa/update', array('cod_casa' => $model->cod_casa, 'id' => $model->cod_casa, 'referer' => 'periodo')));

0

#5 User is offline   Led 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 16-January 12

Posted 01 February 2013 - 04:19 PM

View PostLed, on 01 February 2013 - 04:18 PM, said:

if (isset($idreserva)) {
            
            $this->redirect(array('reserva/view/', 'id' => $idreserva, 'fromP' => '1',));
        } else {
            $this->redirect(array('casa/update', 'id' => $cod_casa, 'fromP' => '1',));
        }


but this code in another controller works

                $this->redirect(Yii::app()->createUrl('casa/update', array('cod_casa' => $model->cod_casa, 'id' => $model->cod_casa, 'referer' => 'periodo')));



yep see the diference? Yes but it works on xamp and local ubuntu.

                $this->redirect(array('pwdrecoverconfirm', 'id' => $model->propid, 'st' => $model->sessid));


and this also works. fck
0

#6 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,670
  • Joined: 04-March 10
  • Location:UK

Posted 01 February 2013 - 04:36 PM

Is the extra forward slash after "view" causing a problem?
0

#7 User is offline   Led 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 16-January 12

Posted 01 February 2013 - 04:40 PM

View PostKeith, on 01 February 2013 - 04:36 PM, said:

Is the extra forward slash after "view" causing a problem?



no.still the same
0

#8 User is offline   Led 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 16-January 12

Posted 01 February 2013 - 04:46 PM

View PostKeith, on 01 February 2013 - 04:36 PM, said:

Is the extra forward slash after "view" causing a problem?


trying to redirect to another action in same controller , another blank screen

public function actionCreate() {

        $Pagamento = new ReservaPayment();
        $Reserva = new Reserva();
        $model = new Preco('create');
        $this->actionValida();
        $uid = Yii::app()->user->name == ("admin") ? " >=1" : "=" . Yii::app()->user->id;
        $cod_casa = Yii::app()->getRequest()->getQuery('cod_casa');

        $this->actionCalendar($cod_casa, 0);
        // $this->performAjaxValidation($model);

        if (isset($_POST['Preco'])) {

            $model->attributes = $_POST['Preco'];

            if ($model->save()) {

                Yii::app()->user->setFlash('success', 'Ok com disponibilidade!', true);
                $id = Yii::app()->db->lastInsertID;

                if (isset($_POST['Reserva'])) {

                    $Reserva->attributes = $_POST['Reserva'];
                    $Reserva->valor=$_POST['Preco']['preco'];
                    $Reserva->user = $_POST['Reserva']['user'];
                    $Reserva->idpreco = $id;
                    $Reserva->reserva_state = $_POST['Reserva']['reserva_state'];

                    if ($Reserva->save()) {

                        $idreserva = Yii::app()->db->lastInsertID;
                       
                        $Reserva->checkOutdated($id);

                        $Reserva->sendMails($idreserva,NULL);
     
                    } else {
                        Yii::app()->user->setFlash('error', 'Erro com Reserva!', true);
                    }
                }
                if (isset($_POST['ReservaPayment'])) {


                    $Pagamento->attributes = $_POST['ReservaPayment'];
                    if (isset($idreserva)) {
                        $Pagamento->idreserva = $idreserva;
                    }
                    $Pagamento->idpreco = $id;

                    if ($Pagamento->save()) {
                        Yii::app()->user->setFlash('success', 'Ok com Periodo Reserva Pagamento !', true);
                    } else {
                        Yii::app()->user->setFlash('error', 'Pagamento não introduzido !', true);
                    }
                }
            }
        } else {

            Yii::app()->user->setFlash('error', 'Erro com Periodo Reserva e pagamento! Confira as datas em conflito', true);
        }
        if (isset($idreserva)) {
            
            $this->redirect('reserva/view/', array('id' => $idreserva, 'fromP' => '1',));
        } else {
            $this->redirect('casa/update', array('id' => $cod_casa, 'fromP' => '1',));
        }
    }


works in other environments.Any ideas what happen?
Host php version, i think
0

#9 User is offline   Rajith R 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 884
  • Joined: 20-April 11
  • Location:India

Posted 04 February 2013 - 12:22 AM

blank screen in which action? what is the url?
Rajith Ramachandran,
Wiwo inc.
| Mobile: 919995504508
0

#10 User is offline   Rajith R 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 884
  • Joined: 20-April 11
  • Location:India

Posted 08 July 2014 - 01:58 AM

You can remove the UTF-8 BOM from the output using the ob_start function. This way you can leave the UTF-8 BOM in your source files so your editor understands it is really UTF-8.

In the /protected/config/main.php you have to add before returning the config array:
ob_start('My_OB');
function My_OB($str, $flags)
{
    //remove UTF-8 BOM
    $str = preg_replace("/\xef\xbb\xbf/","",$str);
    
    return $str;
}
return array( ... yii config array ...);



P.S. You don't have to call ob_end_flush(), php will do this automatically at the end of the script.
Rajith Ramachandran,
Wiwo inc.
| Mobile: 919995504508
0

#11 User is offline   Louis Gac 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 44
  • Joined: 13-June 14

Posted 08 July 2014 - 04:11 AM

BOM problems... Working on Windows is always a very bad idea... I didn't use Windows since almost 8 years, and I really don't understand how PHP developpers can stay on Windows ? 99% of web servers are Linux based, so, using Linux everyday and learning bash scripting is a good practice.
 
 
Blank pages can also be some PHP errors. In general, on Linux, you'll find them on /var/log/apache2/error.log.Wich Linux are you using ?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users