Site:Frontend:BestPrices

From Metrixstream
Revision as of 10:27, 18 June 2012 by MetrixJustin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Readability and Whitespace

Keeping one line of clearsilver per line ends up being hard to read, as well as added markup since each line of clearsilver turns into a blank line in the finalized document. To keep things neat we wrap the beginning clearsilver line with the line above it.

This

 <h1>News</h1>
 <?cs if:News ?>
   <?cs call:showNews() ?>
 <?cs /if ?>

Would turn into

 <h1>News</h1><?cs
 if:News ?><?cs
   call:showNews() ?><?cs
 /if ?>

This keeps the white space away and you can easily scan the beginning of each line to clearly see what is happening in the code.

Site and Module Controllers

Each site should have a siteController.js file containing all the javascript required to run the site. Each stand-alone module will also have its own controller managing functions specific to that module.

The controller is made up of classes that control different parts of the site/module. This allows us to only enable functions and listeners that are required on the page, instead of having them always active. This also ensures that when concatenating the javascript file that function and listeners wont overlap.

Personal tools