Please read and follow the COMMON ISSUES first!
Always add your version information in every new post! Thank you!

Form2Content Forum

Questions and answers for Form2Content, a Joomla CCK.
  1. moreno
  2. F2C article templating
  3. Friday, 28 February 2020
  4.  Subscribe via email
Hi,
I have a php function in the template, that allows me to get data from the database.
The function I created works perfectly, but with the tag {php}{/php} it is executed instantly and the result is written in the article, instead I need the function as result.
Is it possible to this function generate the result every time I reload the page?
This is the function:
{php}
$db = & JFactory::getDBO();
$query="SELECT * FROM `res_f2c_fieldcontent` WHERE fieldid = 49";
$db->setQuery($query) ;
$res= $db->loadResult();
echo $res;
{/php}

PHP 7.1.33
Joomla! 3.9.15
Form2Content Pro v 6.17.4
Responses (1)
Accepted Answer Pending Moderation
Hi Moreno,

When you use functions inside the template, the result gets hard-coded in the template the moment it is generated.

When you want to execute a function on every page load, then you're looking for a Joomla plug-in.
This is something that you can create yourself. The Joomla documentation has examples on how to do this.

best,
Julien
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.