Skip to content
Ali Gangji edited this page Jan 4, 2015 · 1 revision

Elements like templates, views, layouts, and content are the basic building blocks of presentation. All of these templates within Starbug are just PHP files. No template languages are ever used.

On top of these building blocks, there are high level concepts such as Themes and Displays.

Templates

Rendered from the templates directory, these are re-usable templates which can be used from pretty much anywhere including within Views and other Templates. They are used by Displays and Themes, as well as for uses such as emails and code generation.

Views

Views are rendered from the views directory. You can think of these as pages or page templates that live in code. Uris that are views will map directly to a view, and controller actions will need to specify a view to render. Uris that are pages don't render a view because the layout for pages renders the CMS content directly.

Layouts

Layouts are rendered from the layouts directory. These are intermediaries between Theme and Content. Each type of uri (views, pages, posts), has a corresponding default layout that does different things. The layout for views will render the view, while the layout for pages will render CMS content. You can override the layout by type or on an individual uris record.

Content

You can associated CMS content blocks to any uris whether they are views or pages or anything else. You can put these blocks into different regions and then render these regions of content using the render_content function. This content is stored in the blocks table.

Themes

Themes are in app/themes. This is a special directory which only exists in app. Theme directories are like modules themselves. They contain many familiar sub directories such as templates, layouts, and public. They can contain any others that are part of the standard module hierarchy. A theme is essentially just a collection of overrides for core templates, layouts, etc.. as well as public resources such as images and stylesheets.

LESS, Bootstrap, and Font-Awesome

The theme system is designed to work LESS, Bootstrap, and Font-Awesome so these libraries are available by default and the built in themes utilize them.

Production Builds

You can create production builds of all CSS and JavaScript. That will be covered in a separate chapter on deployment.

Displays

Displays are classes within the displays directory and they have corresponding templates in templates/display. Displays are a generic abstraction tool for separating data from presentation. There are many Displays provided in core including list, table, grid, layout, and form.