PHP code inside a catalog template

More
7 months 3 weeks ago #7174 by Bart
We used to use a PHP code into the catalog template section of a database.
After migrating to Joomla 4 the PHP code is not recognized correctly.

The PHP code is similar to this
<?php
$db = JFactory::getDBO();
$user = JFactory::getUser();
$uemail=$user->email;
$uid=$user->id;
if ($uid =! 920 AND $uid =! 919) {
$db->setQuery("SELECT `Feedback` FROM `Attestati2023` WHERE `userid`='".$uid."'");
$result = $db->loadResult();
if ($result == 1) {
print "Contents for registered members.";
header("location: /attestati-2023");}
if ($result == null) {
print "Contents for registered members.";
header("location: /attestati-2023");}
}
?>

But after the first occurrence of the character > Joodb consider the PHP code as normal text and present it in the catalog template.

Could you please advise?

Please Log in to join the conversation.

More
7 months 3 weeks ago #7175 by Dirk
Replied by Dirk on topic PHP code inside a catalog template
You need a content plugin in order to execute PHP in html!

www.joomlashack.com/blog/joomla/use-java...in-a-joomla-article/

Please Log in to join the conversation.

More
7 months 3 weeks ago #7176 by Bart
Replied by Bart on topic PHP code inside a catalog template
I'm sorry.
I forgot to install the plugin in Joomla4.
Thank you for your quick answer.

Please Log in to join the conversation.

Moderators: Dirkjoest