Please bear with me while I try to explain
I currently have a PHP page that I’ve added as a snippet and it works perfectly when called from the page, but I’d like to make it work from the one snippet on many areas of my site. I have a football (Soccer) site which is separated into seasons, I have stats of league table, home and away form and more etc. in each season, currently I have identical pages in each season with only the years changed so they pick up the .csv data used to generate the pages.
i.e.:
$handle = fopen("assets/includes/2006-2007/stats/leaguetable.csv", "r");
$handle = fopen("assets/includes/2007-2008/stats/leaguetable.csv", "r");
etc.
Rather than create snippets for each season I’d like to get the snippet to pick up the parent folder name (i.e. 2006-2007) and add it to the link listed above so that no matter which ’folder’ the snippet was being called from it would select the correct data file. So as an example the link would be in the format of
$handle = fopen("assets/includes/(InsertParentFolderName)/stats/leaguetable.csv", "r");
I am no PHP programmer and have trawled the forums for hours, going cross eyed, without anything slapping me in the face saying ’do this dumbass’ so would like to call on help for ideas/answers/slaps.
Also is it possible to do something like this in the Long Title field when creating a document so I can then create all the docs for one season and then duplicate as many seasons as required to populate the site.
i.e. League Table (InsertParentFolderName)
Many thanks for any help offered