本文整理汇总了PHP中module_templates函数的典型用法代码示例。如果您正苦于以下问题:PHP module_templates函数的具体用法?PHP module_templates怎么用?PHP module_templates使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了module_templates函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __setup_generate_model__
/**
* 既存のDBからモデルファイルを自動生成する
**/
public static function __setup_generate_model__(Request $request, $value)
{
if (!$request->is_vars('tables')) {
throw new RuntimeException('tables required');
}
$model_path = $request->is_vars('model_path') ? $request->in_vars('model_path') : path('libs/model');
$tables = $request->in_vars('tables');
$tables = strpos(',', $tables) === false ? array($tables) : explode(',', $tables);
foreach ($tables as $table) {
$dao = Dao::instant($table, $value);
$props = $dao->get_columns();
$properties = array();
foreach ($props as $prop_name) {
$property = new ModelProperty();
$property->name($prop_name);
foreach (self::$anons as $a) {
$anon = $dao->a($prop_name, $a);
if (isset(self::$defaults[$prop_name]) && self::$defaults[$prop_name] == $anon) {
continue;
}
if (!is_null($anon)) {
$property->annotation($a, $anon);
}
}
$properties[] = $property;
}
$class_name = preg_replace('/_(.)/e', 'ucfirst("\\1")', ucfirst(strtolower($table)));
$template = new Template();
$template->vars('properties', $properties);
$template->vars('class_name', $class_name);
$filename = File::path($model_path, $class_name . '.php');
$src = "<?php\n" . $template->read(module_templates('model.php'));
File::write($filename, $src);
// unset
$dao = $template = $properties = $property = null;
unset($dao);
unset($template);
unset($properties);
unset($property);
}
}
示例2: get_comments
}
}
if (isset($comments_data['rel_type'])) {
$data['rel'] = $comments_data['rel_type'];
}
$comments = get_comments($comments_data);
$template = get_option('data-template', $params['id']);
if (($template == false or $template == '') and isset($params['template'])) {
$template = $params['template'];
}
$template_file = false;
if ($template != false and strtolower($template) != 'none') {
$template_file = module_templates($config['module'], $template);
}
if ($template_file == false) {
$template_file = module_templates($config['module'], 'default');
}
?>
<script type="text/javascript">
mw.require("url.js", true);
mw.require("tools.js", true);
mw.require("forms.js", true);
</script>
<script type="text/javascript">
mw.init_comment_form<?php
print md5($params['id']);
?>
= function () {
示例3: get_option
$payment_success = true;
}
$requires_registration = get_option('shop_require_registration', 'website') == 'y';
$requires_terms = get_option('shop_require_terms', 'website') == 'y';
$template = get_option('data-template', $params['id']);
$template_file = false;
$module_template = false;
if ($template != false and strtolower($template) != 'none') {
$template_css_prefix = no_ext($template);
$template_file = module_templates($params['type'], $template);
} else {
if ($template == false and isset($params['template'])) {
$module_template = $params['template'];
$template_file = module_templates($params['type'], $module_template);
} else {
$template_file = module_templates($params['type'], 'default');
}
}
?>
<script type="text/javascript">
mw.require("tools.js");
mw.require("shop.js");
</script>
<script type="text/javascript">
示例4: index
//.........这里部分代码省略.........
print lnotif('Your posts module is empty');
}
}
$post_params_paging = $post_params;
$post_params_paging['page_count'] = true;
$cfg_data_hide_paging = get_option('data-hide-paging', $params['id']);
if ($cfg_data_hide_paging === false) {
if (isset($post_params['hide_paging']) and trim($post_params['hide_paging']) != 'false') {
$post_params['hide-paging'] = $post_params['hide_paging'];
unset($post_params['hide_paging']);
}
if (isset($post_params['hide-paging']) and trim($post_params['hide-paging']) != 'false') {
$cfg_data_hide_paging = 'y';
unset($post_params['hide-paging']);
}
}
if ($cfg_data_hide_paging != 'y') {
$pages_of_posts = get_content($post_params_paging);
$pages_count = intval($pages_of_posts);
} else {
$pages_count = 0;
}
$paging_links = false;
if (intval($pages_count) > 1) {
//$paging_links = mw()->content_manager->paging_links(false, $pages_count, $paging_param, $keyword_param = 'keyword');
}
$read_more_text = get_option('data-read-more-text', $params['id']);
$add_cart_text = get_option('data-add-to-cart-text', $params['id']);
if ($add_cart_text == false or $add_cart_text == "Add to cart") {
$add_cart_text = _e("Add to cart", true);
}
if (!isset($params['return'])) {
$module_template = get_option('data-template', $params['id']);
if ($module_template == false and isset($params['template'])) {
$module_template = $params['template'];
}
if ($module_template != false) {
if (strtolower($module_template) == 'none') {
if (isset($params['template'])) {
$module_template = $params['template'];
}
}
$template_file = module_templates($config['module'], $module_template);
} else {
$template_file = module_templates($config['module'], 'default');
}
if ($template_file == false) {
$template_file = module_templates($config['module'], 'default');
}
if (isset($template_file) and is_file($template_file) != false) {
include $template_file;
?>
<?php
if (isset($params['ajax_paging']) or isset($params['ajax-paging'])) {
?>
<script type="text/javascript">
$(document).ready(function () {
mw.$('#<?php
print $params['id'];
?>
').find('a[data-page-number]').unbind('click');
mw.$('#<?php
print $params['id'];
?>
').find('a[data-page-number]').click(function (e) {
var pn = $(this).attr('data-page-number');
mw.$('#<?php
print $params['id'];
?>
').attr('paging_param', 'current_page');
mw.$('#<?php
print $params['id'];
?>
').attr('current_page', pn)
mw.reload_module('#<?php
print $params['id'];
?>
');
return false;
});
});
</script>
<?php
}
?>
<?php
if (isset($params['is_shop'])) {
?>
<script type="text/javascript">
mw.require("shop.js");
</script>
<?php
}
?>
<?php
} else {
print lnotif('No default template for ' . $config['module'] . ' is found');
}
}
}
示例5: error
<?php
if (!isset($params['parent-module'])) {
error('parent-module is required');
}
if (!isset($params['parent-module-id'])) {
error('parent-module-id is required');
}
$templates = module_templates($params['parent-module']);
//$params['type'];
$cur_template = get_option('data-template', $params['parent-module-id']);
?>
<?php
if (is_array($templates)) {
?>
<label class="mw-ui-label">
<?php
_e("Current Skin / Template");
?>
</label>
<select name="data-template" class="mw-ui-field mw_option_field" option_group="<?php
print $params['parent-module-id'];
?>
" data-refresh="<?php
print $params['parent-module-id'];
?>
" >
<option value="default" <?php
if ('default' == $cur_template) {
示例6: get_option
<?php
if (!isset($params['parent-module-id'])) {
return;
}
$params['id'] = $params['parent-module-id'];
$module_template = get_option('data-template', $params['parent-module-id']);
if ($module_template == false) {
$module_template = 'default';
}
if ($module_template != false) {
$template_file = module_templates($params['parent-module'], $module_template, true);
} else {
$template_file = module_templates($params['parent-module'], 'default', true);
}
if (isset($template_file) and $template_file != false and is_file($template_file)) {
include $template_file;
}