HowTo Search for a property
Hey all, If you ever wished you could find an object that has a specific property in your site, the following code does the trick. It consists of two methods. Put them in the root folder and "view" FindAProperty. Simply type in the name of the property and ##################################################################### DTML Method FindAProperty: #################################################################### <dtml-var standard_html_header> <h1><dtml-var document_title></h1> <dtml-if property> <FORM METHOD="POST"> <table> <tr><input type="BUTTON" name="Back" value="Back" onClick="history.back()"></tr> </table> </form> Property: <dtml-var property><br> <dtml-in "propertyItems()"> <dtml-if "_['sequence-key'] == property"> Root: <dtml-var sequence-item><br> </dtml-if> </dtml-in> <dtml-let path="''"> <dtml-var Recurse> </dtml-let> <dtml-else> <h3>Type the property name you wish to locate</h3> <P><form action="FindAProperty" method="post" name="GetInfo"> <table> <tr><th colspan=4 align="left"><b>Item: </b></th></tr> <tr><td align="right"><b>Property:</B></TD><td align="left"><input type="text" maxlength=50 size=20 name="property" value=''></td></tr> <tr><td align="right"><input type="submit" name="FindProp" value='Submit ID'></td> <td align="left"><input type="BUTTON" name="Back" value="Back" onClick="history.back()"></TD> </table> </form> </dtml-if property> <dtml-var standard_html_footer> ##################################################################### DTML Method Recurse: #################################################################### <dtml-in "objectItems(['Folder'])"> <dtml-let path="path + '/' + _.str(id)"> <dtml-with sequence-item> <dtml-in "propertyItems()"> <dtml-if "_['sequence-key'] == property"> <dtml-var path>: <dtml-var sequence-item><br> </dtml-if> </dtml-in> <dtml-var Recurse> </dtml-with> </dtml-let> </dtml-in>
participants (1)
-
Daniel G. Rusch