0

Preface:

I recently inherited a website project that my employer had summer interns create. Being non-technical types, they opted for Joomla CMS to create the content. They also opted to make all of the current content static, and to manage updates manually, article by article (these were high school interns with little/no technical background).

As part of my takeover, one of my first goals is to get all of the volatile data (company information, event information, etc) into MySQL, and then load the content into the articles dynamically. Joomla already has a MySQL database; I've added a table to it, storing the frontend content I want to load dynamically, and now I want to make one of my articles pull from that table, row by row, and spit out some HTML to format it. To my knowledge, the easiest way to do this is to use PHP to embed SQL queries (if I'm wrong about that, feel free to suggest alternate dynamic content models in Joomla!), and so the logical first step is to get some PHP embedded in an article.

Problem:

I have tried using the Sourcerer and DirectPHP extensions, but in both cases (and with manually inserted PHP code), I find that the PHP is getting ignored. For example, I made an article with nothing but this:

<?php
  echo "This is a PHP string";
?>

And when I load the article, it is empty. I've scanned the settings and configuration pages of the Joomla install and done a number of Google searches, and thus far haven't been able to find anything. I bet I'm missing something pretty simple, but I don't know what. Any suggestions?

2
  • Unless I'm mistaken, Joomla stores its content in MySQL anyway. Aug 11, 2011 at 14:23
  • That's correct, but I'm referring to pulling content from a specific table to dynamically generate the content of a page (i.e. an HTML table where the rows are rows pulled from the MySQL table). I'll update my question to clarify that.
    – asfallows
    Aug 11, 2011 at 14:34

2 Answers 2

0

You can try Jumi extension. I used it in modules, but should work also inside content.

As an alternative, you can create your custom module (standard HTML or coded with Jumi) and easily include it inside an article with this sintax:

{loadposition position_name}

Here more info: How to include modules in Content item (for Joomla 1.5.x)

0

If you write your code in "Source Mode" directphp not work. write your code in the WYSIWYG window

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.