[eluser]andrey55555[/eluser]
Hi!
HTML site’s page include many
php blocks: block_name_1, block_name_2, ... block_name_30.
And for site’s page there is array configuration: array_config( block_name_5, block_name_10, block_name_1, ....).
How make site’s page output?
Variant 1.
1. Make 30 file views. One file views is one block.
2. HTML site’s page output:
Code:
foreach ($array_config as $block_name){
$this->load->view( $block_name );
}
Variant 2.
1. Make 1 file views. File views contains switch and 30 case. One case is one block.
2. HTML site’s page output:
Call views:
Code:
$this->load->view('all_blocks', $array_config);
And then in the views all_blocks:
Code:
foreach ($array_config as $block_name){
switch ($block_name) {
case 'block_name_1':
// this is php block_name_1
break;
case 'block_name_2':
// this is php block_name_2
break;
...
case 'block_name_30':
// this is php block_name_30
break;
default:
break;
}
}
So, variant 1: load 30 files. Variant 2: load 1 file, but 30 times switch and 30 case ....
Which variant is best ?
Which variant is faster ?
Thanks