• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI4: How to run modules in views?

#1
Hi every! I have question - how calling Modules methods in views in CI4? For example in CI3 + HMVC, i am writing this line code "modules::run('blog/posts/get_posts', 10);" it returns array of posts. But how to do it in CI4 a can't found in manual ( https://codeigniter4.github.io/userguide...ht=modules ) and this post ( http://blog.newmythmedia.com/blog/show/2...eIgniter_4 ) not help too.
Reply

#2
I believe what you're looking for are our View Cells.
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#3
(04-23-2019, 06:35 AM)kilishan Wrote: I believe what you're looking for are our View Cells.

Yes. I've read about view_cell. It's a good decision, but this function returns the generated HTML as a string. But I've needed data array, not as string (HTML). Maybe are there any other variants? Thanks for answering.
Reply

#4
Whatever you call in the cell can generate the HTML. Use a view partial for whatever you want to display and generate that within the modules method, then return the generated HTML to cell.

That's the only variant we have, but that should work, right?
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#5
(04-23-2019, 10:44 AM)kilishan Wrote: Whatever you call in the cell can generate the HTML. Use a view partial for whatever you want to display and generate that within the modules method, then return the generated HTML to cell.

That's the only variant we have, but that should work, right?

Yes this variant with view_cell good work for me too. Maybe I'm just used to CI3+HMVC and think by the standards of this version. Thanks a lot for clarification about this functional. P.S. I'm waiting for your book https://leanpub.com/codeigniter4foundations. I hope is coming soon)
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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