• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About layout creation with renderSection

#1
For the more experienced ...  Blush
Is it worth using "renderSection()" instead of just "echo view()"?

https://codeigniter4.github.io/CodeIgnit...youts.html
Reply

#2
It makes more sense to use a template with renderSection() and echoing only one view in the controller than having to echoing a view for the header, then your content, then the footer, etc.
Test your translation files with Translation Tester
Reply

#3
Is it possible to cache the layout? Example: cache($this->extend('layouts/layout_site'))

<?= $this->extend('layouts/layout_site') ?>
<?= $this->section('content') ?>
<h1>Hello World!</h1>
<?= $this->endSection() ?>
Reply

#4
You can cache the whole page with $this->cachePage($n);
https://codeigniter4.github.io/userguide...ching.html
Test your translation files with Translation Tester
Reply

#5
Yes. Very good cachePage(). But it caches the whole page. And it works only within methods.
I wanted the cache only in $this->extend() which would be the layout.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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