php - Kohana - subfolders within views folder -


I'm working on the admin section of a site using Kohana. Built within an "admin" subfolder. I am also using a modified example of the Template Controller for the admin section called Admin Template Controller:

  Abstract class Admin_Template_Controller Template_Controller {public $ template = 'admin / template'; Public function __ composition () {origin: __ creation (); $ This- & gt; Template = View :: Set_filename ($ this-> Template); $ This- & gt; Template-> Css = 'adminstyles'; $ This- & gt; Template-> Js = 'html5'; }}  

However, I'm getting an error that the CSS variable is not defined in the "Admin / Template" file. At this point, the template file is similar to a template file in the view folder, which I used to successfully create more intervals, so it is not there. Apart from this, one important fact is that when I use the template file in the footage folder (for front end), this page loads correctly

This makes me believe I have to do something with the template file in which it is located in the sub folder, because I successfully load another view file from the same "View / Admin" folder

I try Is $ this-> gt; Template = View :: Factory ($ this-> Template);

To load a new template file, but it gives an error that the view should be called before the presentation. I think the auto is due to being rendered, but I want it.

Any idea would be a great help. Obviously, I can get the file out of the admin folder and change its name, but in reality it is not going to help me to know what's going on.

This line that you removed:

  $ this- & Gt; Template = View :: set_filename ($ this-> Template);  

It was breaking because set_filename () is not a static method; That method should be called on the current example of a scene because the method itself is useful for returning (chaining method) However, you do not have to do this in the first place because you are expanding the Template_Controller class, Creates a template view for the creator that you are calling with parent :: _ construct ().

If you have an existing template object, you only need to use the set_filename () method, but you want to change the view associated with it without rebuilding the whole new object.

Finally, the auto_render option runs a post controller hook rendering the view when the control is over; That there will be no effect on code within any method of controller class.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -