Disable Template Error Messages?

General ShopSite user discussion

Disable Template Error Messages?

Postby davee123 » Sun Nov 04, 2007 5:26 pm

So, I'm trying to simplify some of the template layouts so that there's no repetition, etc. For instance, I have sidebar that I want to show on almost every page. And by "page" I mean places like the Shopping Cart, "Pages", Search Results page, etc, etc. So, I have placed this sidebar in an include file, which is great! That means I can just put this into each of the templates where it's supposed to show, and it'll include it on all the pages:

Code: Select all
[-- INCLUDE sidebar.sst PROCESS --]


But, small problem. Within the sidebar template, I've tried to make it a little smart. I've got a few pieces of code that look something like:

Code: Select all
[-- IF PAGE.Field1 "widget" --]
    You're on the widgets page! Hooray for widgets!
[-- END_IF --]


So, that works all well and good when the include file is used on a "Page" page, but not when it's used on, say, the Gift Certificates page, because of course, the Gift Certificates page doesn't have a PAGE.Field1 property. On the plus side, it DOES do what I expected it to do, and evaluates to "FALSE" (so if there's an ELSE clause, it will properly execute, which is good), but it gives me a nasty error message on the page:

Code: Select all
<br><font color="black">&nbsp;&nbsp;&nbsp;test_gc_template.sst [57]: </font><font color="red">Template Error: IF using PAGE tag in non-page template </font>

<!-- ClientApp: Error-count incremented (1) -->


So, for the time being, I've modified my include file to look more like:

Code: Select all
<!-- [-- IF PAGE.Field1 "widget" --] -->
    You're on the widgets page! Hooray for widgets!
[-- ELSE --] -->
[-- END_IF --]


That *works*, but is messy (it just comments out the error message).

So:

1) Is there any way to disable these messages when the site gets published? That is, I would think it's a generally bad idea for that message to get shown to end users (though good to be shown to people maintaining their own ShopSite instances).

2) Does that message "ClientApp: Error-count incremented (1)" do anything that might cause anything else to break? I guess it just makes me leery to see something that's counting any errors, since some things may expect the error count to be 0 before executing or something. Just want to make sure that my comment-out-the-error solution isn't causing some sort of other error that I may not know about.

DaveE
davee123
 
Posts: 8
Joined: Tue Oct 09, 2007 7:56 am
Location: Massachusetts, USA

Return to User Forum

Who is online

Users browsing this forum: Google [Bot] and 93 guests