Dragonfly CMS v9 ⇒ Themes v9 ⇒ Support for SMARTY Comments in Templates ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexThemes v9

Support for SMARTY Comments in Templates Reply to topic


SMARTY Comments are comments in the template system which do not get output to the browser, and thus do not show in View Source, or consume user bandwidth.

SMARTY Comments are useful for making notes, giving directions on editing the template, recording code credits, and hiding alternate versions of the template HTML, etc.

Format of SMARTY comments is:
{* this is a comment *}
- those are "curly braces"
- citation: www.smarty.net/docsv2/...sic.syntax

To provide support for SMARTY Comments (all versions), at line 41 insert these 4 lines (3 + a blank):
// Lose all SMARTY Comments eg. {* this is a comment *) // as we do not want them displayed - layingback $code = preg_replace('#\{\*(.*?)\*\}#s', '', $code);
Reminder: Compiled versions of existing templates may be cached.

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


Which file do i add line to??

"To provide support for SMARTY Comments (all versions), at line 41 insert these 4 lines (3 + a blank):"

Thank you

Dragonfly 9.4 Running on PHP 7.x + MariaDB

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
PHP Version 7.0.6 + MariaDB + Dragonfly 9.4 Modified


Sorry, includes/classes/template_enc.php

The patch was for Nano to include in DF10. We can't depend on it being in place until it is present in every system, eg. DF10.

An unpatched system displays the entire comment in the user's browser output!

That said I'm considering requiring it for some of my templates as it turned out to be such a straightforward patch.

An alternate strategy might be to wrap a SMARTY comment inside an HTML comment, so if SMARTY commnet patch wasn't present it would at least not get displayed to the user when it got sent to the browser.

Or add a SMARTY comment which says if you can see this then add this patch! Laughing

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


In v9 and v10!

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS

All times are UTC


Jump to: