CodeIgniter Forums

Full Version: CI 3.1.0 - parse folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi forum,

Actually In my Index controller i have $data with among others :
PHP Code:
'sectionFiles'            => ['rightmenu''home_slider''infobox''seoscore''home_offers''video_feature''services_blocks''counters''home_expertiseintro'],

In views/site/sections I cut each page into several files and in the file template.php I have :

PHP Code:
// ===== DYNAMIC TEMPLATE =====

if (isset($sectionFiles) && !empty($sectionFiles)) {
        foreach (
$sectionFiles as $file) {

// ===== END - DYNAMIC TEMPLATE =====

I would add some php code to :
1. parse site/sections/
2. make an array
3. compare with $data
4. display only files who are featured in $data

Could oyu please help me ? Huh

Regards and nice da y ! Huh
Why do you need to compare it? It will only loop through whatever you put in it.
So delete some values from sectionFiles and it will not load them.