Plone 4 connect to Mysql and dispay sql query result on the plone page
I was able to connect to MySQL db and create Zope page Template to run some queries and display the results. Now I'm thinking to embed/add/insert the output of SQL queries results into a Plone page,
so when the user goes to www.plone_p开发者_如何学Cage.com it can see the output on this page.
how can I do it?
1.If you know how to write a browser:view, do create one and in the pt you can write something like:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
i18n:domain="csi.wifistats"
metal:use-macro="context/main_template/macros/master">
<body>
<metal:content-core fill-slot="content-core">
<metal:content-core define-macro="content-core">
<!-- Your dynamic content -->
</metal:content-core>
</metal:content-core>
</body>
</html>
2.If you don't know how to create a browser view, better to learn it and then go to step 1. ;) http://collective-docs.readthedocs.org/en/latest/views/browserviews.html
Yes, a real question would be nice. However, you have a Zope page template - that's where you get the actual data. Just customize the template to provide that data with a Plone look & feel: see the base_view template for the components you need.
精彩评论