How to build a smart Contact Us module?
Smart in what way, you can ask... Simple: to let you know, in which page of the site the user filled it and send it to you! Why? you never get a criptyc message from your clients you wasn't able to find out what they are referring to?
So, let's be clear - this is not a beginner's guide for Joomla programming, it's a Joomla Tips site, hopefully you are already past of this phase. Let's see how we can collect and append the needed info!
Is simple: Let's say, you have everything built, have a way to display the form, collect the data and mail it to you. And you use the $message variable to hold what the user typed into the message box.
All you have to do to add this code in the proper place:
$doc = JFactory::getDocument(); $page_title = $doc->getTitle(); $uri = JFactory::getURI(); $absolute_url = $uri->toString(); $linkback="<hr /><a href="/$absolute_url">$page_title</a>"; $message=$message.$linkback;
As the result at the message's end you will have the page title from where the module was filled, linked to the respective page. Simple enough?