Fatal error: Class 'Tag' not found and PHTML views created instead of VOLT

Hi,

I'm using Phalcon for the first time to test its features/performances, I'm currently using YII for my projects so I'm quite familiar with MVC-ish frameworks like this.

Now I've the 64bit VC9 version installed on PHP5.4 (WAMP) and webtools cloned from GIT.

I've created a simple app called dummy with the CLI (phalcon create-project dummy --enable-webtools) and a couple of tables in the db. I've used the webtools web pages to create the models (only one called users) and the scaffold. First weird thing I've noticed is that PHTML views were created instead of VOLT (the project was created with VOLT while the scaffold not).

Now when I browse through localhost/dummy/users all I get is an error as follow:

Fatal error: Class 'Tag' not found in E:\dev\wamp\www\dummy\app\views\users\index.phtml on line 28
Call Stack
#   Time    Memory  Function    Location
1   0.0003  252520  {main}( )   ..\index.php:0
2   0.0019  288920  handle ( )  ..\index.php:27
3   0.0048  397496  Phalcon\Mvc\View\Engine\Php->render( )   ..\index.php:0

the index.phtml indeed call for the tag class after the getContent() call:

<div align="right">
    <?php echo $this->tag->linkTo(array("users/new", "Create users")) ?>
</div>

I've searched this error and could only find one reference on stackoverflow, saying that the TAG class should be injected in the bootstrap via the DI object. It also mentioned that the new version of webtools will have this corrected, the question was from sometime in 2012 so I guess by now this has been corrected.. yet it doesn't work.

Shall I inject the tag class with DI in the bootstrap manually? How exactly?

What Phalcon version?

$this->tag in "view" added in Phalcon 1.2.0



1.4k

it's version 1.2.1, downloaded today from the webside



1.4k

I'm not quite sure as why the tag class doesn't work even though I'm using a version where it should. But the why the webtools does not generate the views in VOLT perhaps it's related to this statement in /webtools/scripts/Phalcon/Builder/Scaffold.php on line 201

if ($options[&#039;templateEngine&#039;] == &#039;volt&#039;) {

where do you set this option? there are some predefined in the build() method and it assign to the variable $options the property $this->_options since the class Scaffold extends the Component class i guess it's something you can set via the config.php. I'm trying to search in the documentation but can't find anything related. Any idea?



1.4k

I've reinstalled everything from scratch (using composer this time) and I'm still getting the same issue. PHTML views generated by the WebTools scaffolding instead of VOLT file and $this->tag not working in the created views. in the webtools/scaffold page after creating the views I get this error:

Notice: Undefined index: templateEngine in C:\Users\pingala\Desktop\webdev5.4\htdocs\composer\vendor\phalcon\devtools\scripts\Phalcon\Builder\Scaffold.php on line 201

together with the flash message saying that: Scaffold for table "users" was generated successfully



1.4k
edited Oct '14

I just discovered I can force devtools to use the VOLT template engine via CLI this way it generates VOLT views, however the result it's messed up anyway as getters/setters are not used :(

C:\Users\pingala\Desktop\webdev5.4\htdocs\dummy>phalcon scaffold --table-name=users --get-set --force --template-engine=volt

Phalcon DevTools (1.2.1)

C:\Users\pingala\Desktop\webdev5.4\htdocs\dummy\app\config/../../app/views/users/index.volt
C:\Users\pingala\Desktop\webdev5.4\htdocs\dummy\app\config/../../app/views/users/search.volt
C:\Users\pingala\Desktop\webdev5.4\htdocs\dummy\app\config/../../app/views/users/new.volt
C:\Users\pingala\Desktop\webdev5.4\htdocs\dummy\app\config/../../app/views/users/edit.volt
   {% if page.items is defined %}
    {% for user in page.items %}
        <tr>
            <td>{{ user.id }}</td>
            <td>{{ user.username }}</td>
            <td>{{ user.password }}</td>