Problem with template inheritance

A forum for Bolt related questions / issues

Problem with template inheritance

Postby nanotime » Wed May 22, 2013 2:38 pm

Yep, im noob with Bolt and twig, but i don't like the "include" tag hehehe, it's ugly...

Well, i create a very very base template without styles for now... but some blocks don't inherit the content they step and i don't know why :geek:

I check the syntax, one, two, three times, and i can't find the problem... these blocks are "sidebar" and "header" and this is the code (basic):

Note: entry.twig and "post" block works fine, but other blocks not....

Index.twig

Code: Select all
<!doctype html>
<html lang="en">
<head>
       <meta charset="UTF-8">
       <title>
          {% if record.title is defined %}{{ record.title|striptags }} | {% endif %} {{ app.config.general.sitename }}
       </title>
       <script src="/js/custom.modernizr.js"></script>
</head>
<body>
    <div class="cuerpo">
       <div class="header">
          {% block header %}
            <div id="bug-header"></div>
          {% endblock %}
       </div>
      
      <div  class="content">
         {% block post %}
            {% setcontent records = 'entries/latest/2' allowpaging %}
            {% for record in records %}
               <hgroup>
                   <h1><a href="{{ record.link }}">{{ record.title }}</a></h1>
               </hgroup>
               {% if record.image != "" %}
                  <a href="{{ image(record.image) }}"><img src="{{ thumbnail(record.image, 400, 260) }}"></a>
               {% endif %}
               <p>{{ record.excerpt(300) }}</p>
            {% endfor %}
            {{ pager() }}
         {% endblock %}
      </div>

      <div class="sidebar">
         {% block sidebar %}{% endblock %}
      </div>
    </div>


header.twig

Code: Select all
{% extends 'index.twig' %}

{% block header %}
   {{ parent() }}
   
   <aside>
      <ul>
         <li><a href="#">Twitter</a></li>
         <li><a href="#">G+</a></li>
      </ul>
   </aside>
{% endblock %}


aside.twig

Code: Select all
{% extends 'index.twig' %}
{% block sidebar %}
   <div id="navnar">
      <nav>
         <ul>
            <li><a href="#"></a></li>
            <li><a href="#"></a></li>
            <li><a href="#"></a></li>
         </ul>
      </nav>
   </div>
{% endblock %}


Thanks to all! :D
nanotime
 
Posts: 1
Joined: Wed May 22, 2013 2:25 pm

Return to Bolt Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron