Welcome Guest, Not a member yet? Register   Sign In
[split] viewPaths
#1

(This post was last modified: 03-17-2016, 08:28 PM by ciadmin.)

Why don't you have multiple viewPaths in CodeIgniter\View\View class?

If we can set multiple viewPaths, we can do like this:
CI can search in the module viewPath first, and if not exist, next search in application/views.
Reply
#2

(03-16-2016, 03:22 PM)kenjis Wrote: Why don't you have multiple viewPaths in CodeIgniter\View\View class?

If we can set multiple viewPaths, we can do like this:
CI can search in the module viewPath first, and if not exist, next search in application/views.

It doesn't seem necessary at this point. Next to database access, file access is one of the slowest aspects a website's performance. And the "module" solution that I described was never intended to a full blown module system. We're not a CMS, after all Smile

And that's not what CI has ever really been about. But CI has always been a very declarative, explicit system where, while reading the code, you pretty much always knew what was going on.

You can access any view anywhere on your server with the current solution, so there doesn't seem to be a need to loop through a bunch of different locations for every single call. I fully expect that many people will swap out the current view system for a third-party template engine, anyway.

For now, keeping the core light (and more flexible than it's ever been) feels the like the right thing to do. I may be proven wrong down the road, but we'll wait and see.
Reply
#3

(03-16-2016, 05:33 PM)kilishan Wrote: I fully expect that many people will swap out the current view system for a third-party template engine, anyway.
Yeah, I also expect many users will use template engine with auto-escaping.
I think plain php view makes a lot of XSS vulnerabilities.
I stopped using php view.
Reply
#4

@kenjis

For templating PHP can be used, but it needs sort of "upgrade". Here is another interesting project for that: https://github.com/FoilPHP/Foil
Reply
#5

Thanks!
Foil seems to be much better than plain php view.
http://www.foilphp.it/docs/DATA/RETRIEVE-DATA.html

But I have seen the code like this in view in real production code:

<?php echo $_GET['keyword']; ?>

It is grammatically correct PHP code, so it works in where you can write PHP code.
I think template engines which you can't write PHP code in view at all are safer.
Reply
#6

@kenjis

Yes, I agree.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB