Using a ZPT/TAL as content in Plone

7 messages Options
Embed this post
Permalink
rvengelen () Using a ZPT/TAL as content in Plone
Reply Threaded More More options
Print post
Permalink
Hi All,

I'm pretty new to Plone, so I hope this question can be answered fairly easily. :)

I've created a Page Template (ZPT/TAL) to retrieve some information from a MySQL database tabel and display that in HTML. When I browse to the hard link of the template all information is diplayed as expected.

I've been using this tutorial for creating the ZPT: http://plone.org/documentation/tutorial/plone-and-mysql


The big question (for me)  is, how can I possibly use this ZPT or atleast the result of the ZPT as content within Plone?

Kind Regards,

Ron van Engelen
ajung () Re: Using a ZPT/TAL as content in Plone
Reply Threaded More More options
Print post
Permalink
Re-use the main_template and fill in your content using metal:fill-slot="main"..look
at existing templates of Plone or some add-ons (or as documented in the ZPT docs).

Andreas

rvengelen wrote:
Hi All,

I'm pretty new to Plone, so I hope this question can be answered fairly easily. :)

I've created a Page Template (ZPT/TAL) to retrieve some information from a MySQL database tabel and display that in HTML. When I browse to the hard link of the template all information is diplayed as expected.

I've been using this tutorial for creating the ZPT: http://plone.org/documentation/tutorial/plone-and-mysql


The big question (for me)  is, how can I possibly use this ZPT or atleast the result of the ZPT as content within Plone?

Kind Regards,

Ron van Engelen
rvengelen () Re: Using a ZPT/TAL as content in Plone
Reply Threaded More More options
Print post
Permalink
Hi Andreas,

Thank you for you quick response but I'm not sure what you mean. Here's the code of my ZPT, what can you say about that?

-----------------------------------------
<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>

<div metal:fill-slot="main">
<TABLE BORDER=2 CELLPADDING=4>
<TR> <TH CELLSPAN=1 BGCOLOR="#D2D8F9">AS</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Peer</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">IX</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Status</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Prefixes</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Router</TH>
 </TR>
    <ul>
        <li tal:repeat="records context/select_all_tables">
            <TR><TD>AS</TD>
                <TD>Peer</TD>
                <TD>IX</TD>
                <TD>Status</TD>
                <TD>Status</TD>
                <TD>Router</TD>
            </TR>
        </li>
    </ul>
</TABLE>

</div>

</body>
</html>
------------------------

Thanks!

Ron
ajung wrote:
Re-use the main_template and fill in your content using metal:fill-slot="main"..look
at existing templates of Plone or some add-ons (or as documented in the ZPT docs).

Andreas

rvengelen wrote:
Hi All,

I'm pretty new to Plone, so I hope this question can be answered fairly easily. :)

I've created a Page Template (ZPT/TAL) to retrieve some information from a MySQL database tabel and display that in HTML. When I browse to the hard link of the template all information is diplayed as expected.

I've been using this tutorial for creating the ZPT: http://plone.org/documentation/tutorial/plone-and-mysql


The big question (for me)  is, how can I possibly use this ZPT or atleast the result of the ZPT as content within Plone?

Kind Regards,

Ron van Engelen
ajung () Re: Using a ZPT/TAL as content in Plone
Reply Threaded More More options
Print post
Permalink
The template is looking fine and should render (whatever) within the main slot (look & feel)
of Plone - or?

-aj
rvengelen wrote:
Hi Andreas,

Thank you for you quick response but I'm not sure what you mean. Here's the code of my ZPT, what can you say about that?

-----------------------------------------
<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>

<div metal:fill-slot="main">
<TABLE BORDER=2 CELLPADDING=4>
<TR> <TH CELLSPAN=1 BGCOLOR="#D2D8F9">AS</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Peer</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">IX</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Status</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Prefixes</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Router</TH>
 </TR>
    <ul>
        <li tal:repeat="records context/select_all_tables">
            <TR><TD>AS</TD>
                <TD>Peer</TD>
                <TD>IX</TD>
                <TD>Status</TD>
                <TD>Status</TD>
                <TD>Router</TD>
            </TR>
        </li>
    </ul>
</TABLE>

</div>

</body>
</html>
------------------------

Thanks!

Ron
ajung wrote:
Re-use the main_template and fill in your content using metal:fill-slot="main"..look
at existing templates of Plone or some add-ons (or as documented in the ZPT docs).

Andreas

rvengelen wrote:
Hi All,

I'm pretty new to Plone, so I hope this question can be answered fairly easily. :)

I've created a Page Template (ZPT/TAL) to retrieve some information from a MySQL database tabel and display that in HTML. When I browse to the hard link of the template all information is diplayed as expected.

I've been using this tutorial for creating the ZPT: http://plone.org/documentation/tutorial/plone-and-mysql


The big question (for me)  is, how can I possibly use this ZPT or atleast the result of the ZPT as content within Plone?

Kind Regards,

Ron van Engelen
rvengelen () Re: Using a ZPT/TAL as content in Plone
Reply Threaded More More options
Print post
Permalink
Well, what I've done is this:

1. I've created a new folder within Plone, named "Peering Info";
2. From the ZMI I've added a Z MySQL Database Connection, a Z SQL Method and a Page Template.

What I would expect it to see the Page Template back in the contect of "Peering Info" within Plone, but I don't. Only when I enter the full path to the template (http://portal.***/peering_info/Peering/) , the page is show correctly.


ajung wrote:
The template is looking fine and should render (whatever) within the main slot (look & feel)
of Plone - or?

-aj
rvengelen wrote:
Hi Andreas,

Thank you for you quick response but I'm not sure what you mean. Here's the code of my ZPT, what can you say about that?

-----------------------------------------
<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>

<div metal:fill-slot="main">
<TABLE BORDER=2 CELLPADDING=4>
<TR> <TH CELLSPAN=1 BGCOLOR="#D2D8F9">AS</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Peer</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">IX</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Status</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Prefixes</TH>
     <TH CELLSPAN=1 BGCOLOR="#D2D8F9">Router</TH>
 </TR>
    <ul>
        <li tal:repeat="records context/select_all_tables">
            <TR><TD>AS</TD>
                <TD>Peer</TD>
                <TD>IX</TD>
                <TD>Status</TD>
                <TD>Status</TD>
                <TD>Router</TD>
            </TR>
        </li>
    </ul>
</TABLE>

</div>

</body>
</html>
------------------------

Thanks!

Ron
ajung wrote:
Re-use the main_template and fill in your content using metal:fill-slot="main"..look
at existing templates of Plone or some add-ons (or as documented in the ZPT docs).

Andreas

rvengelen wrote:
Hi All,

I'm pretty new to Plone, so I hope this question can be answered fairly easily. :)

I've created a Page Template (ZPT/TAL) to retrieve some information from a MySQL database tabel and display that in HTML. When I browse to the hard link of the template all information is diplayed as expected.

I've been using this tutorial for creating the ZPT: http://plone.org/documentation/tutorial/plone-and-mysql


The big question (for me)  is, how can I possibly use this ZPT or atleast the result of the ZPT as content within Plone?

Kind Regards,

Ron van Engelen
ajung () Re: Using a ZPT/TAL as content in Plone
Reply Threaded More More options
Print post
Permalink
This means what exactly? *please* give a reasonable description.
We are not into the guessing business :-)

-aj

rvengelen wrote:

What I would expect it to see the Page Template back in the contect of "Peering Info" within Plone, but I don't.
rvengelen () Re: Using a ZPT/TAL as content in Plone
Reply Threaded More More options
Print post
Permalink
Hi aj,

Hmm, to me this was already a pretty clear description. Apart from the two errors in the sentence. :P

I've uploade some screenshot, so I hope that'll make thing a bit clearer.

As you can see I've created a folder named "Datacenter Info" with a subfolder named "Peering". Normally I would add a "new page" to the subfolder "Peering" and put all kinds of info on this particular page. But in this case the page needs to display dynamic data which is pulled out of a MySQL database.

So I've used the tutorial which I mentioned earlier. In short: I went into the ZMI and looked up the "Datacenter Info --> Peering" folder. In that folder I created the MySQL db connection and Z SQL Method. After that I've created the Zope Page Template to pull the data out of the database.

Now my problem is this. I'm only able to view the info from the Page Template when I use the direct path to the template. I also don't see anything of this template back in my Plone content.

So, I guess my question is....how can I "page in" this template within Plone?

Does this make things a bit cleared? I hope so! ;)

Kind regards,

Ron

Peering Folder in Plone.png
Peering Folder in ZMI
Content op Peering folder in Plone

ajung wrote:
This means what exactly? *please* give a reasonable description.
We are not into the guessing business :-)

-aj

rvengelen wrote:

What I would expect it to see the Page Template back in the contect of "Peering Info" within Plone, but I don't.