Altijd leuk, Kerstwereld bij @Kampeerwereld Hendriks. Maar toch benieuwd wat deze boomstam zou doen met batterijen? http://t.co/NEkG5qCYQt

BcAWG7sIgAEi8BU

Post to Twitter

Comments No Comments »

We hebben nog steeds een #devops #linux #php #vacature open staan! Locatie #zeewolde, #flevoland exa.nl/vacatures

Post to Twitter

Comments 1 Comment »

Jeeh! v4.4 #android #Nexus5 cc: @mvdvlies @adebree

Post to Twitter

Comments 2 Comments »

Look what I got today in the mail! My @ubnt certificate and shirt! http://t.co/jGS0bk956G

BaKuBWHIIAEbQLw

Post to Twitter

Comments No Comments »

Wat een asociale prijzen vragen die #werving & #selectie buro’s. Voor kleine bedrijven niet te doen! Zelf ook maar zo’n buro starten 🙂

Post to Twitter

Comments 1 Comment »

Just passed my @ubnt AirMAX Certification! From what I’ve heard, the first in the Netherlands!

Post to Twitter

Comments 1 Comment »

Nieuw: CSI Zeewolde! http://t.co/q7tSF70vx4

BJ6u42YCIAEFX8t

Post to Twitter

Post to Twitter

Comments No Comments »

Oeh. Lastig plekje uitzoeken 🙂 http://t.co/H8LsqOF5JY

BGCot-VCUAA7_5j

Post to Twitter

Comments No Comments »

Zonne grote sneeuwbal jonguh! http://t.co/4qHedJHEmj

BD-E2cwCQAEKOY-

Post to Twitter

Comments No Comments »

Since a few months I’ve been using WHMCS for all invoicing for my company Exa-Omicron. I’ve altered the standard email templates, but there was one thing that would not work very nicely and the richtext editor is causing problems.

I wanted to use foreach loops in the email templates to loop over all the invoice items. This way the customer can see all the invoice line items in the email instead of opening the PDF. By using a table for the invoice items, I made the email look almost exactly the same as the invoice PDF. So for example:

<p><strong>Invoice Items</strong></p>

<table style=”border-collapse: collapse;”>
<tbody><tr style=”background-color: #000; color: #fff”><td style=”border: 1px solid black;”>Description</td><td align=”right” style=”border: 1px solid black;”>Total</td></tr>

{foreach from=$invoice_items item=invline}

<tr><td style=”border: 1px solid black;”>{$invline.description}</td><td align=”right” style=”border: 1px solid black;”>{$invline.amount}</td></tr>

{/foreach}

<tr><td align=”right”>Subtotal</td><td align=”right”><strong>{$invoice_subtotal}<strong></strong></strong></td></tr>
<tr><td align=”right”>{$invoice_tax_rate} VAT</td><td align=”right”>{$invoice_tax}</td></tr>
<tr><td align=”right”><strong>Total</strong></td><td align=”right” style=”border-top: 1px solid black;”><strong>{$invoice_total}</strong></td></tr>
</tbody></table>

But when reopening the email template, the richtext editor does not understand the Smarty template elements like foreach. The richtext editor tries to correct the HTML and moves the foreach lines outside of the <table> tags. but this makes the whole email template unusable, because it will not generate correct HTML anymore. My html knowledge is good enough to write templates without a richtext editor, so I searched for an option to disable the richtext editor completely. Unfortunately I could not find such an option in WHMCS. So I added a apache rewriteengine rule in the .htaccess file to forward the webrequest from the browser to always disable the richtext editor.

# Always disable richtext editor
RewriteCond %{REQUEST_URI} ^/admin/configemailtemplates.php$
RewriteCond %{QUERY_STRING} ^action=edit&id=([0-9]+)$
RewriteRule .* ./admin/configemailtemplates.php?action=edit&id=%1&noeditor=1 [L]

So when the browser requests the url /admin/configemailtemplates.php and the query string only holds a action = edit and a numeric id, then the browser is redirected to the exactl same URI, but with a &noeditor=1 added to the query string.

And this solved all my ‘richtext editor tries to correct html’ issues 🙂

Post to Twitter

Comments No Comments »