4
저는 foreach를 사용하여 이상한 행동을하고 있습니다. JSON 문서를 가져 오는 dataset
이 있습니다. 배열의 부분은 내가 pick()
이며 foreach로 보냅니다. 내 글로벌 블록은 다음과 같습니다.이상한 KRL foreach 동작
global {
dataset appserver <- "http://imaj-app.lddi.org:8010/list/popular" cachable for 1 hour;
popular = appserver.pick("$..images")
}
먼저 페이지를 설정하는 규칙이 하나 있습니다. (스크롤 엄지가 얼마나 작은 알)
이rule images {
select when web pageview "www\.google\.com"
foreach popular setting (image)
pre {
thumburl = image.pick("$..thumburl");
viewurl = "http://imaj-web.lddi.org/view?imagekey=" + image.pick("$..imagekey");
html = <<
<span class="image"><a href="#{viewurl}"><img src="#{thumburl}" style="border:none"/></a></span>
>>;
}
after('#462popular .image', html);
}
나는 이런 식으로 뭔가를 얻을 :
은 다음과 같습니다rule setup {
select when web pageview "www\.google\.com"
pre {
imagelist = <<
<div id="462popular" style="margin-left:auto;margin-right:auto;width:450px">
<p>Popular images from the CS 462 <a href="http://imaj-web.lddi.org/">Image Project</a></p>
<span class="image"></span>
</div>
>>;
}
prepend('#footer', imagelist);
}
을 그리고 여기에 작동하지 않는 규칙입니다
아이디어가 어떻게되고 있습니까?
오! 나는 그것을 알아야했다. :) –