I'm working on an HTML email template in iTop where I'm using placeholders for hyperlinks, such as: $this->hyperlink()$
$this->html(hyperlink('portal'))$
I want to display these hyperlinks as buttons instead of plain URLs. However, in the email preview, these placeholders are rendering as raw URLs instead of proper clickable buttons.
Expected Behavior:
"Customer: View Ticket Status" should appear as a blue button that redirects to the ticket URL.
"SupportAgent: View Ticket Status" should appear as a red button with a different link.
I have the same issue and ended up giving just the ticket reference, I think the twig templating is performing some kind of escaping which is leading to the breaking
I'm also in need to solution
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using $this->html(hyperlink('portal'))$ is a bad practice and won't give anyting good. You should either:
- Use $this->hyperlink('portal')$ if you want an HTML hyperlink (<a>tag)
- Use $this->url('portal')$ if you want the raw URL so you can use it in your own HTML markup (e.g. button styled elements)
Hope it helps,
Guillaume
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello iTop Community,
I'm working on an HTML email template in iTop where I'm using placeholders for hyperlinks, such as:
$this->hyperlink()$
$this->html(hyperlink('portal'))$
I want to display these hyperlinks as buttons instead of plain URLs. However, in the email preview, these placeholders are rendering as raw URLs instead of proper clickable buttons.
Expected Behavior:
"Customer: View Ticket Status" should appear as a blue button that redirects to the ticket URL.
"SupportAgent: View Ticket Status" should appear as a red button with a different link.
Current HTML Code in iTop Email Template:
Issue:
Instead of rendering as a button, the placeholders are showing as raw URLs in the email.
Clicking them does not apply the CSS styling correctly.
Question:
How can I correctly format these placeholders so that they render as proper buttons with hyperlinks instead of just raw URLs?
Any suggestions or best practices would be appreciated! 🚀
Thanks in advance!
++
Snap reference of Issue facing
Last edit: Sunilkumar 2025-01-31
++1
I have the same issue and ended up giving just the ticket reference, I think the twig templating is performing some kind of escaping which is leading to the breaking
I'm also in need to solution
Hello,
Using
$this->html(hyperlink('portal'))$
is a bad practice and won't give anyting good. You should either:- Use
$this->hyperlink('portal')$
if you want an HTML hyperlink (<a>
tag)- Use
$this->url('portal')$
if you want the raw URL so you can use it in your own HTML markup (e.g. button styled elements)Hope it helps,
Guillaume
Hi Molkobain
Thanks for your suggestion. It is working as expected..!
Glad to see it helped! :)
Take care,
Guillaume