Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Have two commenting systems

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Sat Apr 24, 2010 1:08 am    Post subject: Have two commenting systems Reply with quote

I want to have two commenting system in Smarty. Is it possible? How? Waiting for your replies and solutions. Here is my case:

The HTML commenting <!-- ... --> and Smarty's Commenting {* ... *} are both good for me. Sometimes, I need to use both the commenting system together as below. One reason is to show html comments, other is the comment on the template itself.
Code:
<!--{* ... *}-->
or/and
Code:
<!-- ... {* ... *} ... -->


Once everything is okay, it would be better to make <!-- and --> as Smarty's commenting so that the page does not show any comments there. And, I do not want to change the left/right { and }. Because, this may corrupt the working copies of template variables/functions etc. by mistake.

Help me please.
Back to top
View user's profile Send private message Visit poster's website
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Tue Jun 22, 2010 7:38 pm    Post subject: Remove HTML comment residues Reply with quote

This is to remove the HTML comments residues along with Smarty's comments.

Code:

..THIS BLOCK IS INSIDE A LOOP!
   <tr>
      <td>S.N.</td>
...
      <!--{* Name Headers *}-->
      <td>{$name}</td>

...
   </tr>


Here, the comment: Name Headers is important to appear on the template. Smarty-only comments would trouble the designer tool like Dreamwever. So, I used a combination of HTML Comments as well.

But it leaves the space residues of empty html comments - which is somewhat serious for too big data.

Your helps required!
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Jun 22, 2010 7:42 pm    Post subject: Reply with quote

Use a prefilter to change your custom comment syntax to Smarty comment syntax.

<!--{* ... *}-->

changes to

{* ... *}

Code:
$input = str_replace(array('<!--{*','*}-->'),array('{*','*}'),$input);
Back to top
View user's profile Send private message Visit poster's website
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Tue Jun 22, 2010 8:31 pm    Post subject: It works Reply with quote

Prefilter works!

Thanks.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP