특정 확장변수 비회원 감추기
https://xe1.xpressengine.com/tip/20004481 팁을 보고 적용 해 보려고 합니다.
여기에
<tr loop="$oDocument->getExtraVars()=>$key, $val" cond="$val->getValueHTML()">
<th>{$val->name}</th>
<td>{$val->getValueHTML()} </td>
</tr>
</table>
아래를 적용하면 게시판 에러가 뜨면서 적용이 안됩니다.
<!--@if($key==확장변수키번호)-->
<!--@if($is_logged)-->
<tr>
<th>{$val->name}</th>
<td>{$val->getValueHTML()}</td>
</tr>
<!--@else-->
<tr>
<th>{$val->name}</th>
<td>로그인하셔야 보실 수 있습니다.</td>
</tr>
<!--@end-->
<!--@else-->
<tr>
<th>{$val->name}</th>
<td>{$val->getValueHTML()}</td>
</tr>
<!--@end-->
댓글 3
(tr 태그는 그대로 두고) <th>~</td>까지만 이렇게 바꾸면 어떨까 싶습니다.
<th>{$val->name}</th>
<td cond="$key==확장변수키번호 && !$is_logged">로그인하셔야 보실 수 있습니다.</td>
<td cond="$key!==확장변수키번호 || $is_logged">{$val->getValueHTML()}</td>
윤삼님 답글 감사합니다.
<!-- // 확장 변수 출력 // -->
<table border="0" cellspacing="0" summary="Extra Form" class="extraVarsView" cond="$oDocument->isExtraVarsExists() && (!$oDocument->isSecret() || $oDocument->isGranted())">
<tr loop="$oDocument->getExtraVars()=>$key, $val" cond="$val->getValueHTML()">
<th>{$val->name}</th>
<td cond="$key==2 && !$is_logged"><p><strong>로그인 후 보실 수 있습니다.</strong> <a href="ndex.php?act=dispMemberLoginForm" target="_blank"><span style="color:#0000FF;">(네이버 아이디로 회원가입 바로가기)</span></a></p>
</td>
<td cond="$key!==2 || $is_logged">{$val->getValueHTML()}</td>
</tr>
</table>
<div class="boardReadBody pd-xs-15">
<!--@if($oDocument->isSecret() && !$oDocument->isGranted())-->
<form action="/" method="get" onsubmit="return procFilter(this, input_password)" class="secretMessage">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="document_srl" value="{$oDocument->document_srl}" />
<p>"{$lang->msg_is_secret}"</p>
<p>
<label for="cpw">{$lang->password}</label> : <input type="password" name="password" id="cpw" placeholder="{$lang->password}" class="inputText" />
<input type="submit" value="{$lang->cmd_input}" class="{$btn} {$btn_size} {$btn_color}" />
</p>
</form>
<!--@else-->