-1

I am hiding the system footer by having a code snippet with the following:

<script runat="server" language="ampscript">
  SET @flag = "1"

  IF @flag == "0" THEN
    %%Member_Busname%%
    %%Member_Addr%%
    %%Member_City%%
    %%Member_State%%
    %%Member_PostalCode%%
    %%Member_Country%%
    %%profile_center_url%%
    %%subscription_center_url%%
    %%unsub_center_url%%
  ENDIF
</script>
<script runat="server" language="ampscript">
  SET @function_filepath = CONCAT("Content Builder\assets\content_blocks\")
  SET @function_name = "hide_system_footer"
  SET @content = ContentBlockbyName(Concat(@function_filepath, @function_name))
  OUTPUT(Concat(@content))
</script>

Using 1) Reference Content via GUI or 2) ContentBlockByName via AmpScript doesn't work. Does anyone know why or how to resolve this?

The objective is to be able to use either of the above two methods rather than disabling the check in Admin Settings or hard coding the snippet into the email.

3
  • What happens if you use treatascontent() instead of output()? – Adam Spriggs May 5 at 2:58
  • you can raise a ticket with support that turn this validation off. I know, old fashioned. :) – Jonas Lamberty May 5 at 6:47
  • Could you add a display: none to the outer table? – Nate Harris May 6 at 17:42
-1

Looks like you are mixing up SSJS and AMPscript. AMPscript blocks begin and end with %%[ and ]%%

Also instead of using ContentAreaByName, set the variable to be the External Key and use ContentBlockByKey. For example,

%%[ 
set @footerBlock = '[ContentBlockKeyHere]`

if @flag == '1' then
]%%
%%=ContentBlockByKey(@footerBlock)=%%
%%[ else ]%%
%%Member_Busname%%
%%Member_Addr%%
%%Member_City%%
%%Member_State%%
%%Member_PostalCode%%
%%Member_Country%%
%%profile_center_url%%
%%subscription_center_url%%
%%unsub_center_url%%
%%[ endif ]%%
1
  • I'm not sure what you mean by saying that i am mixing SSJS with AMPScript. I am simply not using short form but rather the full form script based delimiter. – Jordan May 7 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.