Re: [WebDNA] Pretty URLS
This WebDNA talk-list message is from 2011
It keeps the original formatting.
numero = 106580
interpreted = N
texte = My method on a site that has thousands of products available was to =support URL's like this one:www.example.com/item_1234_product_name_here.htmlIn the WebCatalogEngine/ErrorMessages.db file, I have this:TemplateNotFound[include ^error/gTemplateNotFound.incl]That include file is generic and supports multiple virtual hosts on the =same server. It finds that the host is "example.com" and includes a =host-specific include file:[include ^example_com/error/TemplateNotFound.incl]The host-specific include file finds that [thisurl] begins with "item_" =and includes, rather than redirects to, the "item_.html" page thusly:[include /item_.html]The item_.html page parses [thisurl], grabbing the "1234" and ignoring =the rest:[text]tSKU=3D[listwords words=3D[ulr][thisurl][/url]&delimiters=3D_][showi=f [index]=3D2][word][/showif][/listwords][/text]It then uses tSKU to lookup specifics of the product and builds the =product page, including any dynamic content such as current logged in =user, shopping cart status, and an add-to-cart form.Note that this current implementation is dependent on the Globals folder =and will have to be modified if and when I move to WebDNA 7, but that =will be pretty easy, basically skipping the step where the generic error =include file is used.- Brian FriesOn Apr 27, 2011, at 7:58 AM, Brian B. Burton wrote:> What I think I'd like to do is tie into the page not found system,=20> i.e. have the server send my 404 request to instead of error.html to =URLs.tpl>=20> that way all pages act as they do currently BUT> for any "pretty" URL, it gets "not found" and rerouted to URLs.tpl>=20> and inside that file i want to do something like: (yes this is 100% =wrong, just typing outloud here)> [showif [url][thispage][/url]=3D[grep]('notebook_battery/$')[/grep]] = [include file=3Dalphamfg.tpl&_CID=3D2][/showif]> [showif =[url][thispage][/url]=3D[grep]('('notebook_battery/(?P
\w+)/$')[/grep]=] [include file=3Dpickmodel&_CID=3D2&_MFG=3D[MFG]][/showif]> [showif =[url][thispage][/url]=3D[grep]('('notebook_battery/(?P[^/]+)/(?P=\d+).*')[/grep]] [include =file=3Dmodelinfo&_CID=3D2&_MFG=3D[MFG]&_FID=3D[FID]][/showif]>=20> (and have a last rule that actually redirects to a 404 page...)>=20> I want to figure out how to use an include so that i'm specifically =not rewriting and redirecting the URL (thus making it ugly)>=20> Anyone currently doing anything like this?> If I can figure out how to do it, is anyone else interested in the =code?>=20>=20>=20>=20> Brian B. Burton> brian@burtons.com>=20> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> time is precious. waste it wisely> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>=20>=20>=20> On Apr 27, 2011, at 6:22 AM, William DeVaul wrote:>=20>> On Tue, Apr 26, 2011 at 11:38 PM, Kenneth Grome =wrote:>>>> I'm not sure why you'd leave the humans ugly URLs.>>>=20>>> Because those URLs are the default URLs for WebDNA.>>=20>> I thought the parameterized URLs were a convention that came about in>> the early days of the Internet. Seems the convention is ripe for>> change.>>=20>> In general, I'm for programmer convenience versus optimization for =the>> computer. But I'd put user convenience above the programmer's. In>> some frameworks the default is "prettier" to the benefit of users and>> programmers.>>=20>>>> The search engines like keywords.>>>=20>>> They get plenty of keywords in the static pages.>>=20>> I think it is about quality of the keyword placement (in incoming>> links, in the domain, in the URLs, in "important" tags e.g. ).>=20>=20> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> Bug Reporting: support@webdna.us>=20
Associated Messages, from the most recent to the oldest:
My method on a site that has thousands of products available was to =support URL's like this one:www.example.com/item_1234_product_name_here.htmlIn the WebCatalogEngine/ErrorMessages.db file, I have this:TemplateNotFound[include ^error/gTemplateNotFound.incl]That include file is generic and supports multiple virtual hosts on the =same server. It finds that the host is "example.com" and includes a =host-specific include file:[include ^example_com/error/TemplateNotFound.incl]The host-specific include file finds that [thisurl] begins with "item_" =and includes, rather than redirects to, the "item_.html" page thusly:[include /item_.html]The item_.html page parses [thisurl], grabbing the "1234" and ignoring =the rest:[text]tSKU=3D[listwords words=3D[ulr][thisurl][/url]&delimiters=3D_][showi=f [index]=3D2][word][/showif][/listwords][/text]It then uses tSKU to lookup specifics of the product and builds the =product page, including any dynamic content such as current logged in =user, shopping cart status, and an add-to-cart form.Note that this current implementation is dependent on the Globals folder =and will have to be modified if and when I move to WebDNA 7, but that =will be pretty easy, basically skipping the step where the generic error =include file is used.- Brian FriesOn Apr 27, 2011, at 7:58 AM, Brian B. Burton wrote:> What I think I'd like to do is tie into the page not found system,=20> i.e. have the server send my 404 request to instead of error.html to =URLs.tpl>=20> that way all pages act as they do currently BUT> for any "pretty" URL, it gets "not found" and rerouted to URLs.tpl>=20> and inside that file i want to do something like: (yes this is 100% =wrong, just typing outloud here)> [showif [url][thispage][/url]=3D[grep]('notebook_battery/$')[/grep]] = [include file=3Dalphamfg.tpl&_CID=3D2][/showif]> [showif =[url][thispage][/url]=3D[grep]('('notebook_battery/(?P\w+)/$')[/grep]=] [include file=3Dpickmodel&_CID=3D2&_MFG=3D[MFG]][/showif]> [showif =[url][thispage][/url]=3D[grep]('('notebook_battery/(?P[^/]+)/(?P=\d+).*')[/grep]] [include =file=3Dmodelinfo&_CID=3D2&_MFG=3D[MFG]&_FID=3D[FID]][/showif]>=20> (and have a last rule that actually redirects to a 404 page...)>=20> I want to figure out how to use an include so that i'm specifically =not rewriting and redirecting the URL (thus making it ugly)>=20> Anyone currently doing anything like this?> If I can figure out how to do it, is anyone else interested in the =code?>=20>=20>=20>=20> Brian B. Burton> brian@burtons.com>=20> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> time is precious. waste it wisely> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>=20>=20>=20> On Apr 27, 2011, at 6:22 AM, William DeVaul wrote:>=20>> On Tue, Apr 26, 2011 at 11:38 PM, Kenneth Grome =wrote:>>>> I'm not sure why you'd leave the humans ugly URLs.>>>=20>>> Because those URLs are the default URLs for WebDNA.>>=20>> I thought the parameterized URLs were a convention that came about in>> the early days of the Internet. Seems the convention is ripe for>> change.>>=20>> In general, I'm for programmer convenience versus optimization for =the>> computer. But I'd put user convenience above the programmer's. In>> some frameworks the default is "prettier" to the benefit of users and>> programmers.>>=20>>>> The search engines like keywords.>>>=20>>> They get plenty of keywords in the static pages.>>=20>> I think it is about quality of the keyword placement (in incoming>> links, in the domain, in the URLs, in "important" tags e.g.