Skip to main content
Guido_C
Participant
September 8, 2020
Question

Strip HTML comments for upload

  • September 8, 2020
  • 3 replies
  • 362 views

Hi.

Our HTML files contain internal comments which want to strip for server upload. But we also want to keep the comments for later (internal) use. Is it possible to have Dreamweaver remove comments while uploading, just like it processes e.g. date information?

Example: DW processes this date information to the current date and removes the surrounding comment.

<!-- #BeginDate format:IS1 -->2020-09-08<!-- #EndDate -->

 

Regards

This topic has been closed for replies.

3 replies

WolfShade
Legend
September 8, 2020

As someone who isn't _that_ familiar with Dw, I didn't think it was possible, but didn't want to just jump in with saying it couldn't be done.

 

However, now I'm curious.  Jon, how does one set up a webserver to process HTML pages as PHP?  Does it have to be an Apache server?  I'm assuming yes, as I don't think IIS can process PHP.  Or, am I that far out of the loop?

 

V/r,

 

^ _ ^

Nancy OShea
Community Expert
Community Expert
September 8, 2020

Linux servers can be instructed to parse .html files as .php, .asp or .shtml if needed via an .htaccess file.   However, cheap shared hosting plans may not allow it for practical reasons.  It makes the server work harder. 

 

IIS uses a web.config file.

 

Nancy O'Shea— Product User & Community Expert
Nancy OShea
Community Expert
Community Expert
September 8, 2020

As Jon said, there is no DW function (or any other IDE or FTP client I know of) that can strip comments during FTP process.  Stripping comments is all or nothing.

 

Depending on which programming languages your server suports, be it PHP, ASP.net or ColdFusion, those would be the comments to use as nobody can see them except the coders.

 

Nancy O'Shea— Product User & Community Expert
Jon Fritz
Community Expert
Community Expert
September 8, 2020

There are a few ways to strip comments from your pages in DW. However, as far as I've ever seen, there's no "remove comments from a file as it's uploaded" function.

The effect you want can be done very easily (and automatically), if you use PHP comments within a .PHP page, or on a server that has been set to process .HTML pages as .PHP (the easier way to go, if your site can't be switched to .PHP files).

When PHP comments are processed by the server, they don't appear on the page the viewer sees. So if you had...

<body>
<?php /*something you don't want to appear online here*/ ?>Your Text<?php /*something you don't want to appear online here
*/ ?>
</body>

...it would show up in the browser as...

<body>
Your Text
</body>