• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI4: what the use of esc inside view

#8
(07-26-2018, 06:17 AM)kilishan Wrote: A question, though - what do you mean "accept min.html as template view"? You should be able to do everything that you could with CI3, and if not, I'd like to see about fixing that in the core.

on CI4 on system/View/View.php has this line (about line 170)
PHP Code:
$this->renderVars['view'] = str_replace('.php'''$view) . '.php'
As I see on docs, it accept template file as php file (You call it views, but I don't want to get confused with view controller or renderer).
If I have .html, then it thinks my file as min.html.php which not exist.

So I change into this (as in CI3)

PHP Code:
$fileExt pathinfo($viewPATHINFO_EXTENSION);
$realPath = ($fileExt === NULL) ? $view.'.php' $view;
$this->renderVars['view'] = $realPath
So it adds .php only if template file doesn't have extension.
If you ask why I didn't use php? Because minify tool on netbeans can picks .html and rename to .min.html (cannot rename to .php).

we don't need to send comments and empty space, so it will reduce some data to send. Also stripping with php script takes time, better we stripped it before serving the pages to user. Also you can compress some image to reduce more (stripping EXIF data if not needed, compress png, vacuuming svg, etc)
Reply


Messages In This Thread
RE: CI4: what the use of esc inside view - by anthos1984 - 07-28-2018, 12:48 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.