2

We are attempting to implement a number of Pardot forms within Craft templates. Since Pardot's form actions do not allow us to dynamically specify a return URL, our best choice is to use the form's URL as the return URL.

Our page is /about/contact. We want one of three things to happen on this page:

  • If the user has an identifying cookie on their machine, display only a comment field, for example
  • If the user does not have a cookie saved, display the complete form
  • If the user is returning from Pardot, set a cookie and display a thank you message.

It's important to us that we maintain pretty URLs, so we have created a route in routes.php:

return array(
  'about/contact' => array('action' => 'pardotForm/ManageForm'),
);

Our contact page is an entry in our Landing Page structure. We've set that entry's slug to be something random so that Craft does not route to the default controller for that entry. It is set to "contact-us-page".

We would like to maintain the actual slug on the contact page as "contact" so that we can use slug features in normal ways.

Is there any possible way to maintain our slug as "contact", our url as "about/contact", and still route to our 'pardotForm/ManageForm' action?

2

The easiest way to solve this, would be to use a template hook instead, and put all your PHP code in there.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.