Domanda

Description: The title is not as describable, but couldn't think of a better one. I have made myself a view processor that compiles the view (I am using tailored MVC) and the problem that I have is that when it 'compiles' the view ie (capture the output before rendering it (trimming + compression at high level)). Anyway this works as expected with no issues, but when the view compiler hits a dynamic page it ain't dynamic anymore ie. if I use the same template for two pages or the content is based on the user viewing the site, he will see the compiled version of the prev user instead of the one that he is supposed to be seeing. Here is my method at the moment:

  1. determining the view which is to be rendered based on the routes
  2. Starting gz_compression
  3. including the template
  4. Capturing the output in a variable for rendering when necessary
  5. Clean the gzip buffer

Question: What I exactly want is a method to add 'instructions' to the compiler, whether or not the file should be compiled and saved or rendered directly.

PS:

I couldn't think of any pattern that will do the trick as long as it does not require the creation of separate models and such, any option is acceptable and a simple implementation would be very good. Sorry for my bad english it is not my native.

Cheers!

È stato utile?

Soluzione

I have added a 'switch' variable that defaults to TRUE (compile by default), and a static method to turn it off when necessary. This is a good walkthrough for the moment, anyway nay better suggestions are welcome.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top