Zend and default indexAction()

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Zend and default indexAction()

Post by alex.barylski »

I have a custom routing table setup but I still also have indexAciton() methods.

Do I need them or can I drop them? None of my routes (that I know of) point to that function

Ideally all my actions are well named and fit a specific purpose so I would prefer to drop it outright. Problems?

EDIT | In addition to the above assume I have a controller:action like...

Code: Select all

MyCustomObject::updateProfileAction()
Using a custom routing table can I drop the 'Action' part of the method?

Given a XML route like:

Code: Select all

  <example>    <route>/:title/:page</route>    <defaults>      <controller>custom-object</controller>      <action>update-profile-action</action>    </defaults>  </example> 
Would the above be accurate? Or would I use the actual class name and method -- which would make more sense anyways.

Cheers,
Alex
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Zend and default indexAction()

Post by alex.barylski »

Bump! I'm starting to think this was the wrong forum to post a question in :P
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Zend and default indexAction()

Post by John Cartwright »

PCSpectra wrote:Bump! I'm starting to think this was the wrong forum to post a question in :P
Your right :).

Moved to PHP - Theory and Design.

P.S., please wait at least 24 hours before bumping.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Zend and default indexAction()

Post by Eran »

I'm not really sure what the question is.. if you don't have links that reach the index action, you don't need it, it's just a convenient default

I'm not really familiar with the XML syntax for routes, but using arrays you just put the names of the controller / action so I imagine it's the same? you just have to test and see for yourself.

As a side note, Zend recommends having the action name in lowercase. If you want camelCase actions, you will need to seperate those with a '-' or a '.' in the URL. Read the case naming conventions on this page - http://framework.zend.com/manual/en/zen ... asics.html
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Zend and default indexAction()

Post by alex.barylski »

you want camelCase actions, you will need to seperate those with a '-' or a '.' in the URL. Read the case naming conventions on this page
I figured that out eventually...
Post Reply