Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Using MetaMod to display information...
Using MetaMod to display information from a database table
Using MetaMod to display information from a database table
Not sure if this is possible, I'm wanting to display information from a table in the joomla database into a module position. The table is a custom table that is populated from a component.
i.e.
New table in the Joomla DB called
xyz_new_table
with the following 5 columns
ID some_info a_number an_other_number et_c
1 2012-10-01 123 112332145 2
2 2012-10-05 124 321466541 1
I want to display ID 2's information in a custom styled table within a custom HTML module or article.
Is this possible? If so what would an example recipe be?
Re: Using MetaMod to display information from a database table
Hi Raymond,
in this case you could use MetaMod to simply display HTML via the PHP code in the module. Normally MetaMod uses its PHP code to determine whether or not to show a different module, but it's fine for this purpose too.
Here's some very basic PHP to place into the PHP box in MetaMod. You may wish to change the way the HTML code is output, and that's up to you.
$query = "select * from xyz_new_table where ID = 2";
$db->setQuery($query);
$result = $db->loadObject();
if ($result) {
echo '<table><tr>';
echo '<td>' . $result->some_info . '</td>';
echo '<td>' . $result->a_number . '</td>';
echo '<td>' . $result->an_other_number . '</td>';
echo '</tr></table>';
}
In order to embed this in an article, you could use the {loadposition} operator and plugin to load the MetaMod into the article.
Best regards,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Using MetaMod to display information...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7642
- Newest User:
- mary26
- Members Online:
- 0
- Guests Online:
- 194
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked