Skip to content

Instantly share code, notes, and snippets.

@lauroguedes
Last active May 23, 2018 02:36
Show Gist options
  • Select an option

  • Save lauroguedes/bb99b4aa1bb2eafe24fbbd603eddedba to your computer and use it in GitHub Desktop.

Select an option

Save lauroguedes/bb99b4aa1bb2eafe24fbbd603eddedba to your computer and use it in GitHub Desktop.
Consulta para extrair nome e valor de campo extra de um artigo específico do Joomla
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select(array('f.name','fv.value'))
->from($db->quoteName('#__content', 'c'))
->join('INNER', $db->quoteName('#__fields_values', 'fv') . ' ON (' . $db->quoteName('c.id') . ' = ' . $db->quoteName('fv.item_id') . ')')
->join('INNER', $db->quoteName('#__fields', 'f') . ' ON (' . $db->quoteName('fv.field_id') . ' = ' . $db->quoteName('f.id') . ')')
->where($db->quoteName('c.id') . '= <article id>');
$db->setQuery($query);
$data = $db->loadObjectList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment