An Overview of Pages, Templates and Partials in LemonStand
4 | published by Danny Halarewich on Wednesday, October 14, 2009
Our main objective in developing LemonStand was to create an eCommerce solution that was flexible. An issue that I specifically resonate with is design integration. Many applications in this category claim they have a "100% customizable design using templates", while anyone with experience knows this might be technically true for certain things, it sure doesn't mean it's going to be easy to do. And some times it's a flat out lie, or misrepresentation of the truth.
Sure, a human being can have a 4-foot vertical jump, but is it easy or simple? Well, implementing a unique design for your eCommerce site should be easy.
Overview

LemonStand's templating engine can be broken into 3 main things: Partials, Templates and Pages. I'll give you a brief overview of how all of these things come together to form the dynamic pages of a LemonStand powered website.
Partials
Partials are sort of like PHP includes on steroids. They are normally used for cases when you want to include the same chunk of code into multiple pages. Reusing code is efficient. For example, you can place all of your footer content into a partial, then include this on every template.
You can also include partials within partials for futher organization. Partials may include LemonStand PHP Calls as well, for displaying dynamic content. They can be included within other partials, templates and pages. They get along with everyone.

Templates
Templates are the main structure of a pages displayed by LemonStand. They include partials, HTML and PHP calls to hold it all together. Templates are generally used to define the global structure of a certain type of page in LemonStand. This might be your home page, product detail page, or maybe a blog post page. Within your template, you define where your page content goes. It's really simple to do so. Simply use this PHP call to define this:
<? $this->render_page() ?>
The "page content" is not neccessarily just content. It can be HTML, PHP or JavaScript code as well. But what you should remember is that wherever you define the render_page call in the template is where the code of the page will be pulled into the template.

Pages

Pages complete the package. They piece together partials, templates and your content to form the pages that your visitors see in their web browsers.
When you create a page, optionally select a template then just enter the page title, URL (SEO friendly) and enter in the content. The content wil be placed wherever the render_page call is defined in it. The page content can contain HTML, PHP or JavaScript. You can edit the HTML of the page content using the handy syntax highlighting code editor, or you may also define content blocks that use a WYSIWYG editor.
You'll notice other things like the Meta tab and so on. These are all important, but outside the scope of this blog post.

Content Blocks

Content blocks allow you to edit content in a simpler fashion and are useful for non-technical people.You can define any number of content blocks on a single page. Set up the HTML like the screenshot above, and continue editing it as so - but you can also edit certain areas of the page using content blocks (WYSIWYG). To define a content block, just use a line of code like this:
<? content_block('block_name', "Block Name") ?>
The "block_name" reference is just that... a way to distinguish that particular content block. You can set up any number of content blocks, just make sure to give them each a unique name.


