• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Strip HTML comments for upload

Community Beginner ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

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

TOPICS
Code , How to , Publish

Views

201

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

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>



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

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 & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

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,

 

^ _ ^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

LATEST

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 & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines