定制 andheiberg/theme 二次开发

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

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

andheiberg/theme

Composer 安装命令:

composer require andheiberg/theme

包简介

A modular themeing system based on the blade syntax.

README 文档

README

###A simple modular approach to theming created to blend in with Blade. The concept is to split your theme up into modules that can be reused and changed easily. These modules are stored as simple view files in resources/views/vendor/theme. An example of a typical module could be a hero unit. You would store your hero model like so:

+@form(['route' => 'auth.register'])
	+@formText('username', 'What do you want to be called?')->placeholder('darthvader')
	
	+@formPassword('password') // if you don't provide a label it will capitalize the key
	
	+@formHidden('awesomeness', 11)

	+@formSelect('gender', 'Your gender', ['Male', 'Female'])->required()

	+@formDate('born_at', 'Birthdate')
-@form

It's especially powerful for forms. By default it will fill old values and show validation messages. It reduces view code by +10x for typical forms.

It can be used for anything though. Modules are easy to define.

// resources/views/vendor/theme/hero.blade.php
<div class="hero row {{ $class }}">
	<div class="column">

<!-- Content -->

	</div>
</div>

This module can then intern be used from a view like so:

+@hero()
	<h1>It might be yet another twitter client, but this one is really nice</h1>
	<p>Seriously I mean it I wouldn't want to disapoint you, but it's amazing.</p>
-@hero

As you can see the html comment <!-- Content --> seperates the start and ending of modules. If you choose to exclude this comment you could create a module like so:

// app/views/theme/button.blade.php
<a class="button {{ $class }}" href="{{ $link }}">{{ $text }}</a>

And use it like so (without an ending tag):

+@button('url', 'text')

Also multiword modules are like so:

// app/views/theme/page-header.blade.php
<div class="page-header {{ $class }}">
<!-- Content -->
</div>

And called like so:

+@pageHeader()
	<h1>Some header</h1>
-@pageHeader

Why is this helpful?

  • Easily change your markup site wide (this is really useful if you start prototyping with Bootstrap or Foundation and then want to use your own markup later)
  • Easier to modify and understand than something like Former
  • Easier to read (ever seen comments like <!-- end of hero -->? well now the modules end is prefixed by -@ so that should no longer be needed)

Installation

Add the following to your composer.json:

"andheiberg/theme": "4.0.*" // "1.0.*" for Laravel 4.1 support, "2.0.*" for Laravel 4.2 support, "3.1.*" for Laravel 5 and 5.1 support

Add Theme's service provider to your Laravel application in config/app.php. Add the following to the providers:

Andheiberg\Theme\ThemeServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,

And to the aliases:

'Form' => Collective\Html\FormFacade::class,

If you would like to use another theme than default you would have to publish the settings and change the theme setting:

php artisan vendor:publish --provider="Andheiberg\Theme\ThemeServiceProvider"

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-05-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固