[Zope] rendered method in dtml document

Thomas M G Bennett bennettt at pm.appstate.edu
Fri Sep 26 11:04:47 EDT 2003


Zope Version  (Zope 2.6.1 (binary release, python 2.1, linux2-x86), python 2.1.3, linux2)  

Python Version  2.1.3 (#1, Sep 19 2002, 13:15:46) [GCC egcs-2.91.66 19990314/Linux 
(egcs-1.1.2 release)]  

System Platform  linux2  



I have searched the Zope site, emails, lab, etc and haven't found what I hoped would be 
a shorter solution rather than write a python script.  So, here is what I want to do.

  I am trying to make available to my web page editors a single tag which would display 
one URL on the local domain and a different URL to all others. Below I have pasted in 
my ZSQL and Method which work fine if you supply a record number in a form or in a 
URL.  The Method displays an Online Database Title which is hyperlinked to the online 
database.

  If you are in our domain you get the hyperlink which allows access to the database per 
our IP domain.  If you are outside our domain you get a hyper link that allows you to login 
to our server and use it as a proxy, then the database will allow you access.  I've tried as 
a tag in another page several different permutations of:

<dtml-call dbtitle(47)>

I've also tried REQUEST.set, dtml-let,  and dtml-set .  If you put the url 

http://www.library.appstate.edu/dbtitle?mytitle=74 

in the location bar of the browser (or any other number from 1 to 108) the method will 
disply the hyperlinked title to that databased based on record number.


====================================
         DTML METHOD
  ip_add_flag returns a 1 or 0 depending on
  if you are in our domain or not
====================================
<dtml-call "REQUEST.set('hostname',ip_add_flag(REMOTE_ADDR))">

<dtml-in db_title_query size=1 start=query_start>

<a href="http://

  <dtml-if hostname>
     <dtml-var vdb_local_url null="">
  <dtml-else>
      <dtml-var vdb_proxy_url null="">
  </dtml-if>

<dtml-var vdb_title null="">"></a>

</dtml-in>


===================================
            Z SQL
  one argument: mytitle
===================================
select vdb_title, vdb_local_url, vdb_proxy_url 
 from vdb_data 
  where vdb_rec=<dtml-var mytitle>




Thanks, 

Thomas



PS: Usually I don't need to ask for assistance because the answers are usually already 
posted here.  Thanks to all of those responders that share their insight and knowledge 
here by answering these requests.


-----------------------------------------------------------------
  Use The Help Desk at http://linux.library.appstate.edu/help
-----------------------------------------------------------------
                      Rock and Rule
             Zope Rocks -- http://www.zope.org
           Python Rules  -- http://www.python.org    
-----------------------------------------------------------------
Thomas McMillan Grant Bennett      Appalachian State University
Computer Consultant III            University Library
Voice:  828 262 6587	           FAX:    828 262 2797

"Windows: A 32-bit GUI on top of a 16-bit wrapper around an 8-bit 
interpretation of a 4-bit operating system written by a 2-bit 
company."   -David Simmons







More information about the Zope mailing list