This is the documentation for LemonStand V1, which has been discontinued. You can learn more and upgrade your store here.

LemonStand Version 1 Has Been Discontinued

This documentation is for LemonStand Version 1. LemonStand is now offered as a cloud-based eCommerce platform.
You can try the new LemonStand and learn about upgrading here.

Structure of a View Document

View documents are HTML files. These files should be placed into a directory with a name, matching a controller class name, but written in all lower case. The views directory should be situated in a same directory with a controller class script. For example, if your controller file name is abcblog_posts, than views for this controller should be placed to the modules/abcblog/controllers/abcblog_posts directory.

Each view corresponds an action in the controller name. If there is a "preview" action defined in the controller, a corresponding view file should have the preview.htm name.

You can use any HTML markup and PHP in your views. LemonStand has a number of standard page elements, like breadcrumbs and indicators, and we will describe them in the next article. Lists, forms, filters and other elements of a page are generated by LemonStand API automatically and you do not need to care about the HTML markup for these element.

However you can use custom HTML markup on pages and even define new CSS styles for using on our module pages. You can link additional CSS and JavaScript files in the head block described below.

The head and view blocks

Sometimes you will need to link CSS or JavaScript to your pages. LemonStand MVC engine allows to define two blocks on a page - the head and the view. To add extra declarations to the HEAD page element you should use the head block, as displayed in the code below:

<? Phpr_View::beginBlock("head") ?>
  <script type="text/javascript" src="modules/my_module/resources/javascript/script.js"></script>
  <link rel="stylesheet" href="modules/my_module/resources/css/styles.css" type="text/css"/>
<? Phpr_View::endBlock() ?>

<? Phpr_View::beginBlock("view") ?>
  <p>Page content goes here</p>
<? Phpr_View::endBlock() ?>

All content defined in the head block gets to the HEAD element of a page. All content defined in the view block gets to the page BODY element. If you do not define any blocks in a view file, all content of the view file will get to the BODY element. If you are not going to link any additional resources in a page header, you can skip the blocks declarations.

Please note that in script and link elements you should use URLs relative to the application root URL. Also, you should not add a leading slash symbol before URLs. LemonStand correctly resolves such paths, even if LemonStand is installed into a subdirectory.

Next: Partials
Previous: Adding a Back-End User Interface
Return to Adding a Back-End User Interface