Using Concrete5 with existing db application

Permalink
Hi,

I really like Concrete5 and have now built a few sites using it. I also have some existing sites which heavily use database calls for listing information.

I would like to use C5 for a new site with listings and I really like the way C5 can create the 'standard' pages, but is there a way to neatly tie in listing pages using php or calls to my existing php functions?

cheers,

Wittner

mikeb
 
ryan replied on at Permalink Reply
ryan
Look into Single Pages, you can really run whatever one-off db calls, forms & such in a single page.

http://www.concrete5.org/community/forums/customizing_c5/understand...

you get a db object with:
<?php
$db = Loader::db();
?>
mikeb replied on at Permalink Reply
mikeb
Brilliant!

thanks for that ryan, I'll check that out. Looks like exactly what I need to hook into my system,

cheers,

Wittner
asucarl replied on at Permalink Reply
asucarl
Is there a way to have Loader::db() load database other than the one concrete is using? I passed login parameters to it, with $create=true, but got errors as it was looking to retrieve data from concrete tables like Area, etc.
Remo replied on at Permalink Reply
Remo
how should this work? Concrete5 needs a few tables to run.. It's not like access where you build a database application..

You already have an application, it doesn't run without the tables.

You can always connect to a second database, but that's something different
asucarl replied on at Permalink Reply
asucarl
That's what I meant. How to connect to a second database.
I thought
Loader::db('host','user','pass','db',true)
would do that, but I was mistaken.
Remo replied on at Permalink Reply
Remo
I don't think c5 supports that..

But you can use any adodb method you want. But the wrappers you can use probably don't support a connection to a second database.
okhayat replied on at Permalink Reply
okhayat
One way it to use the database.table name in your code, given the use has access to both databases.
In my case, I needed to migrate data from one database to another and created pages for them in C5. What I did is use "select * from olddb.table", query and use $page->add() to create new pages.
asucarl replied on at Permalink Reply
asucarl
Yeah, that's what I ended up doing.