承接 dxw/iguana-theme 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dxw/iguana-theme

最新稳定版本:v1.1.0

Composer 安装命令:

composer require dxw/iguana-theme

包简介

无描述信息

README 文档

README

Helper functions and template layouts for iguana-based themes.

\Dxw\Iguana\Theme\Helpers

Helper functions.

Installation

Add the following to app/di.php:

$registrar->addInstance(new \Dxw\Iguana\Theme\Helpers()); 

Usage

Your classes can declare helper functions:

<?php namespace Dxw\MyTheme; class MyClass implements \Dxw\Iguana\Registerable { private $helpers; public function __construct(\Dxw\Iguana\Theme\Helpers $helpers) { $this->helpers = $helpers; } public function register() { $this->helpers->registerFunction('myFunc', [$this, 'myFunc']); } public function myFunc($a) { echo esc_html($a + 1); } } 

To call this function from a template:

<?php h()->myFunc(4) ?> 

Using h() means that you only need to pollute the global namespace with one function. And h() is a lot shorter than typing out the full namespace.

All you need to do is pass the Helpers instance to your class during instantiation. Example:

$registrar->addInstance(new \Dxw\MyTheme\MyClass( $registrar->getInstance(\Dxw\Iguana\Theme\Helpers::class) )); 

\Dxw\Iguana\Theme\Layout and \Dxw\Iguana\Theme\LayoutRegister

Layout templates.

Installation

Add the following to app/di.php:

$registrar->addInstance(new \Dxw\Iguana\Theme\Helpers()); $registrar->addInstance(new \Dxw\Iguana\Theme\LayoutRegister( $registrar->getInstance(\Dxw\Iguana\Theme\Helpers::class) )); 

Usage

Add something like this to layouts/main.php (within your theme directory):

<!doctype html> <html> <head> ... </head> <body> <?php h()->w_requested_template() ?> </body> </html> 

And remove the calls to get_header()/get_footer() from all your templates.

Licence

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固