Insert article into an confirmation email

Insert article content into a ChronoForms confirmation email.

Overview

The issue occurs when using outdated code to fetch article text, causing the variable to not be saved or appear in the email.
Update the code to the current version, then reference the new variable in the email template using the correct placeholder.

Answered
hu huubs 18 Mar, 2016
Hello,

I saw this post: http://www.chronoengine.com/forums/posts/f2/t20555.html which explains how to insert article text into a variable so you can use it anywhere in the form. But I've used this code but it's not working. I used the debugger and the article_text variable just doesn't come up, it looks like it's not saved at all. Maybe is the code outdated?
Gr GreyHead 18 Mar, 2016
Answer
Hi Huubs,

It's a bit out of date - only five years old. Please try this version, there are a few small changes
?php
$query = "
  SELECT CONCAT(`introtext`, '<br />', `fulltext`) AS `article_text`
    FROM `#__content`
    WHERE `id` = XXX ;
";
$db = \JFactory::getDBO();
$db->setQuery($query);
$article_text = $db->loadResult();
$form->data['article_text'] = $article_text; 
?>
Then use {article_text} in the email template.

Bob
hu huubs 19 Mar, 2016

Hi Huubs,

It's a bit out of date - only five years old. Please try this version, there are a few small changes

?php
$query = "
  SELECT CONCAT(`introtext`, '<br />', `fulltext`) AS `article_text`
    FROM `#__content`
    WHERE `id` = XXX ;
";
$db = \JFactory::getDBO();
$db->setQuery($query);
$article_text = $db->loadResult();
$form->data['article_text'] =$article_text; 
?>
Then use {article_text} in the email template.

Bob



Awesome as always.Thank you!
This topic is locked and no more replies can be posted.