Smarty TrimWhiteSpace Output filter

This is only really useful if you are not using smartoptizer or some other frontend optimizer which minifies html.



It is ideal for use if you use just an op-code cacher such as XCache or APC.



It simply loads the Smarty Trimwhitespace filter which removes the excess blank lines and spaces only (so will not effect the markup or code). It will help to reduce html size a bit and cpu usage is so small it is hard to measure.



in cscart/core/class.templater.php

add the following line in the function:

display($tpl, $to_screen=true)



find the line:

if ($to_screen==true)

add this line:

$this->load_filter(‘output’, ‘trimwhitespace’);



you will need to clean the cache.





Beware though this may cause a conflict when upgrading in future.

Does any one have any experience with this, if so is there a cleaner way of adding this filter (so as not cause conflict on future cart upgrades)?

Make it a “tweak” in config.local.php and then make the load_filter conditional upon it being true.