[symfony-users] Re: Timing for Registering Routes in sf1.0
Hi Eno, Symfony would differentiate those routes because they have a unique URL without wildcards. The literal route definition would be url: /category1 param: { module: categories, action: show, id: 1 } The issue with having category in the url is that this is not some ecommerce website with countless categories. I am talking about 3 categories, so for visitors to the site, typing website.com/category1 is much more concise. Believe me, I do use /category/product wherever I find it appropriate, but in this case it is simply not. I'm no expert on SEO, so I'm always looking to learn. Can you explain why having "category" in the url helps my SEO score for the term? Everything else constant, I would assume that a site somesite.com/ butterflies ranks better than somesite.com/animals/bugs/butterflies. I know that search engines like structure, but when, like in my case, you have only 3 categories, I doubt it would be considered structured. Thank you for your help. Daniel On Jun 19, 2:34 pm, Eno wrote: > On Fri, 19 Jun 2009, Richtermeister wrote: > > The first > > version is not interesting from an "aesthetics" standpoint - I don't > > want those urls to start with /categories. > > So how would symfony differentiate the URLs with non-category URLs? > > I think /category/:name is actually clearer to the user that its a > category page and its better from an SEO standpoint. > > -- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Timing for Registering Routes in sf1.0
On Fri, 19 Jun 2009, Richtermeister wrote: > The first > version is not interesting from an "aesthetics" standpoint - I don't > want those urls to start with /categories. So how would symfony differentiate the URLs with non-category URLs? I think /category/:name is actually clearer to the user that its a category page and its better from an SEO standpoint. -- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Timing for Registering Routes in sf1.0
Hi Guys, Thank you for the feedback, I appreciate it. I'm am indeed familiar with both solutions, however, I was looking to avoid doing things that way, for the obvious reasons that you have pointed out. The first version is not interesting from an "aesthetics" standpoint - I don't want those urls to start with /categories. As for the /:name rule, it feels backwards to me to have to define "every other action" I may be using. I'd rather define those 2 or 3 rules that I need (very few categories) and leave the regular symfony routing alone. I've successfully used this approach on other sites, but I've never had to access the database before. Otherwise I would add the routes from a plugin config file, but those don't have access to propel just yet. Thank you for your help. Daniel On Jun 19, 12:46 pm, Campezzi wrote: > Hi Daniel, > > What Jacob said is true - you should use variables instead of adding > each route manually. However, you're not limited to using the / > categories/:name format; you can simply add a rule like /:name and > have the url layout you want. You just need to worry about 2 things: > > 1. this rule will match every url like domain.com/directory. that > means that if you want to use the same url structure for things that > are not categories, you should create specific rules for them BEFORE > the general category rule on routing.yml. for example, let's say you > want to have domain.com/contact where "contact" is not a category > name; in that case, you would first add a rule matching simply / > contact, pointing to the module/action responsible for that page, and > later in routing.yml your /:name rule pointing to some other module/ > action that you use to handle categories. > > 2. as a side effect of point #1, you won't be able to create a > category with a name used on a specific rule. so using the same > example, if you want to create a category named "contact", you will > never be able to reach it since symfony will match the specific / > contact rule and stop reading the routing file at that point. In other > words, you're creating possible url conflicts, and to avoid that > you'll have to code some sort of "reserved keywords" system in the > category creation part. > > Hope that helped clear up things a bit! > > Regards, > Thiago Campezzi > > On Jun 19, 3:00 pm, Richtermeister wrote: > > > Hi all, > > > there's one thing I'm always struggling with, and that is registering > > new routes dynamically in sf 1.0. > > For example, my current site has product categories, and I would like > > to add a new route for each category so that I get urls like > > > /category1 > > /category2 > > etc. > > > I know I can just do > > /categories/category1 > > /categories/category2 > > > but for something this central to the site I would like to use the > > first solution. > > Now, in sf1.0 it seems the best time to add these routes would be the > > config.php file in the current app directory, but if I add the routes > > after the call to sfCore::bootstrap(), the current route will already > > be determined (disregarding my routed). If I try to add the routes > > before the call, symfony has not been initialized enough to understand > > the command. > > > How should I go about adding those routes? Please keep in mind that I > > need to use the ORM as well, in order to get a list of the current > > categories.. > > > Thanks for your help, > > and have a great day. > > > Daniel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Timing for Registering Routes in sf1.0
Hi Daniel, What Jacob said is true - you should use variables instead of adding each route manually. However, you're not limited to using the / categories/:name format; you can simply add a rule like /:name and have the url layout you want. You just need to worry about 2 things: 1. this rule will match every url like domain.com/directory. that means that if you want to use the same url structure for things that are not categories, you should create specific rules for them BEFORE the general category rule on routing.yml. for example, let's say you want to have domain.com/contact where "contact" is not a category name; in that case, you would first add a rule matching simply / contact, pointing to the module/action responsible for that page, and later in routing.yml your /:name rule pointing to some other module/ action that you use to handle categories. 2. as a side effect of point #1, you won't be able to create a category with a name used on a specific rule. so using the same example, if you want to create a category named "contact", you will never be able to reach it since symfony will match the specific / contact rule and stop reading the routing file at that point. In other words, you're creating possible url conflicts, and to avoid that you'll have to code some sort of "reserved keywords" system in the category creation part. Hope that helped clear up things a bit! Regards, Thiago Campezzi On Jun 19, 3:00 pm, Richtermeister wrote: > Hi all, > > there's one thing I'm always struggling with, and that is registering > new routes dynamically in sf 1.0. > For example, my current site has product categories, and I would like > to add a new route for each category so that I get urls like > > /category1 > /category2 > etc. > > I know I can just do > /categories/category1 > /categories/category2 > > but for something this central to the site I would like to use the > first solution. > Now, in sf1.0 it seems the best time to add these routes would be the > config.php file in the current app directory, but if I add the routes > after the call to sfCore::bootstrap(), the current route will already > be determined (disregarding my routed). If I try to add the routes > before the call, symfony has not been initialized enough to understand > the command. > > How should I go about adding those routes? Please keep in mind that I > need to use the ORM as well, in order to get a list of the current > categories.. > > Thanks for your help, > and have a great day. > > Daniel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Timing for Registering Routes in sf1.0
I think you're approaching routing the wrong way. You should need to only register one route: /categories/:name and then in your categories controller attempt to find the category by name or forward404() if the category is not found. On Jun 19, 2009, at 2:00 PM, Richtermeister wrote: > > Hi all, > > there's one thing I'm always struggling with, and that is registering > new routes dynamically in sf 1.0. > For example, my current site has product categories, and I would like > to add a new route for each category so that I get urls like > > /category1 > /category2 > etc. > > I know I can just do > /categories/category1 > /categories/category2 > > but for something this central to the site I would like to use the > first solution. > Now, in sf1.0 it seems the best time to add these routes would be the > config.php file in the current app directory, but if I add the routes > after the call to sfCore::bootstrap(), the current route will already > be determined (disregarding my routed). If I try to add the routes > before the call, symfony has not been initialized enough to understand > the command. > > How should I go about adding those routes? Please keep in mind that I > need to use the ORM as well, in order to get a list of the current > categories.. > > Thanks for your help, > and have a great day. > > Daniel > > > -- Jacob Coby --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---