-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter46.amp
More file actions
33 lines (26 loc) · 1.12 KB
/
chapter46.amp
File metadata and controls
33 lines (26 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
%%[
/* Declare variables */
Var @Content, @ContentBlockName, @ProductName, @StatusCode
/* Set the product name */
Set @ProductName = "Product A" /* This could be dynamically set */
/* Based on the product, set the appropriate content block name */
If @ProductName == "Product A" Then
Set @ContentBlockName = "Product A Description"
ElseIf @ProductName == "Product B" Then
Set @ContentBlockName = "Product B Review"
Else
Set @ContentBlockName = "Generic Product Offer"
EndIf
/* Retrieve the content from the selected content block */
Set @Content = ContentBlockByName(@ContentBlockName,
"bodytext", false,
"We're sorry, product information is unavailable.",
@StatusCode)
/* Output the content */
Output(@Content)
/* If content retrieval fails, display a fallback message */
If @StatusCode == -1 Then
Output(Concat('<p>For more details, please visit our
<a href="https://www.example.com/products">Product Page</a>.</p>'))
EndIf
]%%