Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

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?

raymondswart
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5910
Total Posts Today:
1
User Info:
 
Total Users:
10152
Newest User:
kasautiizindagiikay
Members Online:
0
Guests Online:
288

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