[Zope] re: re: [Zope] SQL Queries
Giampiero Raffaini
giampiero@btinternet.com
Sun, 16 Jan 2000 21:34:24 GMT
16/01/2000 21:21:37
sorry, maybe i am a bit thick but this example is more or less an anchor, am i wrong?
what i used to do with cf is this:
run a query on a table and extract tile and id;
use the result of the query to buil a series of links, using the tile for the visible part of the link
something like
<a href="movies.cfm?#ID#">#title#</a>
that turned out in something like:
<a href="movies.cfm?1">Blade Runner</a>
<a href="movies.cfm?2">Hellraiser</a>
<a href="movies.cfm?3">Total Recall</a>
etc.
each link will call up a page, each page will run a query using the #ID# argument passed by the url
like
SELECT from dvdfilms
Title,ID
WHERE ID=#url.ID#
how do i refer to the variable 'url.id' in zope?
cheers
Original message from: schenck@ultra.posc.org
>You do it just like you would with HTML. Use an <a> tag with a name, e.g., if I had a file
>named internalRefTest_html that looked like this:
>
><dtml-var standard_html_header>
><h2><dtml-var title_or_id></h2>
><p><a href="#t1">Go to topic 1</a></p>
><p><a href="#t2">Go to topic 2</a></p>
><a name="t1"><h3>Topic 1</h3></a>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><P> </p>
><a name="t2"><h3>Topic 2</h3></a>
><dtml-var standard_html_footer>
>
>I can then reference the page like this: http://myFolder/internalRefTest_html#t2
>
>Unless there is something I am missing, this works ok.
>
>Dan
>
>> ** Original Subject: re: [Zope] SQL Queries
>> ** Original Sender: Giampiero Raffaini <giampiero@btinternet.com>
>> ** Original Date: Sun, 16 Jan 2000 15:48:10 GMT
>
>> ** Original Message follows...
>
>>
>> 16/01/2000 15:45:12
>> thanks again.
>> in CF i used to be able to link each title to a dynamically generated page using the ID, like
>this:
>> a href="newpage.cfm?#ID#
>> so that each title would go to its specific page thanks to the ID.
>> How do you do this in Zope?
>> Cheers
>>
>> Original message from: schenck@ultra.posc.org
>> >Giampiero,
>> >
>> >You can easily do that. Take a look at this code. It is a DTML Method,
>tableCount_html
>> >which displays a page that allows a user to select a table name from a select list in a form.
>> >The options are retrieved from a data base before the page is displayed:
>> >
>> ><dtml-var standard_html_header>
>> ><form action="tableInstances" method="get">
>> ><h2 align="center"><dtml-var document_title></h2>
>> ><hr>
>> ><p><font size="+1">Enter query parameters:</font></p>
>> ><table>
>> ><tr><th>Entity name</th>
>> > <td><SELECT NAME="entity_name" SIZE=1>
>> ><dtml-in getTableNames>
>> > <OPTION><dtml-var table_def_nm null=""></OPTION>
>> ></dtml-in>
>> ></SELECT>
>> > </td></tr>
>> ><tr><td colspan=2 align=center>
>> ><input type="SUBMIT" name="SUBMIT" value="Submit Query">
>> ></td></tr>
>> ></table>
>> ></form>
>> ><p> </p>
>> ><dtml-var standard_html_footer>
>> >
>> >Here is the code for getTableNames, a Z SQL Method that uses the ODBC interface to
>> >query an Oracle database for the possible list of tables to select from:
>> >
>> >select table_def_nm from table_def
>> >order by 1
>> >
>> >As you can see, when someone references tableCount_html the getTableNames method
>is
>> >called without the user pressing any buttons.
>> >
>> >Dan Schenck
>> >POSC
>> >Houston, TX
>> >
>> >> ** Original Subject: [Zope] SQL Queries
>> >> ** Original Sender: Giampiero Raffaini <giampiero@btinternet.com>
>> >> ** Original Date: Sun, 16 Jan 2000 14:04:53 GMT
>> >
>> >> ** Original Message follows...
>> >
>> >>
>> >> 16/01/2000 13:59:55
>> >> Hello there,
>> >> I am new to zope and i find it great. I am still learning it and I have a few questions, but
>one
>> >in particular;
>> >> I used Coldfusion before and I was able to do this:
>> >> I had a db with movies, with Title,director,year and so on. I could run a query looking
>for
>> >Tilte and ID and then
>> >> output the result on a line and make each of the Titles a dynamically generated link
>> >(something like
>> >> <a href="newpage.cfm?#ID#>#Title#</a> if you know what I mean).
>> >> Now my question is:
>> >> is it possible in Zope to run SQL queries without the need to actually click on a Submit
>> >button?
>> >> Cheers
>> >>
>> >>
>> >> _______________________________________________
>> >> Zope maillist - Zope@zope.org
>> >> http://lists.zope.org/mailman/listinfo/zope
>> >> ** No cross posts or HTML encoding! **
>> >> (Related lists -
>> >> http://lists.zope.org/mailman/listinfo/zope-announce
>> >> http://lists.zope.org/mailman/listinfo/zope-dev )
>> >>
>> >
>> >
>> >>** --------- End Original Message ----------- **
>> >
>> >>
>> >
>> >
>> >Dan R. Schenck mailto:schenck@posc.org
>> >POSC http://www.posc.org
>> >Suite 275
>> >10777 Westheimer
>> >Houston, TX 77042
>> >
>> >
>> >
>> >_______________________________________________
>> >Zope maillist - Zope@zope.org
>> >http://lists.zope.org/mailman/listinfo/zope
>> >** No cross posts or HTML encoding! **
>> >(Related lists -
>> > http://lists.zope.org/mailman/listinfo/zope-announce
>> > http://lists.zope.org/mailman/listinfo/zope-dev )
>> >
>> >
>>
>
>
>>** --------- End Original Message ----------- **
>
>>
>
>
>Dan R. Schenck mailto:schenck@posc.org
>POSC http://www.posc.org
>Suite 275
>10777 Westheimer
>Houston, TX 77042
>
>
>