1
我是Mako的全新新人,所以請耐心等待。魔方中的障礙物和Defs
我有一系列的塊用於佈局。其中一個塊需要在同一頁面上聲明一些變量。我無法讓它正常工作。這是非常基本的,我知道,但我正在學習,無法在Mako文檔中找到解決方案。什麼是適當的語法和/或方法來做到這一點?
我想保持userInputViews更全球化,因爲它在其他區塊中也同樣使用。 currentSet的值是任意的,因爲它被傳遞給頁面並且工作正常,所以不會被分析。
我得到的錯誤是關於userInputViews未定義的。
<% userInputViews = [ "MediatorAddress", "MediatorDateOfBirth", "MediatorEmailAddress" ] %> <%block name="contentAction"> % if set(userInputViews) == set(currentSet): user inputs are currently selected % endif </%block>
我不知道,但你可以嘗試設置($ userInputViews) – avasal
只是試了一下,並得到了語法錯誤。雖然 – AlexM
可能是這可以是一些幫助.. http://stackoverflow.com/questions/4161464/pass-in-variable-to-mako-template – avasal