When my "standard_html_header" method is called, I would like it to detect whether it's called on the site homepage or not. Specifically, there is a graphical element that I would like to have displayed *only* when the home page is displayed (eg. http://www.mysite.com or http://www.mysite.com/index_html). But if a method is called on the root folder (eg. http://www.mysite.com/login_form) I do *not* want the graphic to display. Similarly, I do not want it to display for any subfolders, etc. So far, I have this: <dtml-if "URLPATH1=='' "> display graphic </dtml-if> This makes sure the graphic is not displayed when you're in a subfolder. However, it still shows the graphic for methods called on the root of the site. So I thought of doing something like this: <dtml-if "URLPATH1=='' "> <dtml-if methodname="" or methodname="index_html" > display graphic </dtml-if> </dtmlif> How do I tell what the current method name is in my "standard_html_header"? I'm sure this is insanely obvious, but i'm stumped nevertheless. Regards, Dave
From: davelehman@loewen.com site. So I thought of doing something like this:
<dtml-if "URLPATH1=='' "> <dtml-if methodname="" or methodname="index_html" > display graphic </dtml-if> </dtmlif>
<dtml-if "id=='index_html'"> should work...
davelehman@loewen.com writes:
When my "standard_html_header" method is called, I would like it to detect whether it's called on the site homepage or not. The easiest way would be to put something like the following at the top of your homepage (and only there):
<dtml-var "REQUEST.set('I_am_the_home',1)"> <dtml-var standard_html_header> .... And in your "standard_html_header": <dtml-if I_am_the_home> .... </dtml-if> When you are interested in properties of the published object, you can use "PUBLISHED_OBJECT" (a REQUEST variable). Be careful, "id" is sometimes an attribute but often a method. It would be best to use "_.render(PUBLISHED_OBJECT.id)" to access it. Dieter
participants (3)
-
davelehman@loewen.com -
Dieter Maurer -
marc lindahl