-
- 9 Posts
Hi
I have a template, that I have inserted some comments in, just to remember what the code does.
Is there anyway to get ModX to remove these comments from the final page ?
I know that the visitor to my page will not actually see the <!-- html comments -->, cause the browser will not show them. But if the user views page source, the comments are there, and i prefer them not being there. Is there any way to achieve this ?
By the way I am using version 0.9.6.3
Thanks
-
- 1,024 Posts
Hi,
I do not know of a utility that does that for you.
I just do it manually. But maybe others know of such a plugin/snippet?
-
- 24,544 Posts
Here’s a start (although it will remove JS inside comments):
http://modxcms.com/forums/index.php/topic,2737.0.html
-
- 9 Posts
Hi
Thank you, just what I am looking for
Although I am very newb to php. How exactly do I make it work ? Do I save the whole thing in a snippet, or directly in the html template ?
And how do I assing the OnWebPagePrerender, which they say must be assigned ?
Kind reagrds
It’s a plugin... Resources -> Manage Resources, and the Plugins tab.
To assign an event, when editing the plugin go to the System Events tab and check the events you want your plugin to use.
http://sottwell.com/how-plugins-work.html
I’ve recently started doing the following for one-line comments if don’t want it in the document output:
It makes use of the parser, which interprets it as a snippet call, but doesn’t find a snippet to run. The double slashes just help me to visually identify it as a comment.
I don’t think it’s much more overhead for the parser than using a plugin to modify the document output. (It might even be less?)
You can do this style of comment in the document or in any element that is going through the parser (template, chunk).