Including sql requests as part of a page on cmcms?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
AndyHolyer

Including sql requests as part of a page on cmcms?

Post by AndyHolyer »

We are trying to replace a set of ASP scripts with a more principled solution, and cmsms is a strong candidate.

The scripts fetch data from an SQL database hosted on another server on our site, which I want to place into a template.

Since cmsms works with mysql to store its content, I'm guessing it should be pretty easy to link SQL connections into content, but I can't find any mentions from searching the site.

Am I totally insane to think of doing this? Or is is dead easy?

Thanks in advance for any advice

Andy Holyer
Sussex Downs College, Lewes, UK
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Including sql requests as part of a page on cmcms?

Post by calguy1000 »

You're not totally insane, but it's not dead easy either.

You'll have to know some php, and then create a user defined tag, a plugin, or a module (depending upon the complexity of what you need), that creates a mysql connection, queries the data, and then outputs it.

There are a few examples in the forge of plugins, etc, that access a different database, and plug that data into cms made simple.  I'd look for the 'quote of the day' plugin if it's still available in the forge as a good, though simplistic example.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
AndyHolyer

Re: Including sql requests as part of a page on cmcms?

Post by AndyHolyer »

I'll probably be tarred and feathered for this, but I'm an old Perl Fart; however when the choice is PHP or ASP, what do you think I would choose?

I'm minded to write a module to include arbitrary database connections, since (being in Further Education) there's a range of data sources owned by other departments who will not confirm  out of principle, so I will have to access whatever database they choose to use.

If I can get that in place, then it should all be easy :-/ Am I totally wrong in thinking that as a prerequisite I get PEAR so that I get the DB interfaces?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Including sql requests as part of a page on cmcms?

Post by calguy1000 »

I don't know about PEAR, but it is also possible to use multiple adodb connections within a CMS module.  You just have to create new adodb objects for each of them.  Not such a big deal.

If you're connecing to multiple different types of databases, you may need to require PEAR (/me adds that to his reading list).  but ADODB_lite, or adodb should be able to handle most of em.

CMS Made Simple 1.0.2 (and as of today 1.0.3) ships with adodb-lite.  And adodb should work just fine.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Locked

Return to “CMSMS Core”