Home    | Software    | Articles    | Tips'n Tricks    | Contacts    | Support Us  
Home arrow Tips'n Tricks arrow Various arrow Simple templating with GooglePages

Simple templating with GooglePages

If you are publishing more than a couple of pages on GooglePages, you will soon find yourself changing small things on all your pages over and over. As far as GP doesn't support server side includes, we can use javascript to simulate a simple templating system. This way we could reuse common html(i.e. titles or menus) and when in need just make changes in one file to see them reflected on all our pages. All we need is javascript document.write method to include html in our pages.
A simple example: let's save the following

document.write("<font color=red>JS include test</font>")

in a file, say "test.js" . After uploading it in our GooglePages creator (uploaded stuff section), when editing a page, choose an editable field, click "Edit HTML" from the left palette and add:

<script src="test.js" type="text/javascript"></script>

That's all. If we add the same file in more than one page, we just need to change test.js to have all of our pages automatically updated.
 
< Prev   Next >

  Articles RSS feed

Latest Articles
Latest Software
   
designed by allmambo.com