Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Theme PHP File Include Issue
#28
(2015-09-09, 23:12:16)shawn_a Wrote: No clue what your problem is, works fine for me.


PHP Code:
function my_get_files(){
 GLOBAL 
$TEMPLATE;
 
$folder GSTHEMESPATH $TEMPLATE '/assets/images/';
 
// $folder = GSDATAUPLOADPATH;
 
 
print_r($folder."<br/>");
 
 
$filetype '*.*';
 
$images glob($folder.$filetype); 
 
 
debugLog($images);
 
print_r($images);
}

my_get_files(); 

PHP Code:
C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/
Array ( [
0] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/break.png [1] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/facebook.png [2] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/github.png [3] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/googleplus.png [4] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/icons.txt [5] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/instagram.png [6] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/linkedin.png [7] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/share.png [8] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/tumblr.png [9] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/twitter-alt.png [10] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/twitter.png [11] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/vimeo.png [12] => C:\bin\web\dev\getsimple\hotfixes/theme/Innovation/assets/images/youtube.png 

Although I would not use glob if you are not matching patterns or subdirectories.
you can use our $images = getfiles($folder); function if you just need 1 folder or our directoryToArray() function
With glob you are going to have to strip the path off to convert to urls with basename() or something

unfortunately there s no native function to convert file paths to urls, you ahve to do that on your own

As long as I can get the names of each of the files in the directory, then that is all I need. Assembling the URL to append will be simple (The URL creation I have done, just for some reason, it is not finding any files inside the directory).


Could my issue be something to do with a .htaccess file?
Reply


Messages In This Thread
RE: Custom Theme PHP File Include Issue - by korey.badgley - 2015-09-09, 23:49:58



Users browsing this thread: 3 Guest(s)