Hi, I'm converting a Drupal 7 site to Drupal 9. It's a fairly simple theme and I've managed to install the theme in Drupal 9. However on going to the site, I recieve this error:

The website encountered an unexpected error. Please try again later.

Twig\Error\SyntaxError: Unexpected token "name" of value "aktiver_link" ("end of statement block" expected). in Twig\TokenStream->expect() (line 8 of themes/mysite/templates/page.html.twig).

There is only one file in the templates folder which is page.html.twig. I converted it from a .tpl file to .twig using the convertor at https://opencartbot.com/en/tpl2twig/

The twig file is below.

any help will be gratefully received.

{# entwicklung, tmp

Flush image styles

aktiver hauptlink, um die seitenklasse fuer titel zu erhalten; #}

{% if page.submenue 
aktiver_link in menu_get_active_trail()
aktiver_link in aktiver_link.1.link_title()
aktiver_link in transliteration_get(aktiver_link, unknown in '?', source_langcode in NULL())
aktiver_link in aktiver_link|lower
aktiver_link in " ", "_", aktiver_link|replace({ : })
aktiver_link in "&", "_", aktiver_link|replace({ : })
{% endif %}

%}
 <div id="wrapper"{% ifpage.submenue {{ ' class="'~aktiver_link~'"' {% endif %}}}%}>
  
  <div id="header">
   <div id="hauptmenue">
    {{ page.hauptmenue }}
   </div> <!-- /#hauptmenue -->
   <div class="paddingbox">   
    {{ page.header }}   
    <div id="logo">
     <a href="{{ base_path }}" title="mysite HOME">
      <img src="{{ base_path~directory }}/logo.png" alt="mysite Logo" />
     </a>
    </div>    
   </div> <!-- /.paddingbox -->  
  </div> <!-- /#header --> 
  
  {% if page.submenue %}
  <div id="submenue" class="clearfix">
   {{ page.submenue }}
  </div><!-- /#submenue -->
  {% endif %}
  
  <div id="container" class="clearfix">
    
   <div id="center">

    <div id="center_content">
    
     {% if page.content_header %}
     <div id="content_header">
      {{ page.content_header }}
     </div><!-- /#content_header -->
     {% endif %}

     {% if page.sidebar_first %}
     <div id="sidebar_first" class="sidebar">
      {{ page.sidebar_first }}
     </div><!-- /#sidebar_first -->
     {% endif %}
     
     <div id="content_box">

     {% if page.highlighted %}
     <div id="highlighted">
     {{ page.highlighted }}
     </div>{% endif %}
     <a id="main-content"></a>
     {% if tabs %}<div id="tabs-wrapper" class="clearfix">{% endif %}
     {% if tabs %}{{ tabs }}</div>{% endif %}
     {{ tabs2 }}
     <div id="message_box">
      {{ messages }}
     </div>
     {{ page.help }}
     
     {% if action_links %}<ul class="action-links">{{ action_links }}</ul>{% endif %}

      {{ title_prefix }}
      {% if title %}
      <h1 class="title">{{ title }}</h1>
{% else %}{# H1 Fallback #} 
      <h1 class="title diskret">Headline Fallback</h1>
      {% endif %}
      {{ title_suffix }}
      {{ page.content }}
      
      </div> <!-- /#content_box -->
     
    </div> <!-- /#center_content -->
    
    {% if page.sidebar_second %}
    <div id="sidebar_second" class="sidebar">
     {{ page.sidebar_second }}
    </div><!-- /#sidebar_second -->
    {% endif %}
    
    <div class="clr"></div>
    
    <div id="content_footer" class="clearfix">
     {{ links }}    
     {{ page.content_footer }}
     <div class="clr"></div>
    </div> <!-- /#content_footer -->
     
   </div> <!-- /#center --> 
      
   <div class="clr"></div>
   
  <div id="footer" class="clearfix">
   <div class="paddingbox">
    {# print $breadcrumb; ?>
    <?php if (!$is_front) : 
    print '<div id="toplink" class="rechts">nach oben</div>';
    endif; #}
    {{ page.footer }}  
   </div> <!-- /.paddingbox -->
   <div class="clr"></div>
  </div> <!-- /#footer -->

  </div> <!-- /#container -->
 
 </div> <!-- /#wrapper -->
{# 
 #}


{# 
<div id="INFO"></div>
<div id="teasers">Teasers<br /></div> #}

 

Comments

vm’s picture

suggest reviewing a core twig file. That converter isn't likely to work specific for drupal it's specific to opencart (i think).