Seite 1 von 1

ZOPE MySQL Tabellen Ausgabe in Plone veröffentlichen

Verfasst: Freitag 15. Dezember 2006, 09:08
von keboo
Hallo Leute,

Beschäftige mich erstmals mit ZOPE/PLONE.

Ich hab irgendwie was grundsätzliches noch nicht gefunden bei Plone.
Ich habe in Zope eine kurze Page geschrieben, die mir eine MySQL Tabelle ausgibt.

Das Ganze besteht aus 3 Files:

Dem Page Template parts.html:

Code: Alles auswählen


<html>

<h1>DATABASE entries</h1>

<table border="1" cellpadding="3">
    <tr>
    <th>ID</th>
    <th>Aircraft</th>
    <th>ATA</a></th>
    <th>SUBATA</th>
    <th>Description</th>
  </tr>
  <tr tal:repeat="parts container/getParts">
    <td tal:content="parts/id">id</td>
    <td tal:content="parts/aircraft">Aircraft</td>
    <td tal:content="parts/ATA">ATA</td>
    <td tal:content="parts/SUBATA">SUBATA</td>
    <td tal:content="parts/DESCRIPTION">Description</td>
  </tr>
</table>

</html>

Der Z MySQL Connection:

Id: MySQL_connection
Title: Z MySQL Database Connection
Database Connection String: test root root

und der Z SQL Method getParts: select * from parts


In Zope funktioniert das Ganze. Wie kann ich diese Files nun in Plone darstellen lassen und auch evenentuell das Standardtabellendesign von Plone darin implementieren? Wohin in Plone muss ich diese Files kopieren?


Danke für eure Hilfe,

Johannes

Re: ZOPE MySQL Tabellen Ausgabe in Plone veröffentlichen

Verfasst: Freitag 15. Dezember 2006, 10:05
von gerold
keboo hat geschrieben:Wie kann ich diese Files nun in Plone darstellen lassen und auch evenentuell das Standardtabellendesign von Plone darin implementieren?
Hallo Johannes!

Du kannst über das ZMI in irgendeinem Plone Ordner ganz normale Page Templates erstellen. Diese werden im Browser ganz normal angezeigt -- auch wenn sie sich in einem Plone-Ordner befinden. Damit die Seitenvorlage aber auch die Plone-Umgebung mit anzeigt, empfehle ich dir, den Code aus ``portal_skins/plone_content/document_view`` zu kopieren und an deine Ansprüche anzupassen.

Code: Alles auswählen

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      lang="en"
      metal:use-macro="here/main_template/macros/master"
      i18n:domain="plone"
>
<body>

<metal:main fill-slot="main">
  <tal:main-macro metal:define-macro="main">
  
    <div metal:use-macro="here/document_actions/macros/document_actions">
        Document actions (print, sendto etc)
    </div>
    
    <h1 tal:content="object_title" class="documentFirstHeading">
      Title or id
    </h1>
    
    <div metal:use-macro="here/document_byline/macros/byline">
      Get the byline - contains details about author and modification date.
    </div>
    
    <p class="documentDescription">
      Ich bin die Beschreibung
    </p>
    
    <div class="stx">
      <table border="1" cellpadding="3">
        <tr>
          <th>ID</th>
          <th>Aircraft</th>
        </tr>
        <tr tal:repeat="parts python:(
                          {'id': 1, 'aircraft': 'asdf'},
                          {'id': 2, 'aircraft': 'dddd'},
                          {'id': 3, 'aircraft': 'asdf'},
                        )"
        >
          <td tal:content="parts/id">id</td>
          <td tal:content="parts/aircraft">Aircraft</td>
        </tr>
      </table>     
    </div>
    
  </tal:main-macro>
</metal:main>

</body>
</html>
mfg
Gerold
:-)

Verfasst: Freitag 15. Dezember 2006, 10:36
von keboo
Hi Gerold!

Danke für die Antwort. Werd mich sicher noch öfter meldem um mich in de spannenden Welt von Plone zurechtzufinden!

Gruß,

Johannes :D