/schedule/links/related/edit

etc.

Think of resources, and their hierarchy.

/users
/users/123456
/users/123456/gallery

/products
/products/latest
/products/latest?page=2 (yes, that's a "correct" URL in the sense of HTTP, not /products/latest/2, but that's a matter of taste).

/products/list <- a resource
/products/list?sort=date&order=desc&page=2 <- same resource, but a different view on it

if you follow CRUD-style route schemes, you could even easily re-use them across routes

<route name="products" pattern="^/products" module="Products">
  <route name=".index" pattern="^$" action="Index" />
  <route name=".add" pattern="^/add$" action="Add" />
  <route name=".product" pattern="/(id:\d+)" action="Product">
    <route name=".view" pattern="^$" action=".View" />
    <route name=".edit" pattern="^/edit$" action=".Edit" />
    <route name=".delete" pattern="^/delete$" action=".Delete" />
  </route>
</route>

"Product" is merely a sub-action parent. It is only a folder and has sub-actions itself.

Note how logical and structured the URLs become. "products.product.edit" etc. It's very, very simple.

But as I said, that stuff is all in the generated routing.xml and in the sample app.

- David


On 08.03.2009, at 10:23, Michal Charemza wrote:

Thanks! The "." thing will come in quite handy. However, can I ask for
you to explain about the logical structure...? In total I have:

/
/schedule/
/events/
/news/
/photos/
/contact/

With each of using a separate route and routing to a different action.

Then I have

/schedule/editrelated/
/events/editrelated/
/news/editrelated/

For users (with the correct permissions) to edit the related links
that appear. This seems quite logical to me... is it not? One thing is
that the 'editrelated' routes are repeated for the schedule/events/
news: almost just copied/pasted between them. I this what you you
mean? How can this be avoided?

Michal.



On 7 Mar 2009, at 23:16, David Zülke wrote:

You really should create a logical structure for your URLs. They're
way easier to maintain and implement this way. Look at the sample
app (or at the example "agavi project" creates for you). Also mind
the ability to concatenate nested route names by starting the name
with ".", and nesting Actions (also with ".", and also demo-ed in
the Sample App).



On 07.03.2009, at 20:58, Michal Charemza wrote:

Thanks, that worked a treat!

On 7 Mar 2009, at 19:50, Veikko Mäkinen wrote:

Michal Charemza wrote:


<route pattern="^/schedule/" module="Schedule"
action="ShowSchedule"
name="Schedule">
        <route pattern="^editlinks/$" module="Related"
action="EditRelated"
name="EditRelatedSchedule" />
</route>

I've tried various combination of "^" and "$" in the patterns but
I've
not managed to force paths like:

/schedule/gibberish

to result in a 404 error. How can I force a 404 error in these
sorts
of cases?


The problem here is the parent route matches /schedule/ anything_here
AND
selects an action. Move the action to a child route and you should
be fine.

<route pattern="^/schedule" module="Schedule" name="Schedule">
<route pattern="^$" action="ShowSchedule" />
<route pattern="^editlinks/$" ... />
</route>


--
Veikko Mäkinen
[email protected]
044 5910 413
http://blog.veikko.fi


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to