Change HTML 'title' of a page with the contacts form depending on form state?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm

Change HTML 'title' of a page with the contacts form depending on form state?

Post 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'
cyberman

Re: Change HTML 'title' of a page with the contacts form depending on form state

Post 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

Code: Select all

{content assign='contactcheck'}
7. Change

Code: Select all

<title>{title}</title>
to

Code: Select all

<title>{if $contacttitle != ''}{$contacttitle}{else}{title}{/if}</title>
8. Attach this template to your contact form page
9. Have fun  ;) ...
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm

Re: Change HTML 'title' of a page with the contacts form depending on form state

Post 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
Post Reply

Return to “Developers Discussion”