First of all, great component, donation on its way🙂
Is it possible to have the page title from which the form was sent as the e-mail subject?
Thank you in advance
Hi orsat,
Assuming that the other three fields are completed, please just put something - 'XXX' will do - in the Subject field on the General tab. The other code snippet will (I hope) overwrite this before the email is sent.
Bob
OK, the page title is being send as the email subject, however the email subject displays the global site title, not the article title.
The reason I need this is that I have a site with many excursions, tours and accommodation offers. Ideally what I would like to do is to get the article title as the e-mail subject (that way the mail administrator knowns what department to forward the email to) and also display the article title at the beginning of the form when a visitor clicks on the link for booking the tour.
Example:
Requested tour: Article title
Name...
E-mail...
Comments..
By the way, I installed the plugin and tried to call it within a excursion offer page, but I still only get the global site title as the email subject.
Could you please provide more assistance how to achieve this.
Thanks in advance...
P.S I might have some custom work for you guys, a client needs a special component dealing with XML files, what is the best way to contact you on that matter?
Hi Orsat,
you can use this query to get you the current content item title :
<?php
$database->setQuery( "
SELECT title
FROM #__content
WHERE id='".$_GET['id']."'" );
$title = $database->loadResult();
?>
put this code at the top of the HTML box and later you can use Bob's hack and just replace the $mainframe->getPageTitle() with $title and thats will do it!
If you ever got some contract work then you can post details at the "paid services forum" here, if you dont like to post the details then post a request and somebody will give a reply about the best method of contact🙂
Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Orsat,
Actually you should put this in the "onsubmit before email" :
<?php
$database->setQuery( "SELECT title FROM #__content WHERE id='".$_GET['id']."'" );
$title = $database->loadResult();
//put the article title in the email subject
$rows[0]->emailsubject = $title;
?>
Cheers
Max<br><br>Post edited by: GreyHead, at: 2007/12/01 13:30Hi Orsat,
Actually you should put this in the "onsubmit before email" :
<?php
$database->setQuery( "SELECT title FROM #__content WHERE id='".$_GET['id']."'" );
$title = $database->loadResult();
//put the article title in the email subject
$rows[0]->emailsubject = $title;
?>
Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Just purchased 2 licenses, I just need one so consider the second license to be the donation I promised🙂
The code for displaying and sending the article title works just fine when the form is published within the article (via the plugin).
Now to the new challenge🙂)
What I really need is to have only a link somewhere within the article pointing to the reservation form, the form should open in a new window and the article title should be displayed as the first line in the form and, when submitted, the article title should be the e-mail title.
The code above doesn´t work if I call the form from a link.
Any help is GREATLY appreciated.
Hi orsat,
On Max's behalf - thanks for buying the licenses.
Should be straightforward to set up the links you want. You could do it with just a text link using the $_GET array to pass the variables from a link like <!-- w --><a class="postlink" href="http://www.mysite.com?link_from=article_title">www.mysite.com?link_from=article_title</a><!-- w --> but I think you'd get more functionality from using a full form. So . . .
Set up a ChronoForms form with a hidden field called link_from with the value set to the article title and a submit button that you customise to suit your article. (You can have this saved to the database if you want to be able to track click-throughs in which case you'd probably want to add a hidden id field.) Build a little custom redirect code for the OnSubmit code box to call the second form and pass the key data over.
Embed this into your article page.
Now create your full form including the code in the form html to pull up the article title. I'd probably save the data into the database and just pass the id to allow it to be read into the second form.
Is this sketch enough or does the form code need to be spelt out in more detail?
Bob
Hi Orsat,
Thank you very much, so at the last code posted by Bob, we will edit it so its only one line for our case here :
<input name="subject" type="text" size="40"
value="<?php echo $_GET['subject']; ?>" />
and assuming that the link to the form has contained a variable at the end called : subject=this_is_the_subject
please try it and 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.
Hello people,
this project I worked on, was degraded to 'not so important', so I could not test this until now.
What should I say? It works! Thx for the support, will buy (respectively the company I work for) a license the next days ...
Hi minimalniemand,
Thanks and good luck.
Bob
Hi Bob
I've read through this thread and it seems to address my needs exactly - get the title of the page an email form is embedded (with Chronocontact plugin) in and give that title as the subject of the email.
Problem is I am a complete code noob - haven't written code since 1985 and my understanding of serious html etc coding is rudimentary at best. I tried using Orsat's code and got an error when I loaded the article. I put the form one just above the tags for the captcha I'm using.
Can you give me code snippets and very clear instructions on where to put them to accomplish the objective?
While I'm here... how can I edit the form - to add a comments field? I have only visitors name and email now?
Thanks
Hi Colinan,
Do you still need this?
You can edit the Form HTML from the Form Editor | Form Code tab.
Bob
Hi all,
Well, the solution described in this thread is working very well in Joomla 1.5. Now I am on the quest to make this work with Joomla 1.7 as well, will start testing today but would appreciate any feedback as to the possible code changes needed. I know that the "Get age title" in Joomla 1.7 is different.
Since it appears that there are several people who need this I thought that we could discuss it here🙂
The idea is simple (I use this to offer tours and other services booking for a travel agency), use the pdf, e-mail or print buttons in Joomla articles to display the link to the form (that way you can turn them on and off easily through article administration), upon clicking the link to the form the form is displayed with the page title inserted into the first inputbox automaticaly. Also the page title should automaticaly also be send as the e-mail subject.
Note: I plan to do this for regular articles, as well as for K2 articles.
Form is pretty basic
1. Selected tour (page title automatically inserted here)
2. Name and Surname
3. Customer info
4. Date picker (arrival)
5. Date picker (departure)
Anyway, all input and ideas are appreciated..
Lets see some code... 🙂
Hi Orsat,
Have you got this working now?
Bob
Hi GreyHead,
Did not have the time to test as having 2 kids and preparing for Christmas does not leave much space for work🙂
I am planing to dive into this as soon as possible, if you have any suggestions would be great, as I sad, for people who need a simple booking/inquiry solution this is perfect because if you can live without having a "create PDF" icon within the joomla article you can easily have a link pointing to the booking form and the page title tells you what service the customer is interested in.
Anyway, will post of progress as soon as I have tested this...
Regards,
Orsat