Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9169491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:53:12+00:00 2026-06-17T15:53:12+00:00

Ok. I use Twig as a View engine and Phalcon version is 0.8 Code

  • 0

Ok. I use Twig as a View engine and Phalcon version is 0.8

Code of adapter I got from this repository: github I made ​​a small modification in this code because I include Twig via composer. I will not describe these modifications because they are not significant.

So. My directory structure of view is very simple:

app
- views
--- index.twig
--- about
---- index.twig

Source of views/index.twig:

<html>
<head>
    <title>Phalcon PHP Framework</title>
</head>
<body>
    {% block content 'This is main page' %}
</body>
</html>

And source of views/about/index.twig:

{% extends "index.twig" %}

{% block content %}
    This is About page
{% endblock %}

Also, I have controller About (AboutController.php) with single method

public function indexAction()

it’s empty.

Ok. Now. When I do a request for a page /about I expect to see there something like this:

This is About page

But I still see there content of views/index.twig:

This is main page

It’s a bit strange to me. I reassign the block “content”!

I did some checking in the template views/about/index.twig adding extra characters out of the block and I received an error from Twig:

A template that extends another one cannot have a body in "about/index.twig"

So. Any ideas?

P.S. I think I should call in tpl views/index.twig method {{ content() }} but Twig knows nothing about this method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:53:12+00:00Added an answer on June 17, 2026 at 3:53 pm

    The problem was that I was not good enough to read the documentation!

    To solve my issue I had to use render levels of templates in View component: official docs

    To use the built-in export function in Twig and use a powerful mechanism of inheritance of this engine,
    we must set level render:

    $view->setRenderLevel(Phalcon\Mvc\View::LEVEL_ACTION_VIEW); 
    

    In this case, the engine will immediately process the contents of the template action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use message placeholders with Twig template engine. My navlist.it.yml stores this
I'm trying to use translation in a custom twig filter like this public function
I have coding from someone that make a alerts bootstrap use twig not php,
I am trying to use twig json_encode function but when I do this var
Is there a good way to indicate incorrect use of Twig macro from inside
I've been learning how to use Twig, as per this site . This is
Is it possible to use Twig in Silex from Symfony2 project instead from the
When I am trying to use the TWIG {% javascript %} tag to link
I am trying to use teh Twig i18n Extension. As far as I can
i'm having a problem when i want to use split function in Twig, i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.