Recommend this page to a friend! |
Classes of Barton Phillips | Simple Site Class | docs/files.md | Download |
|
DownloadAdditional Files User by SimpleSiteClassThe 'mysitemap.json' FileThe 'mysitemap.json' file is the site configuration file. 'siteload.php' loads the 'mysitemap.json' file that is in the current directory. If a 'mysitemap.json' file is not found in the current directory the parent directory is searched and this continues up until the DocuementRoot is searched and if still not found an exception is thrown. Once a 'mysitemap.json' file is found the information in it is read in via 'file_get_contents()'. The information from the 'mysitemap.json' file is converted into a PHP object and returned. My usual directory structure starts under a 'www' subdirectory. On an Apache2 host the structure looks like this:
If I have multiple virtual hosts they are all off the '/var/www' directory instead of a single 'html' directory. How the xxxFile files lookIn the 'mysitemap.json' file there can be three elements that describe the location of special files. These files are 1) 'headFile', 2) 'bannerFile' and 3) 'footerFile'. I put the three special file in my '/var/www/html/includes' directory (where 'html' may be one of your virtual hosts and not named 'html'). Here is an example of my 'headFile':
All of the $h properties are created by _SimpleSiteClass_. These 'xxxFile' files return their contents. You can ignore using $h values and just have standard html in the files. You will see, if you delve into the SimpleSiteClass code, that many things can be passed to the getPageTopBottom method, and the various sub-methods, but the standard things are:
As you saw in example 5 (example5.php in the 'examples' directory) I set the properties of $S before calling
As these special files are PHP files you can do anything else that you need to, including database queries.
For example, to do a query do I usually call these files 'head.i.php', 'banner.i.php' and 'footer.i.php' but you can name them anything you like. In the 'mysitemap.json' just add the full path to the file. For example:
Note, the mysitemap.json is not really a JSON file because you can add comments to the file. There is a default for the head, banner and footer section if you do not have special files.
The DOCTYPE is by default Creating the special files make the tedious boiler plate simple and yet configureable via the $S properties. Examples SimpledbTables SimpleSiteClass Methods Additional Files Index Contact MeBarton Phillips : bartonphillips@gmail.com Copyright © 2024 Barton Phillips Project maintained by Barton Phillips Last Modified January 6, 2024 |