1

I'm building a tool to import content for various languages. It makes copies of existing items such as menus, articles, modules, etc. that have language specific content.

For example, when copying an article, I use the following to load the content table:

$contentSrcTbl = JTable::getInstance('Content', 'JTable', array());
$contentSrcTbl->load(array('alias' => $article['alias']));

I have the table names for menus, articles, and modules, but can't seem to find a list of tables names to use in the getInstance call. At the moment, I'm looking for the table name to use for template styles. I've tried:

  • Template
  • Templates
  • Style
  • Styles
  • TemplateStyle
  • TemplatesStyle
  • TemplatesStyles
  • TemplatesTableStyle

The last one is the name of the class in the tables folder under the Templates component.

But none of those return a jtable object, they all return null.

Is there a list showing the table names associated with the core Joomla tables?

If no list, how can I find out what to use for the table name?

Thanks!

1 Answer 1

2
+50

Class name is TemplatesTableStyle. But since it's not a core class, you have to register it:

JLoader::register('TemplatesTableStyle', JPATH_ADMINISTRATOR . '/components/com_templates/tables/style.php');

or include the whole com_templates/tables folder:

JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_templates/tables');

Then this should work:

$table = JTable::getInstance('Style', 'TemplatesTable', array());
2
  • What about the other "core" components, IOW, components included with a Joomla install? Commented Aug 4, 2018 at 19:15
  • Same, if table files are in component directory. Here's a list of core tables that don't need to be registered github.com/joomla/joomla-cms/tree/…
    – Sharky
    Commented Aug 4, 2018 at 22:12

Your Answer

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

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