PHP code inside a catalog template
- Bart
- Topic Author
- Offline
Less
More
- Posts: 6
- Thank you received: 0
1 year 1 month ago #7174
by Bart
PHP code inside a catalog template was created 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?
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.
- Dirk
- Offline
Less
More
- Posts: 1222
- Thank you received: 226
1 year 1 month 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/
www.joomlashack.com/blog/joomla/use-java...in-a-joomla-article/
Please Log in to join the conversation.
- Bart
- Topic Author
- Offline
Less
More
- Posts: 6
- Thank you received: 0
1 year 1 month 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.
I forgot to install the plugin in Joomla4.
Thank you for your quick answer.
Please Log in to join the conversation.
Moderators: Dirk, joest