Multiviews

From Aikiframework wiki

Jump to: navigation, search

A view is the same site with a different presentation: visual style, layout, less information per page.

You can use view for:

  • making different graphic style: mysite.com/bluemarine, mysite.com/tangerine
  • creating different layout: mysite.com/two-columns, mysite/small
  • adapt site for different devices: mysite.com/tablet
  • mysite.com/text-only.

A site could have multiple view. The view is given in pretty url, after site ,and before language, or as "view" variables. Example:

www.mysite.com/retailers/tablet    (tablet is view)
www.mysite.org/text-only/es
www.mysite.org?language=fr&view=bluemarine

To render view, this this techniques can be used:

a) every widget can be assigned to one or more view. A widget without view assigned is available for all views.

b) CSS for every widget can be filtered by view, using a special markup. Example:

(css(bluemarine:
 body { background: bluemarin..);.
)css)

c) in widget content a view markup will be added for filter by view. Example:

 (view(text-only:           // for text-only view.
 <p>[[picture_caption]]
 ))view))

 (view(!text-only:      // for the rest.. ! means no..
 <img src="images/[picture_caption]
 )view)

 (view(mobil,tablet:
 ...code for mobil and tablet
 )view)

d) a new variable will be added to aiki [view].


Using a) technique a developer can create different layout for each view. He only needs change a few 'main' widget, and then can re-used the rest widget.

Using b) you can create easily different css for each view, without touching the widget content.

Using c) you can make little changes in a widget, instead rewrite it, for generate similar but different output: a home page without some block, or with a shorter list of items, without img). The main difference between a) and c) is that c maintain relationship between father and sons widget.

The "(view(" markup must be parser prior rest of markup to permit a total backward compatibility.

Some conclusion:

  • view can be rendered as different site...but all widget must be rewritten or copied, and maintenance would be harder.
  • view must economize write of new widget.
Personal tools