Directory Helper Question |
I am using the codeIgniter directory helper but have small question.
When I display my images and directory's in my foreach loop $image variable is a directory it throws error. Error Message: Array to string conversion I have attached image of error. PHP Code: array (size=5) As shown in var dump sub folder is directory but when I echo out the foreach loop it throws error for that directory. Any suggestion I need to display sub directory and images. Images I can display fine PHP Code: <?php View PHP Code: <div class="container" style="margin-top: 20px;">
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Try casting $image ie; (string) $image etc;
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
but if you have images in your subfolder, you can use a recursive method.
a recursive methods is a method who call itself PHP Code: $images_directory = directory_map('./images/catalog/', FALSE, TRUE); i'm not sure this methods work like that. i writted it from scratch. but this is how to do a recursive method.
(02-04-2016, 09:42 AM)keulu Wrote: but if you have images in your subfolder, you can use a recursive method. I am just a bit confused will that let me still display the folders as well as images and there file names?
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
(02-04-2016, 03:34 AM)InsiteFX Wrote: Try casting $image ie; (string) $image etc; Seem to have it working now by using scandir and array_diff PHP Code: <?php
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |