I've written AMPscript to generate a Signature line. When the AMPscript is placed directly into the HTML content area of an email, it works and does not display any extraneous code.
I placed this AMPscript into an HTML content block so that we could reuse it across several emails.
Within the emails, I'm outputting the block by using this line of code:
%%[ set @output = ContentBlockbyID("13210") output(concat(treatascontent(@output))) ]%%
When displayed by calling the block, it shows ctrl:eval/> on preview of the email. Is there something else I need to do in order to get the AmpScript to work in a Content Block.
%%[
/*These are set from the sendable data extension in this case progressive grid*/
Var @Email, @Stage, @title, @address, @sigemail, @zip, @fullname, @ContactOwner, @profileimage, @DynamicFromEmail, @DynamicFromName, @licensingpublicdisplay
Set @Email = Email
Set @Stage = Stage
Set @ContactOwner = [Contact Owner: Full Name]
Set @ContactOwnerEmail = [Contact Owner: Email]
set @DynamicFromEmail = [Contact Owner: Email]
set @DynamicFromName = [Contact Owner: Full Name]
/* Lets look up the title and set the value from our signature line data extension */
/*Set the Title*/
Set @title = Lookup("Signature Line 2", "Title", "Email", @ContactOwnerEmail )
/*Set the Address*/
Set @address = Lookup("Signature Line 2", "address", "Email", @ContactOwnerEmail )
/*Set the City*/
Set @city = Lookup("Signature Line 2", "city", "Email", @ContactOwnerEmail )
Set @fullname = Lookup("Signature Line 2", "Full Name", "Email", @ContactOwnerEmail )
set @profileimage = URLEncode(Lookup("Profile Images by Contact", "Photo", "Full Name", @ContactOwner))
if ((@profileimage == "") OR EMPTY(@profileimage)) then
set @profileimage = URLEncode('http://image.homestarfc-connect.com/lib/fe8913727c62037b74/m/1/cae2521b-3406-4292-80e0-45189fbca0fe.png')
endif
/*Set the ZipPostal Code*/
Set @zip = Lookup("Signature Line 2", "Zip_Postal_Code", "Email", @ContactOwnerEmail)
/*Set the Mobile*/
Set @mobile = Lookup("Signature Line 2", "mobile", "Email", @ContactOwnerEmail)
/*Set the Phone*/
Set @phone = Lookup("Signature Line 2", "phone", "Email", @ContactOwnerEmail)
/*Set the Fax*/
Set @fax = Lookup("Signature Line 2", "fax", "Email", @ContactOwnerEmail)
/*Set the Email*/
Set @sigemail = Lookup("Signature Line 2", "email", "Email", @ContactOwnerEmail)
/*Set the Website*/
Set @website = URLEncode(Lookup("Signature Line 2", "website", "Email", @ContactOwnerEmail))
/*Set the Licensing Public Display*/
Set @licensingpublicdisplay = Lookup("Signature Line 2","licensing public display","Email", @ContactOwnerEmail)
]%%
<img width="125" alt="Picture" src="%%=v(@profileimage)=%%">
<div>
%%[ if not Empty(@fullname) then ]%%
<i>%%= v(@fullname) =%%</i><br>
%%[ endif ]%%
%%[ if not Empty(@title) then ]%%
<strong>%%= v(@title) =%%</strong><br>
%%[ endif ]%%
%%[ if not Empty(@phone) then ]%%
<strong>Phone:</strong>%%= v(@phone) =%%<br>
%%[ endif ]%%
%%[ if not Empty(@sigemail) then ]%%
<strong>Email:</strong>%%= v(@sigemail) =%%<br>
%%[ endif ]%%
%%[ if not Empty(@fax) then ]%%
<strong>Fax:</strong>%%= v(@fax) =%%<br>
%%[ endif ]%%
%%[ if not Empty(@address) then ]%%
<strong>Address:</strong> %%= v(@address) =%%
%%= v(@city) =%% %%= v(@state) =%% <br>
%%[ endif ]%%
%%[ if not Empty(@website) then ]%%
<strong>Website:</strong>%%= v(@website) =%%
%%[ endif ]%%
%%[ if not Empty(@licensingpublicdisplay) then ]%%
<strong>Licensing Display:</strong>
%%= v(@licensingpublicdisplay) =%%
%%[ endif ]%%
</div>
ctr:eval/>
is a SSJS fragment.