在Django的模板,你應該能夠做這樣的事情:Haanga包括與參數
{% include "fragments/threadComment.html" with post.comments as comment only %}
但是,我們使用的是它基於Django的Haanga女巫,我被告知要遵循Django文檔時,我得到了一些問題與Haanga,但我不能讓這部分工作。
這是甚至在Haanga支持?
我得到這個錯誤:
Fatal error: Uncaught Haanga_Compiler_Exception: Haanga_Compiler_Exception: Unexpected T_WITH(with) in /var/www/project/templates//pages/postThread.html:5 in /var/www/project/framework/lib/Haanga/Compiler/Parser.php:155 Stack trace: #0 /var/www/project/framework/lib/Haanga/Compiler/Parser.php(2253): Haanga_Compiler_Parser->Error('Unexpected T_WI...') #1 /var/www/project/framework/lib/Haanga/Compiler/Parser.php(2364): Haanga_Compiler_Parser->yy_syntax_error(36, 'with') #2 /var/www/project/framework/lib/Haanga/Compiler/Tokenizer.php(570): Haanga_Compiler_Parser->doParse(36, 'with') #3 /var/www/project/framework/lib/Haanga/Compiler.php(256): Haanga_Compiler_Tokenizer::init('{% extends "bas...', Object(Haanga_Compiler_Runtime), '/var/www/projec...') #4 /var/www/project/framework/lib/Haanga/Compiler.php(356): Haanga_Compiler->compile('{% extends "bas...', '/var/www/projec...', '/var/www/projec...') #5 /var/www/project/framework/lib/Haanga.php(378): Haanga_Compiler->compile_file('/var/www/projec...', false, Array) #6 /var/www in /var/www/project/framework/lib/Haanga/Compiler.php on line 399
試過這種方式沒有奏效,我相信這個錯誤發生在「with」,即使它被支持也會引發這個問題。 – Denaton