Re: Best way to handle 404 errors with WebDNA and Web* V

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 52428
interpreted = N
texte = > I think Alain could chime in here. IIRC, he wrote some of the "slick > webcat > code" Aaron referred to. Right .. Heres our 'slick' error code, this is more used to generate static URL's from WebDNA databases, or redirect to a standard error page for a site. Might help some people though with the custom error stuff .. We run a modified errormessages.db which has an entry for TemplateNotFound as follows: TemplateNotFound[showif [fileinfo file=/interpret.inc][exists][/fileinfo]=T][text]show_error=F[/ text][text]hide_error_redirect=F[/text][include file=/interpret.inc][/showif][hideif [hide_error_redirect]=T][showif [fileinfo file=/error.html][exists][/fileinfo]=T][redirect /error.html][/showif][/hideif][hideif [show_error]=F]Error: template '[param1]' not found[/hideif] What this does in a nutshell: Looks for our interpret.inc file which is the connector to the database, if this exists, include it. If it doesn't exist check for an error.html in the root of the website directory, if that exists redirect to it. If it doesn't exist just show the standard template 'blah blah' not found error ... Then the interpret.inc file looks something like this .. example below shows usage for a product database and a request for a url such as http://www.domain.com/products/12345.html where 12345 is the ID of the product in the database. [search db=/db/products.db&eqPRODUCT_IDdata=[middle startafter=/products/&endbefore=.][thisurl][/middle]] [founditems] [text]write_error=F[/text] [!] ## Do not write to errormessages.txt --[/!] [include file=/templates/[product_template]] [/founditems] [showif [numfound]=0] [text]show_error=T[/text] [/showif] [/search] NOTE: you will need to create the /products/ folder on the server and leave it empty for the above to work - otherwise you will hit a webserver error page .. The above has proven itself to be very robust for us - we once took 127,000 page views in 2 hours on a site that uses the above method, the server ticked along nicely - a little slower than normal but it didn't have any problems. Adding code like this will also typically add 2-3 ticks to the generation of the page. I'm working on a caching system at the moment for this to allow our CMS to cache compiled pages so each one is not regenerated .. will let you know how that goes ;) If anyone has any questions - please yell out. Alain ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Best way to handle 404 errors with WebDNA and Web* V ( Alain Russell 2003)
  2. Re: Best way to handle 404 errors with WebDNA and Web* V ( Christer Olsson 2003)
  3. Re: Best way to handle 404 errors with WebDNA and Web* V ( Jeff Logan 2003)
  4. Re: Best way to handle 404 errors with WebDNA and Web* V ( Clint Davis 2003)
  5. Re: Best way to handle 404 errors with WebDNA and Web* V ( Jeff Logan 2003)
  6. Re: Best way to handle 404 errors with WebDNA and Web* V ( Kenneth Grome 2003)
  7. Re: Best way to handle 404 errors with WebDNA and Web* V ( Aaron Lynch 2003)
  8. Best way to handle 404 errors with WebDNA and Web* V ( Jeff Logan 2003)
> I think Alain could chime in here. IIRC, he wrote some of the "slick > webcat > code" Aaron referred to. Right .. Heres our 'slick' error code, this is more used to generate static URL's from WebDNA databases, or redirect to a standard error page for a site. Might help some people though with the custom error stuff .. We run a modified errormessages.db which has an entry for TemplateNotFound as follows: TemplateNotFound[showif [fileinfo file=/interpret.inc][exists][/fileinfo]=T][text]show_error=F[/ text][text]hide_error_redirect=F[/text][include file=/interpret.inc][/showif][hideif [hide_error_redirect]=T][showif [fileinfo file=/error.html][exists][/fileinfo]=T][redirect /error.html][/showif][/hideif][hideif [show_error]=F]Error: template '[param1]' not found[/hideif] What this does in a nutshell: Looks for our interpret.inc file which is the connector to the database, if this exists, include it. If it doesn't exist check for an error.html in the root of the website directory, if that exists redirect to it. If it doesn't exist just show the standard template 'blah blah' not found error ... Then the interpret.inc file looks something like this .. example below shows usage for a product database and a request for a url such as http://www.domain.com/products/12345.html where 12345 is the ID of the product in the database. [search db=/db/products.db&eqPRODUCT_IDdata=[middle startafter=/products/&endbefore=.][thisurl][/middle]] [founditems] [text]write_error=F[/text] [!] ## Do not write to errormessages.txt --[/!] [include file=/templates/[product_template]] [/founditems] [showif [numfound]=0] [text]show_error=T[/text] [/showif] [/search] NOTE: you will need to create the /products/ folder on the server and leave it empty for the above to work - otherwise you will hit a webserver error page .. The above has proven itself to be very robust for us - we once took 127,000 page views in 2 hours on a site that uses the above method, the server ticked along nicely - a little slower than normal but it didn't have any problems. Adding code like this will also typically add 2-3 ticks to the generation of the page. I'm working on a caching system at the moment for this to allow our CMS to cache compiled pages so each one is not regenerated .. will let you know how that goes ;) If anyone has any questions - please yell out. Alain ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Alain Russell

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Problems passing [SKU] with $Replace in 2.0 (1997) Limiting user access to .tmpl files (1997) Bad URL reference? (1997) Re[2]: (2000) Re:listfiles-looking for slick solution (1997) PIXO (1997) Deleting Multiple Database Records based on Checkbox (1998) What are SMSI's upgrade policies? (2003) en/decrypt problem (1999) WebCat chatroom/hyperboard (1997) $Replace with [founditems] (1997) [LOOKUP] (1997) More questions about serial number dishing (1997) Virtual hosting and webcatNT (1997) Pop-Up Redirects (1998) Paypal merchant code tricks or pitfalls (2003) [platform] tag? (1998) Re:Comments Convertion (1998) Other then credit cards-how? (1997) WebCat b15 Mac plug-in (1997)