Library
Web Appearance
The web pages supplied by Fieldpine can be altered and even totally replaced. There are mulitple ways this can be done, and which is best depends on your circumstances and skill level.
Security note. If you are using a fieldpine domain eg mystore.fieldpine.com or similiar, you cannot supply custom default_header.js and default_footer.js files. Fieldpine servers will always return empty files. This is to restrict your ability to cross subdomains. We recommened using a custom domain anyway, so this rule rarely applies. You also cannot use urlSpace to reference external web sites at all.
Applying Site Specific CSS
Most Fieldpine web pages include a link to a site specific CSS file that you can replace.
Pro:
- Easy if only changing fonts and colors
- Can be centrally deployed within a franchise setup, stores can manually override
- Cannot add items to page (unless you write some javascript) and isnt always simple to remove items
<link href="/report/theme/fieldpine/fieldpiness.css" rel="stylesheet" type="text/css" id="fieldpine_css_default"> <link href="/site/default.css" rel="stylesheet" type="text/css" id="site_css_default"> <script src="/site/default_header.js"></script>
If you create a default.css this will be loaded automatically into fieldpine pages. You can only include one CSS file. If a default.css does not exist, Fieldpine servers will generally send an empty response rather than a 404 not found error.
Web pages also will include two site specific Javascript files, one in the header as shown above, and one in the footer called default_footer.htm These two script files can be used for many purposes, but can remove the fieldpine default css file with Javascript similar to this
const fieldpinecss = document.getElementById("fieldpine_css_default");
if (fieldpinecss) fieldpinecss.remove();
Using A Template
Fieldpine Web servers can load an use a "urlSpace" which is a map of URIs to actual resource to load
Pro:
- Powerful
- Can be centrally deployed within a franchise setup, stores cannot override
- Potential maint effort as versions change
With a template, the Fieldpine web server sees the original HTTP request, say /report/pos/sshome.htm and looks into the urlspace map for a processing rule. If no rule is found, the page loads as normal. Url rules can be simple, such as fetch https://someothersite.com/report/pos/sshome.htm and display that, or use a template to generate the page content dynamically.
A template showing a external file load, a 302 redirect, a 404 page not found and finally a template reference
{
"/report/pos/sshome.htm": "https://headoffice.example.com/report/pos/sshome.htm",
"/report/pos/sshome_products.htm": "302,/report/pos/sshome.htm",
"/report/pos/cfg/*": 404,
"/default.htm": {
"template": "https://headoffice.example.com/templates/home.htm",
"templatename": "homepage"
}
}
External file loads, cause the server to silently fetch the target page and return that as the page content
A urlSpace template rule can be created for /site/default.css as described in the preceeding section.
{
"/site/default.css": "https://headoffice.example.com/site-master/default.css",
"/site/default_footer.js": "https://headoffice.example.com/site-master/default_footer.js"
}
urlSpace templates can be defined seperately for each domain.
Franchise servers can send a single reference setting to all members to apply
a urlSpace template to them, you do not have to define each one individually.