<a href="{$widget_info->url_1}"><img src="{$widget_info->img_1}" alt="{$widget_info->title_1}" cond="$widget_info->img_1"></a>
<a href="{$widget_info->url_2}"><img src="{$widget_info->img_2}" alt="{$widget_info->title_2}" cond="$widget_info->img_2"></a>
<a href="{$widget_info->url_3}"><img src="{$widget_info->img_3}" alt="{$widget_info->title_3}" cond="$widget_info->img_3"></a>
<a href="{$widget_info->url_4}"><img src="{$widget_info->img_4}" alt="{$widget_info->title_4}" cond="$widget_info->img_4"></a>
<a href="{$widget_info->url_5}"><img src="{$widget_info->img_5}" alt="{$widget_info->title_5}" cond="$widget_info->img_5"></a>
<a href="{$widget_info->url_6}"><img src="{$widget_info->img_6}" alt="{$widget_info->title_6}" cond="$widget_info->img_6"></a>
<a href="{$widget_info->url_7}"><img src="{$widget_info->img_7}" alt="{$widget_info->title_7}" cond="$widget_info->img_7"></a>
<a href="{$widget_info->url_8}"><img src="{$widget_info->img_8}" alt="{$widget_info->title_8}" cond="$widget_info->img_8"></a>
<a href="{$widget_info->url_9}"><img src="{$widget_info->img_9}" alt="{$widget_info->title_9}" cond="$widget_info->img_9"></a>
<a href="{$widget_info->url_10}"><img src="{$widget_info->img_10}" alt="{$widget_info->title_10}" cond="$widget_info->img_10"></a>
<a href="{$widget_info->url_11}"><img src="{$widget_info->img_11}" alt="{$widget_info->title_11}" cond="$widget_info->img_11"></a>
<a href="{$widget_info->url_12}"><img src="{$widget_info->img_12}" alt="{$widget_info->title_12}" cond="$widget_info->img_12"></a>
<a href="{$widget_info->url_13}"><img src="{$widget_info->img_13}" alt="{$widget_info->title_13}" cond="$widget_info->img_13"></a>
<a href="{$widget_info->url_14}"><img src="{$widget_info->img_14}" alt="{$widget_info->title_14}" cond="$widget_info->img_14"></a>
<a href="{$widget_info->url_15}"><img src="{$widget_info->img_15}" alt="{$widget_info->title_15}" cond="$widget_info->img_15"></a>
<a href="{$widget_info->url_16}"><img src="{$widget_info->img_16}" alt="{$widget_info->title_16}" cond="$widget_info->img_16"></a>
<a href="{$widget_info->url_17}"><img src="{$widget_info->img_17}" alt="{$widget_info->title_17}" cond="$widget_info->img_17"></a>
<a href="{$widget_info->url_18}"><img src="{$widget_info->img_18}" alt="{$widget_info->title_18}" cond="$widget_info->img_18"></a>
<a href="{$widget_info->url_19}"><img src="{$widget_info->img_19}" alt="{$widget_info->title_19}" cond="$widget_info->img_19"></a>
<a href="{$widget_info->url_20}"><img src="{$widget_info->img_20}" alt="{$widget_info->title_20}" cond="$widget_info->img_20"></a>

 

위젯에 스킨 파일이 이렇습니다.

이걸..

 

{$i}
<a href="{$widget_info->url_{$i}}"><img src="{$widget_info->img_{$i}}" alt="{$widget_info->title_{$i}}" cond="$widget_info->img_{$i}}"></a>
{$i++}

 

이런 식으로 줄이려면 어떻게 하면 되나요?;;

  • profile
    for문으로 루프를 돌리면 됩니다.

    <a loop="$i=0;$i<20;$i++;" href="{$widget_info->url_{$i}}" ><img src="{$widget_info->img_{$i}}" alt="{$widget_info->title_{$i}}" cond="$widget_info->img_{$i}}"></a>

    이렇게 활용할 수 있습니다.
  • profile profile

    위젯 스킨에서는 세미콜론(;)이 들어가면 오류를 내뱉는군요;;

  • profile profile
    아.. 마지막꺼(;)는 빼야하네요.

    <a loop="$i=0;$i<20;$i++" href="{$widget_info->url_{$i}}" ><img src="{$widget_info->img_{$i}}" alt="{$widget_info->title_{$i}}" cond="$widget_info->img_{$i}}"></a>

    이렇게..
  • profile profile
    {$widget_info->url_{$i}} 이렇게 사용하는 건 아닌가 보네요. ;; 이 부분에서 ?>가 이미 닫혔다고 나와버리네요;;
  • profile profile

    scr_20150907_003.png

    위젯 파일에서 이런 식으로 작성해서

    <a href="{$widget_info->url_1}"><img src="{$widget_info->img_1}" alt="{$widget_info->title_1}" cond="$widget_info->img_1"></a>

    이렇게는 됩니다.

     

    하지만 위젯스킨에서

     

    <block loop="$i=1;$i<3;$i++">
    {$widget_info->url}_{$i}
    </block>

     

    이렇게 적는 건 되지만, 위젯에서는 widget_info와 $i가 분리된게 아니라 하나의 변수로 동작하기 때문에 분리해놓으면 그 값이 출력되지 않네요. ㅎㅎ

     

    위젯에서 따로 적어놓던가, 그래야 저게 되는거 같네요.;

     

  • profile profile
    네.. 아마 XE문법과 충돌이 나서 그럴 겁니다.

    위젯클래스에서 url 배열로 바꾸세요. 그다음 {$widget_info->url[$i]} 이렇게 하는 방법 밖에는 없는 것 같습니다.