定制 journeygroup/elmo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

journeygroup/elmo

最新稳定版本:v1.0.2

Composer 安装命令:

composer create-project journeygroup/elmo

包简介

Super-lightweight single-file for producing static web features

README 文档

README

Why

Simplicity. Elmo is a super lightweight, single-file, scaffold for creating static web features. You don't need to install any special tools (LAMP stack is fine), don't need to learn a templating language, and you're free encouraged to hack it. Elmo is less than 200 lines that can be run dynamically for rapid development, and produce static files for production.

The name comes from the natural static electricity phenomenon, St. Elmo's Fire.

Usage

Installation

The easiest and quickest way to install Elmo is via composer:

composer create-project journeygroup/elmo your-project-name

Installing an existing project

If you’re cloning an existing Elmo project, any dependencies will be ignored. Run composer install from within the project’s directory to install dependencies according to the composer.lock file (or composer.json if no composer.lock file is present).

Routes

Unpack Elmo, and point an Apache server at the Public directory. Add routes (pages) to your project by simply creating php files inside the Routes directory. All files are resolved to clean urls. Example:

Routes/
 - index.php
 - about.php
 - products/
 	- index.php
 	- flashlight.php
 	- candle.php

The above structure would resolve to the following URLs:

/
/about
/products
/products/flashlight
/products/candle

Layouts

Layouts are simply html templates. Route files are nested inside layouts, no, there's no silly templating language, turns out PHP is capable of outputting strings too! Here's an example of a basic layout:

<!-- File: Layouts/master.php -->
<html>
	<head>
		<title>Sample Layout</title>
	</head>
	<body>
		<?php include $this->route; ?>
	</body>
</html>

Only one layout may be used per route. Any php variables defined in a layout are accessible within the route file as well. As a bonus, route files can define what layout they should be rendered with.

<!-- File: Routes/products/index.php -->
<?php $this->setLayout('products'); ?>
<h1>Available Products</h1>
...

The above code sample would render the route using Layouts/products.php layout file.

Output

Once you're development is complete, pop open a terminal, navigate to your project and execute:

php elmo ~/your_output_directory

Done.

Wishlist

Layout nesting is the next feature on the docket.

Notes

Pull requests gladly accepted.

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 7
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-29