On Wed, 28 Feb 2001, Casey Duncan wrote:
Joel Burton wrote:
We have our staff listed under /staff, so that you might find me as /staff?staffname=joel
I'd like the return page from this method to check if I have a homepage on the site, and if so, provide a link. Right now, I'm doing this as:
<dtml-in "PARENTS[1].home.objectIds(['Folder'])"> <dtml-if "_['sequence-item']==staffname"> <a href="/home/&dtml-staffname;">There is a home page</a> </dtml-if> </dtml-in>
(cycle through folders under the '/home' directory, check the seq-id against my name, and if so, generate a link.)
Is there a cleaner way to do this?
<dtml-with name="home" only> <dtml-if expr="_.hasattr(home, staffname)"> <a href="/home/&dtml-staffname;">There is a home page</a> <dtml-else> . No home page found. </dtml-if> </dtml-with>
or
<dtml-with name="home" only> <dtml-try> <a href="<dtml-var expr="_[staffname]" url>">There is a home page</a> <dtml-except KeyError> No home page found. </dtml-try> </dtml-with>
hth
Thanks, Casey! Another way from a private respondant: <dtml-if "restrictedTraverse('/home/' + name, _.None)"> <a href="/home/&dtml-name;">There is a home page</a> <dtml-else> This staff member doesn't have a home page on this site. </dtml-if> -- Joel Burton <jburton@scw.org> Director of Information Systems, Support Center of Washington