Mailing List Archive

[Bricolage-General] Query to PgSQL from Bricolage
Hi all,


For example is it possible create an application (with Bricolage) that fetch
data from PgSQL? ( I known that with Mason it is possible but is very
difficult separate Template from Perl Code).


<!-- inizio componente: fetch_xml_quotidiani -->


<%init>


$dbx->DoSql(qq{ SELECT * FROM quotidiani });


my $xml_out = $dbx->GetData;


</%init>


<& xml2other, string_xml => $xml_out, xsl_file =>
$m->comp('selettore_file_xsl') &>


<%doc>
Componente "fetch_xml_quotidiani":
Gestisce le query alla table quotidiani
</%doc>


<!-- fine componente: fetch_xml_quotidiani ->


Is it possibile integrate code of this type in Bricolage CMS?
(i.e. Create custom query to own database and fetch relative content)


Tanks in advance


Antonio




-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general
Re: [Bricolage-General] Query to PgSQL from Bricolage [ In reply to ]
Antonio wrote:
> For example is it possible create an application (with Bricolage) that fetch
> data from PgSQL? ( I known that with Mason it is possible but is very
> difficult separate Template from Perl Code).
<snip>
[some dbm code]
<snip>
> Is it possibile integrate code of this type in Bricolage CMS?
> (i.e. Create custom query to own database and fetch relative content)

Absolutely! You would just do this in the templates as normal.

This is what we're doing right now to manage our helth topic
links, although in the future I would like to move this
stuff into the bricolage API.

Meanwhile, there is another way for you to consider: You
could create elements which correspond to the data that you
are loading from your database, and create external scripts
to load that data. It can be a bit of a pain, but it can
also be worth it in that it saves on system load at burn
time.

I'll be happy to post examples if you wish.

Regards,

Mark

--
--
=================================================================
-- mark at geekhive dot net --


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general
Re: [Bricolage-General] Query to PgSQL from Bricolage [ In reply to ]
Antonio wrote:
> 1) i need to create a site that fetch links of news from database (actually
> MySQL but Bricolage works with PgSQL...)

First, I should explain that Bricolage mainly produces flat
pages, from the content that your editors enter, and the
templates that you make. That's what a CMS does in general.
If your site has very very volital data, and not much in the
way of editorial content, then a CMS doesn't do you much
good, and that includes Bricolage.

If on the other hand you have a mix of editorial and live
data, and you have to combine them, then Bricolage is your
best bet, and you should read on....

There are a couple of choices based on how volitile the data
is, and how much traffic the site gets, compared to how much
your servers can take.


1. If you need your data to be refreshed dynamically, and
your servers can take the load you should use Mason SSI,
as David Wheeler explained in a message to this list in
late December of last year, or perhaps in early January.
I'm not quite sure.

To summarize, you make a media type of Mason, which will
allow you to upload mason code, then you can grab the
URI of the media object in question and print it out
into an Apache SSI instruction or a mason includes to
include your flat file.

Then when Bricolage burns your page, it will have an
include in it which will include your mason code for
fetching the live data from your DB.

-or-

2. If your data isn't really updated very often at all, and
you need to serve pages, then you can put your DB code
right into the bricolage template and away you go!


> Actually i work with Mason but is very difficult merge perl code with HTML
> code

I find that I prefer to follow the coding standards in the
mason docs, and put my HTML up top, using <% %> to stick in
very limited amounts of perl. Meanwhile I'll use <%once> or
<%init> to do most of the work.


> I'm trying to learning Bricolage but i would need some example that explain
> functionality of BricolageCMS; for example can i create in Bricolage Session/
> Autentycation System? Is there any example that show how to create a medium
> complex site with this tool (i.e. Salon)?

I'm afraid that Bricolage by itself just prints out flat
pages. If you want to add interactivity to the resulting
site that's going to be up to you, probably using the SSI
technique outlined above, or in David's email from last
winter.


Hope that helps,

Mark


--
--
=================================================================
-- mark at geekhive dot net --


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general