0

I wish use this template engine in phalcon 2.0. I created project via phalcon-devtools - should be fine. This template engine doesn't work. The default is *.phtml it works but I wish volt. Now project has this hierarchy:

phalcon-project folder:

- public
  - index.php
- config
- apps
  - frontned
    - controllers
    - models
    - views
      - index 
        - index.volt
      - layouts
        - main.volt
  - backend
- cache

index.volt looks like:

{% extends "layouts/main.volt" %}

{% block content %}test{% endblock %}

and layout - main.volt contains this:

{{ content() }}

In this way I get empty, blank page. Can you help me? Thanks in advance.

betty39johnson
  • 151
  • 1
  • 2
  • 12
  • did you register the volt engine in your services.php? https://docs.phalconphp.com/en/latest/reference/volt.html#activating-volt – Timothy Apr 13 '16 at 06:44
  • yes I did, I don't know what is wrong :( – betty39johnson Apr 13 '16 at 06:47
  • Hi there, First try to make layout folder for your needs (where u initialize volt): just example ```$view = new View(); $view->setViewsDir($config->application->viewsDir); $view->setLayoutsDir('_layouts/');``` ... after, in that folder create file index.volt and place inside {{ content() }}. Now in your index folder, modify index.volt with just "test" content :) i think will be fine now. – Boris Delev Apr 13 '16 at 18:20

1 Answers1

0

Hi save your life finding issue here i've build in past AutoRouting feature with what you can easy build, multimodule application with automaticrouting.

https://github.com/softdream/Phalcon-autorouter

Enjoy, soon i'll update repository with rest routing features and repair english in explanation. Hope this will help you.

In your case

In your case this is looks more like problem in default settings of main template and index template and directory where the templates have to be located.

If you want to keep your solution please provide following to help us to advice you:

  1. Bootstrap implementation of view or in specific module
  2. Settings of directory folders for templates
  3. main.phtml layout template and structure of that folders
Kamil
  • 990
  • 1
  • 7
  • 24