article_title in Joomla 5

hofmannbus 26 Feb, 2025

Hi,

in Chronoforms 7 i have a Form Field with the Site Title. It does not work after Chronoforms 8. 

I suspect that it is due to the PHP query. Does anyone have an idea how I can output an article title in a form field?

In Chronoforms 7 (not work in 8)...

Error in Joomla 5 Frontend > Class "JRequest" not found 

------------

HTML Field: 

<?php    $article_title = '';   

$id = \JRequest::getInt('id', '');   

$article = \JTable::getInstance('content');   

$article->load($id);   

$this->data['article_title'] = $article->get('title');    ?>

----------

Text Field:

Value: article_title

Max_admin 26 Feb, 2025

What about this code:

$app = Joomla\CMS\Factory::getApplication();
$id = $app->input->getInt('id', 0);
$article = Joomla\CMS\Table\Table::getInstance('Content', 'Joomla\CMS\Table');
if ($article->load($id)) {
$articleTitle = $article->title;
}
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
hofmannbus 26 Feb, 2025

Hi May_admin,

thanks for your reply.

Now, no "JRequest" Error, but..

Class "Table" not found

See Attachment...

Bildschirmfoto 2025-02-26 um 15.34.57.png
Max_admin 26 Feb, 2025

Sorry, please replace Table with:

Joomla\CMS\Table\Table

I have updated the code above

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
hofmannbus 26 Feb, 2025

Frontend Error...

 Call to a member function load() on false 

is this variable for the output correct? article_title ?
Bildschirmfoto-2025-02-26-um-16.12.42.jpg
You need to login to be able to post a reply.

VPS & Email Hosting 20% discount
hostinger