07975 997026 enquiries@ harpanet.com
hATS (by default) expects the following paths for certain files depending on the function called.
/theme path can be changed, the others are hard-coded. eg. the tplStylesheet() function expects the stylesheet to be found in the
css folder of the current theme.
/hAts/themefolder in your webroot (this path can be changed in your controller)
/hAts/theme/[theme_name]/cssfolder – contains theme specific css files
/hAts/theme/[theme_name]/imgfolder – contains theme specific images
/hAts/partsfolder - contains all view parts (small blocks of pHTML) (this path can be changed in your controller)
To ensure your own theme and parts files are not overwritten when hATS is upgraded, you must first rename the
hAts_default parts and theme folders.
hAts_default to a name appropriate to your theme. eg.
You may also wish to keep the hAts_default folder and simply make a copy of it so that you can use it each time you want to create a new theme from the original.
Renaming this folder depends on how you want hATS to handle your Part files.
hAts_example Controller, the following line is commented out in the
If you uncomment the above line, the name of the Parts folders will be set automatically based on the name of the Class (Controller) from which they are used.
In the hAts_example Controller, you would need to rename your
hAts_default folder to
hats_example in order for hATS to find the correct Parts.
You are free to use any naming convention (or randomness) that suits you. It is highly recommended that you use a structure that bares some resemblance to the Controller it relates to.
eg. If we are building a Log_in Controller and associated parts, it is recommended you create a Parts folder like
Then, in your Method that handles display of the user login page, say
login_page() you set the Parts folder as:
However, if you wanted different pages for User logins and Admin logins, you could create the following folder structure:
I've also thrown in a reminder folder for good measure. Now, in each of your Log_in Controller Methods, you would set the appropriate Parts path…
If you have specified a Parts folder, say
tplSet('parts', 'login/admin'); then hATS initially looks in the specified path for its Parts files.
If hATS doesn't find the file, it traverses the folder path (ie. looks in the parent folder, grandparent folder, etc.) until it finds the specified Parts file.
So, the following code…
tplSet('parts', 'login/admin'); tplAddPart('body_content');
/hAts/parts/login/body_content.phtmland so on.
Because of this, you can create default content/structure once, in a parent folder, then only override the necessary Parts in the child folders.
So, in the Log_in example Methods above, we could instead decide that
/hAts/parts/login will have all the Parts necessary to create the login page structure and show the
user_login() page (in which case we would dispose of
Then, for the
admin_login() page we simply copy
/hAts/parts/login/admin/body_content.phtml and make the necessary text/style changes. hATS will automatically find the other Parts for the page (eg.
body_open.phtml, etc.) by traversing the parent folders.
(If hATS fails to find a part by the time it reaches the root folder
/ then a warning will be shown where the part should have been displayed.)
Because of the automatic traversal/override of Parts, you should:
/hAts/parts/hAts_defaultand place them in
This will ensure that hATS always has a fallback Parts file to find if one doesn't exist in a more specific child folder.
As mentioned in REQUIREMENTS section above, it is possible to change to location of the
parts folder locations. To do this is as simple as setting new locations in two reserved hAts variables.
This would change the location for all your theme files from the default
This would change the location for all your parts files from the default
OK, you've made it through all the setup blurb, so it's time to go-it-alone…