Forums

Add Joomla Article Title and Link in ChronoForm Email

Schallah 15 Sep, 2011
Hey,
I have bought ChronoForms today! Great work it is very good.

So here my problem. I have Joomla 1.7 and the newest ChronoForms.

Now I have made a Joomla Module with the help of this Forum (http://www.chronoengine.com/forums.html?cont=posts&f=5&t=18483&start=15&hilit=article+form).
<?php
    $article_id = JRequest::getInt('id', 0, 'get');
    $title = '';
    if ( $article_id ) {
        $db =& JFactory::getDBO();
        $query = "
        SELECT `title`
         FROM `#__content`
         WHERE `id` = ".$db->quote($article_id)." ;
        ";
        $db->setQuery($query);
        $title = $db->loadResult();
    }
?>

<?php 
    $url =& JURI::getInstance();
    // $url->toString();
?>
  <center><a href='index.php?option=com_chronoforms&chronoform=Anfrage-de&title=<?php echo $title; ?>&url=<?php echo $url; ?>' ><?php echo $title; ?></a>
  <a href='index.php?option=com_chronoforms&chronoform=Anfrage-de&title=<?php echo $title; ?>&url=<?php echo $url; ?>' ><img src="images/icons_64x64/apps/email.png" border="0" alt="" /></a>   <br>
  Hier können Sie bei Interesse unser Anfrageformular ausfüllen!</center>

The Module is working, u can view it there at the right side: ---

Now i have added this code at a Chrone custom code field in the event tab:
    <h2>Anfrage 
<?php
    $title = JRequest::getString('title', '', 'get');
    // echo $title;
?>

<?php 
    $url = JRequest::getString('url', '', 'get');
    $view = JRequest::getString('view', '', 'get');
    $id = JRequest::getString('id', '', 'get');
    $catid = JRequest::getString('catid', '', 'get');
    $Itemid = JRequest::getString('Itemid', '', 'get');
    $lang = JRequest::getString('lang', '', 'get');

?>    
    <a href='index.php?option=com_content&view=<?php echo $view; ?>&id=<?php echo $id; ?>&catid=<?php echo $catid; ?>&Itemid=<?php echo $Itemid; ?>&lang=<?php echo $lang; ?>' ><?php echo $title; ?></a>
    </h2> 

But this code get ignored. It is the same in the controller mode and in the view mode.
When i put this code not over the wizzard the result is like i want it:
Betreff:  Gebrauchte Maschine 3

Link:  ----

But when I add the code manually I must add the code every time if I edit the form in the wizzard. How can I add this code in the wizzard that it will work.
GreyHead 16 Sep, 2011
Hi Schallah ,

I'm not quite clear what is happening here but one problem is that the Title is not url encoded so you get an invalid link created.

<a href="index.php?option=com_chronoforms&chronoform=Anfrage-de&title=Gebrauchte Maschine 3&url=http://echle-hartstahl.de/echle-hartstahl/index.php?option=com_content&view=article&id=77:gebrauchte-maschine-3-de&catid=86&Itemid=483&lang=de">



You might be better passing this information in the User Session using the 'Data to Session' and 'Session to Data' actions.

Bob
Schallah 18 Sep, 2011
Hi Bob,
thank u for your fast reply!

I am not an programmer and i dont know what u mean with "Data to Session" and "Session to Data" actions.

Can u post an code example for this? So i can test it in my installation.

Thank u and bye,
Schallah
GreyHead 19 Sep, 2011
Hi Schallah,

In ChronoForms v4 there are two actions in the Session Data group that let you save your form data to the User Session and recover it back from the User Session later. This allows you to save data between forms if you need to.

There isn't much coding required. What is saved is the current contents of the $form->data array and it it restored back into the same array.

Bob
Schallah 20 Sep, 2011
Hi Bob,
thank u for your response!

I have tried your tipps but I dont understand you. The Session to Data function is clear, but how can I use this to get the link and the article name from Joomla where the request form is clicked on. I dont want to save data and use it in multiple forms.
I want a form with the link and the title.
Can u give me a step by step how-to?
GreyHead 21 Sep, 2011
Hi Schallah,

Sorry, I thought you were trying to pass information from one form to another.

If you want to get the information from the calling URL then the JRequest code you have should work OK. I just ran a test and it seems to be good.

Bob
This topic is locked and no more replies can be posted.