2011-01-09 6 views

답변

1

템플릿 엔진은 별도의 비즈니스 로직 (및 요청 자체) 표현 적 논리에서에 발명되었다. 템플릿 엔진은 $ _GET, $ _POST, $ _SESSION 등을 처리하지 않아야합니다.

$ _GET [ 'action']을 기반으로 결정해야하는 경우에는 컨트롤러에서 똑똑한 컨트롤러 reguler assign .

어쨌든, 좀 더 논리적이고 명확하도록 코드를하지 않으려면과 같이 $smarty.get.action

{if empty($smarty.get.action)}class="current"{/if} 
+0

감사합니다! 나는 $ _GET [ 'action'] = 'detail''에 값을 할당하고 싶습니다.'{if ($ smarty.get.action ='detail ') class = "현재"{/ if}' 오류가 발생했습니다. – Cheerio

+0

@Mini :'{if ($ smarty.get.action eq 'detail') class = "현재"{/ if}' – zerkms

+0

@zerkms : 감사합니다. {if ($ smarty.get.action = = 'details')} class = "현재"{/ if}'== 또는 eq이 가장 좋습니다. 감사합니다 – Cheerio

1

을 사용할 수

{if !isset($smarty.get.action)}class="current"{/if} 
+0

감사합니다! 'if ($ _ GET [ 'action'] == 'open') {}'수동 또는 문서가 있습니까? – Cheerio

+0

예. 다음은 유용한 문서입니다. http://www.smarty.net/docsv2/en/language.function.if.tpl 및 http://www.smarty.net/docsv2/en/language.variables.smarty. tpl # language.variables.smarty.request – borkweb

+0

와우 너무 쉬워. 방금 올바른 코드를 찾았습니다. {if ($ smarty.get.action == 'details')} class = "현재"{/ if}':) – Cheerio