R
R
Roman Rakzin2015-06-25 10:23:07
PHP
Roman Rakzin, 2015-06-25 10:23:07

"if" not working in twig template engine?

Good afternoon. The twig template engine worked and works on the same server normally.
Decided to transfer to another computer. Gives an error message

*An exception has been thrown during the compilation of a template ("Class "Twig_Node_Expression_Binary_Equal" not found in "C:\OpenServer\OpenServer\domains\testlocal\application/Core/Twig_Node_Expression_Binary_Equal.php" and in "C:\OpenServer\OpenServer\domains\testlocal\application/Twig/Twig_Node_Expression_Binary_Equal.php"") in "/Templates/MainTemplate_view.html".#0 C:\OpenServer\OpenServer\domains\testlocal\lib\Twig\Environment.php(334): Twig_Environment->compileSource('*

The template code
<div class="navbar-inner">
            <ul class="nav">
              <li class="Menu" ><a ng-class="{'bold': window.location.pathname == '/trainings'}" ng-href="/trainings">Тренировка</a></li>
              <li class="Menu" ng-class="{'bold': window.location.pathname == '/exam'}"><a ng-href="/exam">Экзамен</a></li>
    		  {% if role=='1' %} <li class="Menu"><a ng-href="/admin" ng-class="{'bold': location.pathname == '/admin'}">Панель администратора</a></li>{% endif %}
    		  <li class="Menu" ng-class="{'bold': window.location.pathname == '/settings'}"><a ng-href="/settings">Настройки</a></li>
    		  <li class="Menu" ng-class="{'bold': window.location.pathname == '/description'}"><a ng-href="/description">Описание</a></li>
            </ul>
    		<ul class="nav navbar-nav navbar-right">
    			<li><p>{% if role=='1' %}<span class="label label-warning">Администратор</span>{% endif %} ФИО: {{Session_Fio}} -<a href="/logout" id="logout_button" onclick="window.location = '/logout'"> Выход </a></p></li>
    		</ul>	 
         </div>

This code calls it
function action_mainview()
    	{	
    		$role =$_SESSION['role'];
    		echo $this->view->render('/Templates/MainTemplate_view.html', array('role' => $role,'login'=> $_SESSION['User'])); 
    	}

The fact is that if you remove if /endif , then everything works. How can this be explained that it works on one computer, and the exact copy does not work on another?
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Rakzin, 2015-06-26
@TwoRS

figured it out. There was a damaged twig. Downloaded from previous backups

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question