Hey guys, well I have been using Laravel for a while, and decided to give FuelPHP a shot again. I had worked with it in previous but never really fully developed anything with it. Well I would like to do that now, however I'm trying to use the parser. So I downloaded PycroCMS/lex as the template engine, (also tried twig). Copied the parser.php to the app/config, enabled the packages to the auto load packages, and in the Presenter for the default hello, I put in
protected $_view = 'welcome/hi.lex';
and changed the information in the hello.php that was in the app/views, to {{ name }} however I get a error when trying to load the view.
Fuel\Core\FuelException [ Error ]: The requested view could not be found: welcome/hi.lex
Which I don't really get because the parser is loading, and the view is there with the .lex extension. I also did this with twig, and got it to work but it seemed twig stripped the html out of the layout and the design had no css or anything. Any ideas? Hope this makes since.
**Update I have fixed the issue with the loading and viewing the view. It was my issue, i didn't uncomment the autoload in config. Disregard this post, you can delete it if you want. I failed to update the asset::css too twig also. So it should have been {{ asset_css('whatever.css') }}
Ah yes, I guess its a bit confusing I found the edit button at the last moment. Everything is working, the twig is anyways, the css was my issue too I didn't wrap it around the {{}} instead it was still <?php ?>. The lex is still coming up stating that the view file doesn't exist but as long as the .twig extension is working that is what i needed. Thanks!
Updating to the parser 1.8 and lex is also working now.
New parser seems to fix the issues with the lex, and its working with twig also. Question for you, how do I make twig take the .tpl extension instead of twig? Now a big deal but would be nice to do .tpl. I know it is in the parser conf, I did try to update it so listen to the .tpl but it didn't work, so I'm assuming I'm doing something wrong there.
Okay that is what I thought and how I have been doing it, I have done that again and now I get {{ name }} instead instead of "World" or the name that you put after /hello/userdefined. Copy parser.php to /app/config and it is as follows:
Just for my understanding: - you added the above in app/config/parser.php - you have copied app/views/welcome/hello.php to app/views/welcome/hello.twig - changed the "echo $name" to "{{ name }}" - changed app/classes/controller/welcome.php, action_hello, to forge('welcome/hello.twig")
Twig works, however if I change it to .tpl it doesn't parse the {{ name }}. But i have done everything you have stated above the only difference that I did was put protected $_view = 'welcome/hello.tpl'; in the presenter of welcome.php in /app/classes/presenter/welcome/hello.php
So it is like the parser.php config file, isn't taking the new extension instead using and keeping .twig for the twig template engine.