TWIG error

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

I'm trying to use TWIG in my system I'm building as the templating engine, and I have got it working pretty well, until I started trying to get the CSS parsed as well. Here is what I have done, and it seems to be working pretty well (most of the solutions are what I found on the net).

I've created a template class that I call that uses uses the given variables I send to it, configures them and sends them to TWIG. (This part works, my HTML template pages gets parsed and everything).

I've created a mod_rewrite to point all my css files to a different php file that sends them to TWIG for parsing. Here is how the mod_rewrite looks like:

Code: [ Select ]
<IfModule mod_rewrite.c>
  RewriteEngine On
  
  RewriteRule (.*/.*\.css)$ ./parse_file.php?file=$1 [NC]
</IfModule>
  1. <IfModule mod_rewrite.c>
  2.   RewriteEngine On
  3.   
  4.   RewriteRule (.*/.*\.css)$ ./parse_file.php?file=$1 [NC]
  5. </IfModule>


That is working. It is sending the css filename (style.css) onward to parse_file.php?file=style.css

I then created the parse_file.php to parse the css and return it with text/css headers

And it doesn't work... I go to view source and click on a stylesheet to view it's source I get the following:

Quote:
<br />
<b>Fatal error</b>: Uncaught exception 'Twig_Error_Loader' with message 'Unable to find template &quot;templates/default/styles/style.css&quot; (looked into: ./templates/default/styles).' in C:\xampp\htdocs\www\cms\twig\Loader\Filesystem.php:202
Stack trace:
#0 C:\xampp\htdocs\www\cms\twig\Loader\Filesystem.php(138): Twig_Loader_Filesystem-&gt;findTemplate('templates/defau...')
#1 C:\xampp\htdocs\www\cms\twig\Environment.php(265): Twig_Loader_Filesystem-&gt;getCacheKey('templates/defau...')
#2 C:\xampp\htdocs\www\cms\twig\Environment.php(323): Twig_Environment-&gt;getTemplateClass('templates/defau...', NULL)
#3 C:\xampp\htdocs\www\cms\twig\Environment.php(292): Twig_Environment-&gt;loadTemplate('templates/defau...')
#4 C:\xampp\htdocs\www\cms\includes\template.php(63): Twig_Environment-&gt;render('templates/defau...', Array)
#5 C:\xampp\htdocs\www\cms\parse_file.php(20): template-&gt;render('templates/defau...', Array, true, 'styles/')
#6 {main}
thrown in <b>C:\xampp\htdocs\www\cms\twig\Loader\Filesystem.php</b> on line <b>202</b><br />

The file "style.css" is located in "templates/default/styles/style.css" (just like it says in the error that it doesn't exist there). The file is in fact, there... just TWIG doesn't seem to be finding it... even though it says that it is looking for it there... I don't know what to do next... where to look or what.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

This post I made gives a bit more detailed information.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 77 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.