Site:Frontend:BestPrices

From Metrixstream
(Difference between revisions)
Jump to: navigation, search
(Created page with "= 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 lin...")
 
(Readability and Whitespace)
 
Line 4: Line 4:
  
 
This
 
This
   <h1>News</h1>
+
   <nowiki><h1>News</h1></nowiki>
 
   <?cs if:News ?>
 
   <?cs if:News ?>
 
     <?cs call:showNews() ?>
 
     <?cs call:showNews() ?>
Line 10: Line 10:
  
 
Would turn into
 
Would turn into
   <h1>News</h1><?cs
+
   <nowiki><h1>News</h1></nowiki><?cs
 
   if:News ?><?cs
 
   if:News ?><?cs
 
     call:showNews() ?><?cs
 
     call:showNews() ?><?cs

Latest revision as of 10:27, 18 June 2012

[edit] 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.

[edit] 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