0

I’ve added a file inside App/icons/icons.php which has an array

<?php

$skills_icon = array(
‘one’,
‘two’,
‘three’
);

I have added the icons.php file in functions.php

array_map(function ($file) use ($sage_error) {
    $file = "../app/{$file}.php";
    if (!locate_template($file, true, true)) {
        $sage_error(sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file), 'File not found');
    }
}, ['icons/icons','helpers', 'customizers/intro', 'customizers/skills', 'widgets/skills']);

and in my views home.blade.php I want to recieve array values values from it.

{{ var_dump($skills_icon)}}

But im receiving NULL values.

Anything I'm missing?

MelbDev
  • 355
  • 1
  • 5
  • 12
  • Is the file correctly loaded? Mean you can die(); inside it, and it'll be executed? – Mtxz Nov 20 '20 at 22:21

1 Answers1

0

If you are sure that your file is loaded, have you try putting your data in a method that returns the data, and then call this method?

You could also add your file as a config/file.php, by adding it at the end of the function.php file with the others. And then call it with config() helper normally.

Mtxz
  • 3,749
  • 15
  • 29