Best way to create theme folders in Code Igniter?

I want to make my application for web applications. There are 3 ways to research:

Solution 1:

- application - views - theme1 - template files - theme2 - template files - admin template - css - theme1 - theme2 - js - theme1 - theme2 - images - theme1 - theme2 

It works well. However, when placing files in divided folders, this is inconvenient.

Decision 2

 - application - views - theme1 - css - js - images - template files - theme2 - css - js - images - template files - admin template 

And I changed /application/.htaccess to

 RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] 

It also works well, but is it good for security? (I am not good at .htaccess)

Decision 3

 - application - views - admin template - themes - theme1 - css - js - images - template files - theme2 - css - js - images - template files 

And I changed the view path to the themes folder in MY_Loader.

Sounds like a better structure. I have a problem with admin template. Becuse I also want to place admin template files in folder views as the main system, I don’t know how to make the view load function, can see files in both places.

Can all comers advise me on the best solutions. Thanks and best regards,

+4
source share
1 answer

In MY_Loader, I assume that you have expanded the view () function to look for the correct view elsewhere? If so, why not create a new function in MY_Loader with the name adminView () or something that is just a copy of the view () function, but it is looking for views in the administrator location.

In your controller, for methods that invoke special theme files, you must call:

 $this->load->view('template'); 

and when you need to call the admin template, you have to call:

 $this->load->adminView('template); 
0
source

Source: https://habr.com/ru/post/1399921/


All Articles