Forums / Setup & design / Comments in rendered page?

Comments in rendered page?

Author Message

RW Wood

Sunday 28 September 2003 7:23:08 am

How do you code html comments in the templates so that they display in the source of the rendered page? the {* comments *} for ezP are lost from the final source.

Thanks
RWW

Paolo Tramontani

Monday 29 September 2003 2:26:49 am

I think you can comment lines in standard HTML mode
<!-- -->

By this way ezp should pass the html as it is and it should arrive to the browser...

I have never tried it but it should work

Paolo

RW Wood

Monday 29 September 2003 8:12:59 am

That should have been the obvious answer, but the thing that threw me off were the {*comment*} type comments. What's the reason for doing it that way? The only benefit is that the comments don't show up in the rendered source, when many times it's a comment line that helps track down where there might be a problem.

Just like to know the thinking behind the use of that style of comment tags.

Thanks.
RWW

Paul Forsyth

Monday 29 September 2003 8:35:30 am

The {* *} comment tags are meant to be used when developing template files, *not* for being viewed in the html source.

I shouldn't need to what the value of comments are to a developer. If you have written some complex template code and pass it over to another developer it takes a lot longer to decipher what the code does if there are no comments in there.

paul

RW Wood

Tuesday 30 September 2003 7:13:40 am

No doubt to the need for comments. I just don't see the point of making them invisible in the source of the rendered page. It's not always convenient to turn on template debugging, and for me, the best way to see what's comming from where is a <!-- this is the start of such_and_such.tpl --> in the source. Matter of fact, that's just what the template debugging does is to include comments in the source. More complex comments, such as the ones you refer to are normally not left in the code when a site goes to production, but even if they were, who, other than developers ever would see them?

It's not a big deal, but I just don't follow the rationale for using a special tag (which actually has a downside in that in html text editors, the {**} comments show up like {section} or {let} tags, so they're not so easy to spot when scanning through the code.

I'm not asking anyone to change it, I just would like to know the thinking behind it.

Thanks.
RWW

Alex Jones

Tuesday 30 September 2003 7:54:17 am

I often use server-side comments like {* *} (or in PHP /* */ ) when I want to leave notes for other developers or myself. There might be notes about sensitive parts of the code that I don't want exposed to the user or descriptions of logic that is rendered before it ever gets to the browser.

In general, I think standard HTML comments should be used sparingly as they do the user little to no good. They add additional weight to the page which can add up over time. If I need to see what template is loaded then a temporary HTML comment works, but if I want to keep track of what the code is doing in a template, then server-side comments are ideal.

My thoughts,

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

RW Wood

Tuesday 30 September 2003 8:02:58 am

I would agree with Alex, however, I don't find many of those kinds of descriptions in the design templates. Maybe I haven't searched far enough. But if you look at pagelayout.tpl in the standard design, the "invisible" comments are being used in the way that I suggested they would be more benefial to be seen in the final source. Not having seen them used in the way that you pointed out, I could see no need for making them that way.

RWW

Paul Forsyth

Tuesday 30 September 2003 8:12:38 am

This boils down to best practice for coding web pages. Each different view can be right and wrong depending on your circumstances.

From my own point of view working with many projects i heavily re-use my own templates. Coming back to something a few days/weeks/months old can be made very easy by commenting code properly. Since the end user can *never* see {* *} comments I can write comments as i like.

I also work with my servers in a local environment, testing the code in several ways, on-screen feedback, using 'tail -f' var/log/*.log, etc. Only if there is a problem would i need to turn on debugging on a live site.

It may one day be possible to use a proper documentor ala doxygen,javadoc to parse the ez template code in some useful way... Not sure how useful but i like programs that create documentation for me in a structured manner.

These points work well in a multi-project environment. Almost essential. But for a small number it probably isn't necessary.

I consider myself a software engineer given my background and i've come to rely on certain best practices when it comes to code.

Paul

eZ debug

Timing: Jan 18 2025 15:52:36
Script start
Timing: Jan 18 2025 15:52:36
Module start 'content'
Timing: Jan 18 2025 15:52:36
Module end 'content'
Timing: Jan 18 2025 15:52:37
Script end

Main resources:

Total runtime0.9528 sec
Peak memory usage4,096.0000 KB
Database Queries213

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 587.7109180.8359
Module start 'content' 0.00620.8263 768.5469664.4141
Module end 'content' 0.83250.1202 1,432.9609340.4375
Script end 0.9527  1,773.3984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.4599210.0002
Check MTime0.00150.1568210.0001
Mysql Total
Database connection0.00110.113910.0011
Mysqli_queries0.872691.58562130.0041
Looping result0.00200.21432110.0000
Template Total0.922096.820.4610
Template load0.00180.187620.0009
Template processing0.920296.584520.4601
Template load and register function0.00020.022910.0002
states
state_id_array0.00150.153110.0015
state_identifier_array0.00090.099620.0005
Override
Cache load0.00160.1634440.0000
Sytem overhead
Fetch class attribute can translate value0.00180.183950.0004
Fetch class attribute name0.00100.102590.0001
XML
Image XML parsing0.00140.146150.0003
class_abstraction
Instantiating content class attribute0.00000.001890.0000
General
dbfile0.00340.3581270.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs