Using field tokens to create a custom URLs in EasyTable Pro
With EasyTable Pro's field options you can combine several fields to produce a custom URL for each record.
This FAQ assumes you know about EasyTable Pro's field tokens, you may want to read this article about the basics of using field tokens for substitution functions.
There are lots of things you can do with URL's you may want a custom text for each click link or you may want to set a subject in an Email link, we'll look at both of these to try and provide you with a base skill set to help you achieve your goals on your website.
For the purposes of this FAQ we're assuming our table has fields with the following names and alias.
| Name | Alias |
| Website URL | website-url |
| Name | name |
| emailfield | |
| Reference Number | reference-number |
Some typical records might be:
| Website URL | Name | Reference Number | |
| http:://google.com | Eric | This e-mail address is being protected from spambots. You need JavaScript enabled to view it | 600613 |
| http://apple.com | Steve | This e-mail address is being protected from spambots. You need JavaScript enabled to view it | 09913 |
A custom link text
Rather than having the raw URL or the same link text for each row (eg. Click Here), a nice presentation might be "Click here to open MyBusiness's Website".
Using the example table and records to achieve this with EasyTable Pro you need to take several steps first:
- set the field "Website URL" to a type of "TEXT" (this prevents EasyTable Pro apply type specific formatting to the field).
- set the field options to the following:
<a href="#website-url#" target="_blank">Click here to open #name#'s Website</a> NB: the target is set to open a new browser window.
Now when EasyTable Pro renders the table any field tokens will be replaced by the values in those fields. With our example table this will product the following HTML:
| EasyTable Pro generated HTML | In Browser Display |
| <a href="http://google.com" target="_blank">Click here to open Eric's Website</a> | Click here to open Eric's Website |
| <a href="http://apple.com" target="_blank">Click here to open Steve's Website</a> | Click here to open Steve's Website |
A mailto: URL
To create a mailto: link, is a similar process, except this time we are adding options to the field with the email address in it.
- set the field "Email" to a type of "TEXT"
- set the field options to the following:
<a href="mailto:#emailfield#?subject=Reference%20Number%20#reference-number#">Click here to send #name# an Email!</a>NB: the %20 is the HTML equivalent to a ' ' ie. a space.
| EasyTable Pro generated HTML | In Browser Display |
| <a href="mailto: This e-mail address is being protected from spambots. You need JavaScript enabled to view it ?subject=Reference%20Number%20#600613">Click here to send Eric an Email!</a> | This e-mail address is being protected from spambots. You need JavaScript enabled to view it |
| <a href="mailto: This e-mail address is being protected from spambots. You need JavaScript enabled to view it ?subject=Reference%20Number%20#09913>Click here to send Steve an Email!</a> | This e-mail address is being protected from spambots. You need JavaScript enabled to view it |
RSForm!Pro is a powerful Joomla! form creator, helping you to create custom forms in minutes. The new product makes form management much easier and gives you the time to handle your clients better.
For only €19.00 how can you go wrong?
( We've used it for years... Shouldn't you? )
