확장변수로 html 파일이름 입력받고 include로 출력하려고 합니다.
CMS/프레임워크 | Rhymix 1.9 |
---|---|
개발 언어 | PHP 7.0 |
확장변수에 include 하고자 하는 파일을 입력받고
<include target="{$document->getExtraValue(1)}" />
이런식으로 출력하려고 하는데
Template not found: modules/document/tpl{$extravar_list[1]->getValueHTML()}
이런 식으로 {$document->getExtraValue(1)} 그대로 출력해버리네요
방법이 없을까요?
oxythus
Lv. 5
댓글 2
다른 사람이 입력한 값을 include에 직접 사용하면 해킹당하는 지름길이므로 지원하지 않습니다.
if문을 사용하여 각각 다른 파일을 불러오도록 구현하세요.
<!--@if(확장변수 == 1)-->
<include target="1.html" />
<!--@elseif(확장변수 == 2)-->
<include target="2.html" />
<!--@else-->
<include target="3.html" />
<!--@end-->