本文整理汇总了PHP中fuel_edit函数的典型用法代码示例。如果您正苦于以下问题:PHP fuel_edit函数的具体用法?PHP fuel_edit怎么用?PHP fuel_edit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fuel_edit函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
<?php
if (!empty($archives_by_month)) {
foreach ($archives_by_month as $month => $archives) {
$month_str = date('F Y', strtotime(str_replace('/', '-', $month) . '-01'));
?>
<h2><?php
echo $month_str;
?>
</h2>
<ul>
<?php
foreach ($archives as $post) {
?>
<li><?php
echo fuel_edit($post->id, 'Edit Post: ' . $post->title, 'blog/posts');
?>
<a href="<?php
echo $post->url;
?>
"><?php
echo $post->title;
?>
</a>
<em><?php
echo $post->author_name;
?>
</em>
</li>
<?php
}
示例2: fuel_edit
<?php
echo fuel_edit($author->id, 'Edit Author: ' . $author->name, 'blog/users');
?>
<h1><?php
echo $author->name;
?>
</h1>
<?php
if (!empty($author->avatar_image)) {
echo $author->get_avatar_img_tag(array('class' => 'img_right'));
}
echo $author->about_formatted;
?>
<ul>
<?php
if (!empty($author->email)) {
?>
<li><?php
echo safe_mailto($author->email);
?>
</li>
<?php
}
?>
<?php
if (!empty($author->website)) {
?>
<li><?php
示例3: fuel_edit
<?php
echo fuel_edit('create?title=xxx', 'Create Article', 'articles');
?>
<?php
foreach ($tags as $tag) {
?>
<h2><?php
echo $tag->name;
?>
</h2>
<ul>
<?php
foreach ($tag->articles as $article) {
?>
<li><?php
echo fuel_edit($article);
?>
<a href="<?php
echo $article->url;
?>
"><?php
echo $article->title;
?>
</a></li>
<?php
}
?>
</ul>
<?php
}
?>
示例4: fuel_edit
<div class="post">
<?php
echo fuel_edit($post->id, 'Edit Post', 'blog/posts');
?>
<?php
echo blog_block('post_unpublished', array('post' => $post));
?>
<h1><?php
echo $post->title;
?>
</h1>
<div class="post_author_date">
Posted on <span class="post_content_date"><?php
echo $post->get_date_formatted();
?>
</span> by <span class="post_author_name"><?php
echo $post->author_name;
?>
</span>
</div>
<div class="post_content">
<?php
echo $post->content_formatted;
?>
</div>
</div>
示例5: render
//.........这里部分代码省略.........
if (!empty($cache)) {
return $cache;
}
}
// load the model and data
$p['vars'] = (array) $p['vars'];
$vars = (is_array($vars) and !empty($vars)) ? array_merge($p['vars'], $vars) : $p['vars'];
if (!empty($p['model'])) {
$data = fuel_model($p['model'], $p);
$module = $this->CI->fuel->modules->get($p['model']);
if ($module) {
$model_name = $module->model()->friendly_name(TRUE);
if (!empty($model_name)) {
$var_name = $module->model()->friendly_name(TRUE, FALSE);
$vars[$var_name] =& $data;
// for convenience
$vars['data'] =& $data;
}
}
} else {
$vars['data'] = $p['data'];
}
$output = '';
// load proper view to parse. If a view is given then we first look up the name in the DB
$view = '';
if (!empty($p['view_string'])) {
$view = $p['view_string'];
} else {
if (!empty($p['view'])) {
$is_module_block = FALSE;
$view_path = 'views/_blocks/';
if (!empty($p['module']) and defined('MODULES_PATH')) {
if ($p['module'] == 'app' or $p['module'] == 'application') {
$view_path = APPPATH . $view_path;
} else {
$view_path = MODULES_PATH . $p['module'] . '/' . $view_path;
}
$is_module_block = TRUE;
} else {
$view_path = APPPATH . $view_path;
}
// get language value
if ($this->fuel->language->has_multiple()) {
$language = !empty($p['language']) ? $p['language'] : $this->fuel->language->detect();
} else {
$language = $this->fuel->language->default_option();
}
// test that the file exists in the associated language
if (!empty($language) and !$this->fuel->language->is_default($language)) {
$view_tmp = 'language/' . $language . '/' . $p['view'];
if (file_exists($view_path . $view_tmp . EXT)) {
$view_file = $view_path . $view_tmp . EXT;
}
}
if (empty($view_file)) {
$view_file = $view_path . $p['view'] . EXT;
}
$p['mode'] = strtolower($p['mode']);
// only check database if the fuel_mode does NOT equal 'views, the "only_views" parameter is set to FALSE and the view name does not begin with an underscore'
if ($check_db and ($p['mode'] == 'auto' and $this->mode() != 'views' or $p['mode'] == 'cms') and substr($p['view'], 0, 1) != '_') {
$this->fuel->load_model('fuel_blocks');
// find the block in FUEL db
$block = $this->CI->fuel_blocks_model->find_one_by_name_and_language($p['view'], $language);
// if there is no block found with that language we will try to find one that may not have a language associated with it
if (!isset($block->id) and $p['use_default']) {
$block = $this->CI->fuel_blocks_model->find_one_by_name($p['view']);
}
if (isset($block->id)) {
if (strtolower($p['parse']) == 'auto') {
$p['parse'] = TRUE;
}
$view = $block->view;
if ($p['editable'] === TRUE) {
$view = fuel_edit($block->id, 'Edit Block: ' . $block->name, 'blocks') . $view;
}
} else {
if (file_exists($view_file)) {
// pass in reference to global CI object
$vars['CI'] =& $this->CI;
// pass along these since we know them... perhaps the view can use them
$view = $is_module_block ? $this->CI->load->module_view($p['module'], '_blocks/' . $p['view'], $vars, TRUE, $p['scope']) : $this->CI->load->view('_blocks/' . $p['view'], $vars, TRUE, $p['scope']);
}
}
} else {
if (file_exists($view_file)) {
// pass in reference to global CI object
$vars['CI'] =& $this->CI;
// pass along these since we know them... perhaps the view can use them
$view = $is_module_block ? $this->CI->load->module_view($p['module'], '_blocks/' . $p['view'], $vars, TRUE, $p['scope']) : $this->CI->load->view('_blocks/' . $p['view'], $vars, TRUE, $p['scope']);
}
}
}
}
// parse the view again to apply any variables from previous parse
$output = $p['parse'] === TRUE ? $this->CI->parser->parse_string($view, $vars, TRUE) : $view;
if ($p['cache'] === TRUE) {
$this->CI->cache->save($cache_id, $output, $cache_group, $this->CI->fuel->config('page_cache_ttl'));
}
return $output;
}
示例6: foreach
$categories = $CI->fuel->blog->get_published_categories();
if (!empty($categories)) {
?>
<div class="blog_block">
<h3>Categories</h3>
<ul>
<?php
foreach ($categories as $category) {
$cat_cnt = $category->posts_count;
?>
<?php
if (!empty($cat_cnt)) {
?>
<li>
<?php
echo fuel_edit($category);
?>
<a href="<?php
echo $category->url;
?>
"><?php
echo $category->name;
?>
</a> (<?php
echo $cat_cnt;
?>
)
</li>
<?php
}
?>
示例7: foreach
<?php
$links = $CI->fuel_blog->get_links();
if (!empty($links)) {
?>
<div class="blog_block">
<h3>Links</h3>
<ul>
<?php
foreach ($links as $link) {
?>
<li>
<?php
echo fuel_edit($link->id, 'Edit Link: ' . $link->name, 'blog/links');
?>
<?php
echo $link->link;
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
示例8: foreach
/*
Example block that displays a list of tags for a particular module
*/
$tags = $CI->fuel->posts->get_published_tags();
if (!empty($tags)) {
?>
<div class="post_tags">
<h3>Tags</h3>
<ul>
<?php
foreach ($tags as $tag) {
?>
<li>
<?php
echo fuel_edit($tag);
?>
<a href="<?php
echo $CI->fuel->posts->url('tag/' . $tag->slug);
?>
"><?php
echo $tag->name;
?>
</a>
</li>
<?php
}
?>
</ul>
</div>
<?php
示例9: foreach
<?php
$posts_to_categories = $CI->fuel_blog->get_posts_to_categories();
if (!empty($posts_to_categories)) {
?>
<div class="blog_block">
<h3>Categories</h3>
<ul>
<?php
foreach ($posts_to_categories as $post_to_category) {
?>
<li>
<?php
echo fuel_edit($post_to_category->category_id, 'Edit Category: ' . $post_to_category->category_name, 'blog/categories');
?>
<a href="<?php
echo $post_to_category->category_url;
?>
"><?php
echo $post_to_category->category_name;
?>
(<?php
echo $post_to_category->posts_count;
?>
)</a>
</li>
<?php
}
?>
</ul>
</div>
示例10: foreach
<h1>Articles <?php
if (!empty($category)) {
?>
: <?php
echo $category->name;
?>
<?php
}
?>
</h1>
<?php
foreach ($articles as $article) {
?>
<h2><?php
echo fuel_edit($article->id, 'Edit: ' . $article->title, 'articles');
echo $article->title;
?>
</h2>
<p>
<?php
echo $article->content_formatted;
?>
</p>
<div class="author"><?php
echo $article->author->name;
?>
</div>
<?php
}
示例11: fuel_edit
<div class="post">
<?php
echo fuel_edit($post);
?>
<?php
echo blog_block('post_unpublished', array('post' => $post));
?>
<h1><?php
echo $post->title;
?>
</h1>
<div class="post_author_date">
Posted on <span class="post_content_date"><?php
echo $post->get_date_formatted();
?>
</span> by <span class="post_author_name"><?php
echo $post->author_name;
?>
</span>
</div>
<div class="post_content">
<?php
echo $post->content_formatted;
?>
</div>
</div>
示例12: fuel_var
/**
* Returns a variable and allows for a default value
*
* @access public
* @param string
* @param string
* @param string
* @param boolean
* @return string
*/
function fuel_var($key, $default = '', $edit_module = 'pages', $evaluate = TRUE)
{
$CI =& get_instance();
$CI->config->module_load('fuel', 'fuel', TRUE);
$CI->load->helper('string');
$CI->load->helper('inflector');
if (isset($GLOBALS[$key]))
{
$val = $GLOBALS[$key];
}
else if (isset($CI->load->_ci_cached_vars[$key]))
{
$val = $CI->load->_ci_cached_vars[$key];
}
else
{
$val = $default;
}
if (is_string($val) AND $evaluate)
{
$val = eval_string($val);
}
else if (is_array($val) AND $evaluate)
{
foreach($val as $k => $v)
{
$val[$k] = eval_string($v);
}
}
if ($edit_module === TRUE) $edit_module = 'pages';
if (!empty($edit_module) AND $CI->config->item('fuel_mode', 'fuel') != 'views' AND !defined('USE_FUEL_MARKERS') OR (defined('USE_FUEL_MARKERS') AND USE_FUEL_MARKERS))
{
$marker = fuel_edit($key, humanize($key), $edit_module);
}
else
{
$marker = '';
}
if (is_string($val))
{
return $marker.$val;
}
else
{
if (!empty($marker))
{
// used to help with javascript positioning
$marker = '<span>'.$marker.'</span>';
}
return $marker;
}
}
示例13: foreach
<ul>
<?php
foreach ($features as $feature) {
?>
<li class="<?php
echo $feature->icon_class;
?>
">
<h3><?php
echo $feature->title;
?>
<?php
echo fuel_edit($feature->id, 'Edit Feature ' . $feature->title, 'features');
?>
</h3>
<p><?php
echo $feature->copy;
?>
</p>
</li>
<?php
}
?>
</ul>
示例14: fuel_var
/**
* Returns a variable and allows for a default value.
* Also creates inline editing marker.
* The <dfn>default</dfn> parameter will be used if the variable does not exist.
* The <dfn>edit_module</dfn> parameter specifies the module to include for inline editing.
* The <dfn>evaluate</dfn> parameter specifies whether to evaluate any php in the variables.
*
<p class="important">You should not use this function inside of another function because you may get unexepected results. This is
because it returns inline editing markers that later get parsed out by FUEL. For example:</p>
<code>
// NO
<a href="<?=site_url(fuel_var('my_url'))?>">my link</a>
// YES
<?=fuel_edit('my_url', 'Edit Link')?> <a href="<?=site_url($my_url)?>">my link</a>
</code>
* @access public
* @param string
* @param string
* @param boolean
* @return string
*/
function fuel_var($key, $default = '', $edit_module = 'pagevariables', $evaluate = FALSE)
{
$CI =& get_instance();
$CI->load->helper('inflector');
$key_arr = explode('|', $key);
$key = $key_arr[0];
if (isset($GLOBALS[$key])) {
$val = $GLOBALS[$key];
} else {
if ($CI->load->get_var($key)) {
$val = $CI->load->get_var($key);
} else {
$val = $default;
}
}
if (is_string($val) and $evaluate) {
$val = eval_string($val);
} else {
if (is_array($val) and $evaluate) {
if (isset($key_arr[1])) {
if (isset($val[$key_arr[1]])) {
$val = $val[$key_arr[1]];
} else {
$val = $default;
}
} else {
foreach ($val as $k => $v) {
$val[$k] = eval_string($v);
}
}
}
}
if ($edit_module === TRUE) {
$edit_module = 'pagevariables';
}
if (!empty($edit_module) and $CI->fuel->pages->mode() != 'views' and !defined('FUELIFY') or defined('FUELIFY') and FUELIFY) {
$marker = fuel_edit($key, humanize($key), $edit_module);
} else {
$marker = '';
}
if (is_string($val)) {
return $marker . $val;
} else {
if (!empty($marker)) {
// used to help with javascript positioning
$marker = '<span>' . $marker . '</span>';
}
return $marker;
}
}