문제

I would like to store the result of an ESI include or eval block in an ESI variable. The contents of the include is outside of my control. Its format is JSON. I've tried all of the following to no avail. The variable ends up as an empty string.

<esi:assign name="variable_name">
'<esi:include src="$(url)" method="post" entity="$(param)" />'
</esi:assign>
<esi:assign name="variable_name">
'<esi:eval src="$(url)" method="post" entity="$(param)" />'
</esi:assign>

<esi:assign name="variable_name">
'''<esi:include src="$(url)" method="post" entity="$(param)" />'''
</esi:assign>
<esi:assign name="variable_name">
'''<esi:eval src="$(url)" method="post" entity="$(param)" />'''
</esi:assign>

The ESI server I'm testing on is Akamai's ETS.

도움이 되었습니까?

해결책

This is the solution as provided by Akamai's support team. Quite convoluted, but it works wonderfully.


File: json.txt

{ "a" : 1, "b" : 2 }

File: frag.esi

<esi:text><esi:assign name="val">'''</esi:text><esi:include
src="json.txt"/><esi:text>'''</esi:assign></esi:text>

File: container.esi

<esi:eval src="frag.esi" dca="esi" />

<esi:vars>
val = $(val)
</esi:vars>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top