SaranacLake Posted December 6, 2019 Share Posted December 6, 2019 @requinix, In an earlier thread of mine this week, I think you - or maybe it was @Psycho - suggested putting my code which create an array of my photo files into an include file. I think the logic was that then when either my "photo-gallery.php" OR "photo-detils.php" scripts call that code, that the array will always synched because it is the same array. Ring a bell? So super newbie question, but I am rusty on includes... How does this sound... 1.) Create an "/includes/retrieve-photos.php" script? 2.) Reference that in each script, I would do this... require_once('../../includes/retrieve-photos.php right? 3.) To use that code, I would then just reference the populated array... foreach($photoFiles as $photoKey => $photoValue){ } Right? Quote Link to comment https://forums.phpfreaks.com/topic/309642-include-for-array-code/ Share on other sites More sharing options...
requinix Posted December 6, 2019 Share Posted December 6, 2019 That all sounds very consistent with the "putting code which creates the array into an include file" strategy. Quote Link to comment https://forums.phpfreaks.com/topic/309642-include-for-array-code/#findComment-1572279 Share on other sites More sharing options...
SaranacLake Posted December 6, 2019 Author Share Posted December 6, 2019 3 minutes ago, requinix said: That all sounds very consistent with the "putting code which creates the array into an include file" strategy. Taking a stab at it now... Quote Link to comment https://forums.phpfreaks.com/topic/309642-include-for-array-code/#findComment-1572280 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.