Im trying to read css files from a directory and create the respective html markup, like
<link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.css">
PHP
$css_dir = 'application/resources/css';
$fp = opendir($css_dir);
while ($file = readdir($fp))
{
if (strpos($file, '.css',1))
$results[] = $this->base.'/'.$file;
}
closedir($fp);
print_r($results);
this works correctly creating an array with results like [1] => Directory/name.css which is fine but if I change the results line to something like
$results[] = '<link rel="stylesheet" type="text/css" media="screen" href="'.$this->base.'/'.$file.'">';
I get am empty array, the problem is with the '<' '>' symbols is there no way to do this in one go without having to then do a foreach through the results array?
<link ..>probably won't show on the screen - but nevertheless it should work. However, it can be simplified by usingglobecho '<pre>' . htmlentities(print_r($results, true)) . '</pre>';to see the results literally.