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
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.
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
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
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
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,
I also tried this. I got it to work somehow with this in a hidden field:
But my problem is that the article-title isn't shown but the category title... I guess it's not a Chronoforms-thing, but I didn't where tot post such a specific problem.
BTW, when I try to implement
Maybe someone has a brilliant solution? :?
Dustdog
I also tried this. I got it to work somehow with this in a hidden field:
<?php
$mydoc =& JFactory::getDocument();
$mytitle = $mydoc->$params->get('title');
echo $mytitle;
?>
But my problem is that the article-title isn't shown but the category title... I guess it's not a Chronoforms-thing, but I didn't where tot post such a specific problem.
BTW, when I try to implement
$this->article->params->title
I get the obvious error because the form is linked through the plugin and is not a part of the article itself.Maybe someone has a brilliant solution? :?
Dustdog
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
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
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
Could you share the query syntax, I'm not such a coder :wink:
Thanks!
Cheers,
Dustdog
Sure!๐
Regards
Max
$database =& JFactory::getDBO();
$query = "SELECT * FROM #__content WHERE id='".JRequest::getVar('id')."'";
$database->setQuery( $query );
$article = $database->loadObject();
echo $article->title;
Regards
Max
Just put in the beginning of your formcode like I used it for a hidden field:
It should do the trick.
Cheers,
Dustdog
<table width="500" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="200" valign="top">Vacature-naam</td>
<td valign="top">
<?php
$database =& JFactory::getDBO();
$query = "SELECT * FROM #__content WHERE id='".JRequest::getVar('id')."'";
$database->setQuery( $query );
$article = $database->loadObject();
echo $article->title;
?>
<input type="hidden" name="vacature" value="<?php echo $article->title; ?>" />
</td>
</tr>
</table>
It should do the trick.
Cheers,
Dustdog
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
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
This topic is locked and no more replies can be posted.