Skip Navigation
Expand
Do not nest HTML comments inside widget calls
Answer ID 11728   |   Last Review Date 10/19/2020

Why does my staging of Customer Portal keep failing after I commented out some lines of code?

Environment:

Customer Portal v3.x

Issue:

A Customer Portal developer wants to remove some fields from the login/AccountDropdown widget in the standard.php template. They comment some line out of the widget call, such as the social display name, like this:

<rn:widget path="login/AccountDropdown" subpages="#rn:msg:ACCOUNT_OVERVIEW_LBL# > account/overview"
sub:input_Contact.Emails.PRIMARY.Address:label_input="#rn:msg:EMAIL_ADDR_LBL#"
sub:input_Contact.Emails.PRIMARY.Address:required="true"
sub:input_Contact.Emails.PRIMARY.Address:validate_on_blur="false"
sub:input_Contact.Login:label_input="#rn:msg:USERNAME_LBL#"
sub:input_Contact.Login:required="true"
sub:input_Contact.Login:validate_on_blur="false"
sub:input_Contact.Name.First:required="true"
sub:input_Contact.Name.First:label_input="#rn:msg:FIRST_NAME_LBL#"
sub:input_Contact.Name.Last:required="true"
sub:input_Contact.Name.Last:label_input="#rn:msg:LAST_NAME_LBL#"
<!--sub:input_SocialUser.DisplayName:label_input="#rn:msg:DISPLAY_NAME_LBL#"-->
sub:input_Contact.NewPassword:label_input="#rn:msg:PASSWORD_LBL#"
/>

Now that template cannot be staged.

Resolution:

Do not use HTML comments nested within a widget call.

While it is up to you how to back up and version your code in the development process, this particular strategy will not work. You could make a copy of the existing call to save it, and if you used a PHP comment for that backup it wouldn't be loaded on the end-user pages. Or you could use git, etc. to entirely avoid having lines commented out in your production code.