Jump to content
Larry Ullman's Book Forums

snapper

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by snapper

  1. Here is line 218: public function actionRedirectSomewhere($itemId) {$this->redirect(array('items/index'));}

     

    It's the function call with the redirect statement. You were right. I was getting this error because I omitted the closing php tag at the end of the ItemsController. I was told I should do that  (omitting closing php tags) but did not understand when, why and where I should omit this ?> if at all.

  2. When a user clicks a button in my application, it is supposed to reroute them to a certain page in my application, but instead I get the following error message: 

     

    Cannot modify header information - headers already sent by (output started at /home/colly/public_html/myapp/ItemsController.php:218)

     

    and here is the function inside of the itemsController that generates the error:

    public function actionRedirectSomewhere($itemId) {$this->redirect(array('items/index'));}

     

    It still gives me the same error if I call the function without the parameter like this: 

    actionRedirectSomewhere() {$this->redirect(array('items/index'));}

     

    I am not aware of any headers that I am sending.

     

    How can I fix this error?

    Any help would be appreciated.

     

    //snapper

  3. Thanks, that answered my question. Just out of curiosity, why wouldn't I want to be that generic with my parameter names. With some other frameworks, I could just write a function with parameters without any change to a config file and they work. Why would you recommend not having that feature here?

  4. When I create this method actionTest($parameter){

                                                                print($parameter);

                                                                }

    inside of a controller and attempt to access it in the browser I get an error 400.

     

    How can I set up yii so that if I enter:

    /controller/test/text  it would simply print the string 'text' on the screen instead of returning an invalid request error?

     

    I already verified that the URL is correct. If I write actionTest(){  print('text'); } and then go to /controller/test/text then it works just fine. 

     

    How can I set up yii so that a controller action can accept parameter values in the URL?
×
×
  • Create New...