Best way to include data from a separate database
Permalink
Hi all,
I would like to present some data from another database into some C5.7 pages.
I can see 2 option for this:
1: Build a single page that contains code that connects to the other database, extracts the needed data then prints them in a tabular format.
The only problem with this approach is that I can see that all single_pages are displayed in a "full" page template and I cannot choose a page type/template to use for them (I would prefer Right Sidebar for example, in this case).
2: Build a regular page and use the free HTML+PHP Code Block that allows adding php in regular C5 pages.
Then, to keep things separately (but this just a matter of taste I guess), I would create an external .php file with my code and have just an include statement in the HTML_PHP Code Block.
Any thoughts on which is best or if there is another way to do it?
Thanks!
I would like to present some data from another database into some C5.7 pages.
I can see 2 option for this:
1: Build a single page that contains code that connects to the other database, extracts the needed data then prints them in a tabular format.
The only problem with this approach is that I can see that all single_pages are displayed in a "full" page template and I cannot choose a page type/template to use for them (I would prefer Right Sidebar for example, in this case).
2: Build a regular page and use the free HTML+PHP Code Block that allows adding php in regular C5 pages.
Then, to keep things separately (but this just a matter of taste I guess), I would create an external .php file with my code and have just an include statement in the HTML_PHP Code Block.
Any thoughts on which is best or if there is another way to do it?
Thanks!
3. create a pagetype and put your html block there, or hardcode it in a template
Hello,
Actually single pages uses the view.php file from your theme as default, not full.php. Make sure you do have a view.php file.
Once you do that, one way to do it is to add an attribute to your page, probably a checkbox, and to test for the presence of that attribute in your view.php. If the attribute is checked, do your stuff.
Actually single pages uses the view.php file from your theme as default, not full.php. Make sure you do have a view.php file.
Once you do that, one way to do it is to add an attribute to your page, probably a checkbox, and to test for the presence of that attribute in your view.php. If the attribute is checked, do your stuff.