PHP on T R A X
Rapid Application Development Made Easy

Reply to topic
can i have a controller and action without passing a id
jack_lkh


Joined: 13 Nov 2009
Posts: 9
Reply with quote
i was a beginner in trax, and i would like to know is threre any setting require to to a controller -> action, can be use without id

like
http://localhost/user/index
there will be a warning msg display(said id is not found)

but
http://localhost/user/index/1
is ok

thanks
View user's profileSend private message
johnpipi


Joined: 15 Dec 2005
Posts: 328
Reply with quote
in any controller if no action is specified it will look for by default the action called "index" so if you goto just: http://localhost/user it should load the index action automatically. You shouldn't need an id because that is just a param and doesn't have anything to do really with how it calls the action in the controller. It's more for if you want to load user 1 you or something like that where you are loading a model user id = 1... What is the warning message you are getting?
View user's profileSend private message
jack_lkh


Joined: 13 Nov 2009
Posts: 9
Reply with quote
if i have a page controller call user
and have a function call index

and i created a view

if i go to http://localhost/user
it will display
Notice: Undefined offset: 2 in /usr/share/pear/PHPonTrax/vendor/trax/action_controller.php on line 519

and if i go to http://localhost/user/index
it will still display the above error msg

is that i need to define route which do not contain /:id?

thanks =]
View user's profileSend private message
johnpipi


Joined: 15 Dec 2005
Posts: 328
Reply with quote
You can turn of Notices in your php.ini file.

Turn off Notices:

error_reporting = E_ALL & ~E_NOTICE

Then restart apache and it will not show that anymore its not really an error...
View user's profileSend private message
jack_lkh


Joined: 13 Nov 2009
Posts: 9
Reply with quote
Thanks ~=]
View user's profileSend private message
can i have a controller and action without passing a id
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 7 Hours  
Page 1 of 1  

  
  
 Reply to topic