Page 1 of 1
Change HTML 'title' of a page with the contacts form depending on form state?
Posted: Thu Aug 16, 2007 6:43 pm
by Russ
Is there an easy way to change the HTML 'title' of a page with the contacts form in it, depending on the form state?
eg for normal title ='Conact us'
on error title='Contact Form Error'
on sent title='Contact email sent'
Re: Change HTML 'title' of a page with the contacts form depending on form state
Posted: Fri Aug 17, 2007 1:11 pm
by cyberman
It's a little bit tricky, but it works
1. Open function.contact_form.php with your favourite editor
2. Add after line 24
Code: Select all
$ctitle = array("Contact Form Error", "Contact email sent");
3. Add after line 88
Code: Select all
$smarty->assign_by_ref('contacttitle', $ctitle[0]);
4. Add after line 91
Code: Select all
$smarty->assign_by_ref('contacttitle', $ctitle[1]);
5. Create a copy of your current template and go to edit mode
6. Add directly after
7. Change
to
Code: Select all
<title>{if $contacttitle != ''}{$contacttitle}{else}{title}{/if}</title>
8. Attach this template to your contact form page
9. Have fun

...
Re: Change HTML 'title' of a page with the contacts form depending on form state
Posted: Fri Aug 17, 2007 6:07 pm
by Russ
Thank you very much cyberman, that seems to work just fine. i had been playing with something like this but could not get it quite right, so your help is much appreciated!
I really must get into Smarty a bit more
It makes for a much more accessible form don't you think?
Russ