Using CodeIgniter is it bad practice to load a view in a loop

后端 未结 3 1753
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 09:45

I just got started with CodeIgniter and am wondering will it slow things down if I put code like this in a loop.

    $data[\'title\'] = \'the title\';
    $d         


        
3条回答
  •  生来不讨喜
    2020-12-20 10:24

    Think about moving loop from controller to the view file (at controller you must prepare all data before load view file). You will have only one call for loading view file, and in the view file you can print out info in the loop cycle as you want.

提交回复
热议问题