We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Is it possible volt syntax by code tracking in Netbeans IDE?

Hi guys,

Is it possible to use volt syntax by code tracking?

For instanceļ¼š When I visit https://localhost/invo/

I guess phalcon operating process like this:

invo/.htaccess/public/.htaccess invo/app/IndexController.php->initialize()->indexAction()->views->index.volt->{{ content() }}->index/index.volt->{{ content() }}

.......I got lost.

There are many" {{ content() }}" , priority is vague.

https://github.com/phalcon/invo/tree/master/app/views

1.app/views/index.volt

<!DOCTYPE html> 
<html>
    <head>
        <meta charset="utf-8">
        {{ get_title() }}
        {{ stylesheet_link('bootstrap/css/bootstrap.css') }}
        {{ stylesheet_link('bootstrap/css/bootstrap-responsive.css') }}
        {{ stylesheet_link('css/style.css') }}
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="Your invoices">
        <meta name="author" content="Phalcon Team">
    </head>
    <body>
        {{ content() }}
        {{ javascript_include('js/jquery.min.js') }}
        {{ javascript_include('bootstrap/js/bootstrap.js') }}
        {{ javascript_include('js/utils.js') }}
    </body>
</html>

app/views/index/index.volt


{{ content() }} 
<div class="hero-unit">
    <h1>Welcome to INVO</h1>
    <p>INVO is a revolutionary application to create invoices online for free.
    Receive online payments from your clients and improve your cash flow</p>
    <p>{{ link_to('session/register', 'Try it for Free &raquo;', 'class': 'btn btn-primary btn-large btn-success') }}</p>
</div>

.|)

I was confused when I first started with Phalcon but as I understand it the View is processed as follows:

views/index.volt this will be processed before any other view, this should contain your layout for your pages such as a header/footer with {{ content() }} where the content from your controller view will be placed.

Then if you have an IndexController with an IndexAction the next view to be processed will be views/index/index.volt - the content from here will displayed where you put {{ content() }} in your views/index.volt. If you have an action in IndexController called PostAction this will use views/index/post.volt and so on.

If you have a controller named BlogController with an IndexAction the next view to be processed will be views/blog/index.volt and as above, the content will be displayed in your views/index.volt where you placed {{ content() }}

Hope this helps.



10.3k

Thank you very much.Yes it helps a lot.