本文整理汇总了PHP中Formo::include_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Formo::include_file方法的具体用法?PHP Formo::include_file怎么用?PHP Formo::include_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formo
的用法示例。
在下文中一共展示了Formo::include_file方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add($type, $name, $value, $info)
{
$info['value'] = empty($info['value']) ? $value : $info['value'];
$info['label'] = empty($info['label']) ? preg_replace('/\\[[a-zA-Z0-9_ ]*\\]/', '', $name) : $info['label'];
$element_name = $this->name_is_array ? $this->name . '[]' : $this->name;
if ($this->name_is_array and preg_match('/\\[([a-zA-Z0-9_ ]+)\\]/', $name, $matches)) {
$element_name = $this->name . '[' . $matches[1] . ']';
}
Formo::include_file('driver', $type);
$class = 'Formo_' . $type . '_Driver';
$this->{strtolower(str_replace(' ', '_', $name))} = new $class($element_name, $info);
}
示例2: defined
<?php
defined('SYSPATH') or die('No direct script access.');
/*=======================================
Formo Plugin HABTM
Must be loaded instead of orm plugin (this extends it)
=======================================*/
Formo::include_file('plugin', 'orm');
class Formo_habtm extends Formo_orm
{
protected $elements = array();
protected $habtm_model = array();
protected $habtm_plural = array();
protected $habtm_table = array();
protected $habtm_name = array();
public function __construct(&$form)
{
parent::__construct($form);
$this->form->add_function('habtm', array($this, 'habtm'));
}
public static function load(&$form)
{
return new Formo_habtm($form);
}
public function habtm($model = NULL, $table = NULL, $id = NULL)
{
if (!$id and !$table) {
$table = $model;
示例3: type
public function type($new_type)
{
Formo::include_file('driver', $new_type);
$form = Formo::instance($this->formo_name);
$vals = get_object_vars($this);
unset($form->{$this->name});
unset($vals['type']);
unset($vals['tags']);
$form->add($new_type, $this->name, $vals);
return $this;
}