Adding Link Detail in Email

 Friday, February 8th, 2008
Mods Compatibility
IndexU 5.4.X
IndexU Deluxe
??

Adding the exact detail URL in IndexU email is a little bit tricky. The <%$detail_page_url%> is only available in the HTML template but not in the email template, so we can not use it. Of course for detail URL we can use something like this : <%$site_url%>/detail.php?id=<%$link_id%>, but this is not what we want. We need the search engine friendly detail URL based on the mod_rewrite setting.

We found two ways on how to achieve this.
1. By customizing the IndexU core PHP script (add.php, link_validate.php, etc).
2. By customizing the email templates.

We do not use the 1st method since there will be too much changes in core IndexU script, and it is something we try to avoid. Fortunately, there's an alternative way by customizing the email templates (*.mail) files directly.

The email template in IndexU is a smarty template, same as their HTML template, which means we can use all the power of smarty there.
For this case, we will use the smarty capability to run PHP block code.
So, for detail URL here is how we do it in our 'approved.mail' template :

Content visible to member only. Please register or login first.

Not a pretty code indeed, but it is working without affecting IndexU core files :)
You can use the above code in any other email templates, as long as it is passing the 'link_id' variables.

Related Mods
- Adding All Categories in Email

Leave a Reply