Hi Folks ๐
I have a chrono form within an article.
I wish to have the โhostโ article title as a hidden dynamic subject field.
Please can anyone tell me if this is possible and give me some advice on how to do it?
Best wishes,
Trev
Should I edit the form code to add the hidden field?
I donโt know the php code to grab the article title.
Hi Trev,
I think that it's probably possible, there is an article object you can access and that the article title is one of the parameters in the object.
It may also be possible to use the ItemId to access the info - I think there has been some recent discussion about that in the forums here.
Bob
Thanks for the quick reply Bob ๐
I was searching the forum for help prior to posting; I couldnโt seem to find a solution that I could understand. I'm not very bright ๐คฃ
I am assuming that for my page to be displayed the main Joomla DB has already been queried to produce a report. ie my section blog
I thought it would just be a case of adding the hidden field to the form html code
Then adding something like
<? Echo โtitle WHERE title = '$title '"; ?>
to get the value.
I hope I have explained this right
Trev
Hi trevzo,
Well yes, that's pretty much correct. Unfortunately there isn't a variable called $title that you can use. But there might be one that's called something like $this->article->params->title. You just need to find out exactly what it is called.
Bob
Hi,
earlier I couldn't find any way to get this except by making a query to the content table using the id variable coming to the page, if somebody can get it any other way then let me know!๐
Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Mmm, was affraid that it would be something like that...
Could you share the query syntax, I'm not such a coder :wink:
Thanks!
Cheers,
Dustdog
Sure!๐
$database =& JFactory::getDBO();
$query = "SELECT * FROM #__content WHERE id='".JRequest::getVar('id')."'";
$database->setQuery( $query );
$article = $database->loadObject();
echo $article->title;
Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Works perfectly!! ๐
Thanks Max!!
Cheers,
Dustdog
Sorry,
were i have to insert this code?
Thanks
Hi novcento,
It depends what you want to do - I think there it was being used in the Form HTML to set the value of a hidden field.
Bob
Thanks for the answers, i miss the "Form HTML"๐