CodeIgniter Forums
Loading a indented view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Loading a indented view (/showthread.php?tid=64125)



Loading a indented view - Douglas Diniz - 01-17-2016

How can I indente the generated code when I load a view?

I'm indenting all the source code, but when the view is loaded some points (where exist any variable) are poorly indented.

Exists some function to fix this?

PS: Sorry for any wrong written word, I am not so good in English. Blush


RE: Loading a indented view - Diederik - 01-18-2016

You can use a the php module php-tidy (http://php.net/manual/en/tidy.examples.basic.php) for this, or you can use a class like HTML Purifier (http://htmlpurifier.org/).

But I would not advise this just because it makes your HTML code look pretty if someone views your source. It takes quite some load and time to process this.

Since these options also alter your HTML generated code they will fix some simple issues like a missing closing tag, thats why if you decide to use this you will have to use it in production environment as well.