[Zope] dtml-newbie question: sql

Tino Wildenhain tino@wildenhain.de
Sat, 21 Jul 2001 17:10:51 +0200


Hi Lambert,

apart of sending HTML to the list, you seem to make
it harder for yourself then is has to be.
With zope, you already have a database. So if you
put the content into the ZODB by creating
objects, you already have all information there and
dont need to access a SQL database for this.
Your navigation can use the following DTML snipplet
(if you really want DTML)

<dtml-in objectValues skip_unauthorized>
  <a href="&dtml-absolute_url;"><dtml-var title></a>
  <dtml-if "_['sequence-item'] in PARENTS"> we are in the URL path
      <dtml-var this_method_again_as_recursive>
  </dtml-if>
</dtml-in>

Of course you can mimify this with SQL, but then, you might at least
put the whole logic into a PythonScript.

Regards
Tino

--On Samstag, 21. Juli 2001 11:18 +0200 Lambert Muhr <lmuhr@web.de> wrote:

>
> the structure of my zope-site is fully based on relational mysql-tables.
> I am generating, e.g., submenu-entries by selecting submenu-titel,
> submenu-id, submenu-text, submenu-image, etc., from the sql-table
> 'submenu' and inserting them into the page as dtml-variables (with that,
> I manage to maintain a 4-level sitemap with users editing contents via
> some simple ms-access-masks).
> on a specific content page, e.g., the start page of submenu_1, I added a
> horizontal navigation list like: submenu_1 || submenu_2 || submenu_3
> by means of a <dtml-in submenu-sql-method> listing the <dtml-var
> submenu-titel>'s as well as their url's (traversal sql-methods).
> now, I want to escape the link-html-tag (<a href>) for that very
> sequence-item (submenu-entry) which is the one of the current page (e.g.,
> when I am in submenu_2, I want to drop the (<a href>) for the
> sequence-item submenu_2): submenu_1 || submenu_2 || submenu_3
>
> I tried this by means of a <dtml-unless> around the <a href>-tag,
> checking whether the current sequence-item is the same as the one the
> current page is being built on.
> my problem:
> how can I - within a dtml-in-tag - check whether the current
> sequence-item is a specific one:
> <dtml-var standard_html_header>
> <p>this is the submenu number <dtml-var submenu_id></p>
> <p>navigate to any of the submenu-entries at the same level
> <dtml-in submenu-sql-method>
> <dtml-unless expr="sm_id == '[current submenu_id]'"><a
> href="traversal_url"><dtml-unless> <dtml-var submenu-titel>
> <dtml-unless expr="sm_id == '[current submenu_id]'"></a><dtml-unless>
> </dtml-in>
>
> I tried to set - outside of the dtml-in-tag - a variable using REQUEST:
> <dtml-call "REQUEST.set('[current submenu_id]',????)">
> but it seems I cannot replace ???? by <dtml-var submenu_id> which -
> content-wise - would be the solution.
> I would be grateful for any hint.
>
> thanks
> lambert