Using placeholders
A place holder is a word in square brackets, for example,
[FIRSTNAME]
or
[UNSUBSCRIBE]
which will be replaced with real data, such as the subscriber's name or a unique URL during sending.
Placeholders in phpList
There are three types of placeholder in phpList:
- System e.g. [UNSUBSCRIBE]
- Config e.g. [WEBSITE]
- Attribute e.g. [FIRSTNAME]
In this chapter we will deal with the Attribute placeholders only. We will deal with system and config placeholders in the templating and configuration chapters respectively.
Where to find a list of Attribute placeholders
When composing a campaign, you can find a list of placeholders by clicking on the information symbol (the question mark) "?" next to the text Compose Message.
Any Attribute placeholders will be listed here along with instructions on how to use them.
These are generated directly from your chosen Attributes so if you wish to edit them, please see the Attributes chapter.
How to use a placeholder in a mail
To use a placeholder, you need to type it exactly as suggested in the information, i, box. This will include:
- an open square bracket
- the placeholder name (in Capitals, with spaces)
- and a close square bracket
It is also wise to use some fallback words, that is words that will be inserted in place of the data when the data is missing. You can indicate the fallback words with the double percent sign %%. Anything before the %% is the attribute placeholder. Everything after the %% is the fallback text. The fallback text is optional.
In this example, the placeholder would either print the subscribers' first name, and where the name is not known, it will print the word Friends.
It is important that you test your placeholder before you send your mail, as mistakes are ugly and disconcerting for your subscribers.
Set up two test accounts
To test your placeholder effectively you will need:
- one subscriber profile suitable for testing the attribute placeholder. You can use an alternative email to which you have access, where the attribute data is completed
- another subscriber using an email you have access to, where the attribute data is not completed.
You may need to add these emails or edit your existing data to achieve this. You can do all these things from the Search > Search Subscribers page.
In the example below I have subscribed myself to the system using my personal email (rather than my work email) and I have filled out my name.
And I have another one using my old email address where the attribute data has not been provided.
Send a test message
Next, enter the two test emails into the Send Test box at the bottom of your campaign Content page and press Send Test. You may need to confirm the emails if it is the first time you have used them.
Check the results
For the subscriber where the attribute related to the placeholder has data, you should see that data in the email. In this example you can see the name Anna is visible in the place of [FIRST NAME]
Where the subscriber has no data for the attribute, you should see the Fallback Text. In this example that is the word Friends.
You can now send your campaign as usual.
Documentation wiki
For additional documentation, you can visit the wiki page.