I'm encoutering a puzzling result with some DTMLMethods that I've written. I have some code which is used to display a list of information derived from a catalog. The information presented varies, based on which "category" of information the user desires. The DTMLMethod which generates most of this information looks like this: <dtml-in "InternetLinkCatalog(meta_type='Internet Link Info', categories=_['categoryName'])" sort=name> <dtml-with "InternetLinkCatalog.getobject(data_record_id_)"> < ... display object stuff here ... > </dtml-with> </dtml-in> For testing purposes, I created another DTMLMethod in the same folder named 'categoryName' and initially all it contained was one line: Accounting When I displayed the contents of my folder (which utilizes the list generation method), I received a list of all objects which belonged to the category of Accounting. I'm now trying to extend my code to use an actual category name specified by a user (or from a url clicked on by the user). I changed my 'categoryName' code to look like this: <dtml-with REQUEST only> <dtml-if category> <dtml-var category> <dtml-else> Accounting </dtml-if> </dtml-with> If I view this method, the result is 'Accounting', which is just what I would expect. However, when I attempt to view my generated list in the same manner as before, I get no results. I'm confused. When the categoryName simply has the value 'Accounting' in it, I see results. If I change the method to include some processing (but still answer the same thing), I get no results. I'm sure that I'm just doing something stupid a, but it's getting late in the day and I'm not seeing what the problem might be. Can someone help explain why I'm getting two different results for what should be the same? Thanks. James W. Howe mailto:jwh@allencreek.com Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html Ann Arbor, MI 48103
"James W. Howe" wrote:
I'm encoutering a puzzling result with some DTMLMethods that I've written. I have some code which is used to display a list of information derived from a catalog. The information presented varies, based on which "category" of information the user desires. The DTMLMethod which generates most of this information looks like this:
<dtml-in "InternetLinkCatalog(meta_type='Internet Link Info', categories=_['categoryName'])" sort=name> <dtml-with "InternetLinkCatalog.getobject(data_record_id_)"> < ... display object stuff here ... > </dtml-with> </dtml-in>
For testing purposes, I created another DTMLMethod in the same folder named 'categoryName' and initially all it contained was one line:
Accounting
When I displayed the contents of my folder (which utilizes the list generation method), I received a list of all objects which belonged to the category of Accounting. I'm now trying to extend my code to use an actual category name specified by a user (or from a url clicked on by the user). I changed my 'categoryName' code to look like this:
<dtml-with REQUEST only> <dtml-if category> <dtml-var category> <dtml-else> Accounting </dtml-if> </dtml-with>
I can't see the problem either, but I suggest changing your method to this: <dtml-if category> <dtml-return category> <dtml-else> <dtml-return "'Accounting'"> </dtml-if> The <dtml-with> is unecessary. Note the single quotes inside the double quotes. This might fix it, might not, not sure. But here you are explicitly returning a string, not a formatted document. -Michel
At 01:54 PM 3/8/00 -0800, Michel Pelletier wrote:
<dtml-if category> <dtml-return category> <dtml-else> <dtml-return "'Accounting'"> </dtml-if>
That did the trick. I hadn't thought about putting primes around a value inside of quotes. Thanks! James W. Howe mailto:jwh@allencreek.com Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html Ann Arbor, MI 48103
participants (2)
-
James W. Howe -
Michel Pelletier