mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
Custom page template for bootstrap3 to demonstrate custom-field usage.
This commit is contained in:
@@ -23,6 +23,7 @@ class cpage_shortcodes extends e_shortcode
|
|||||||
{
|
{
|
||||||
// var $var; // parsed DB values
|
// var $var; // parsed DB values
|
||||||
private $chapterData = array();
|
private $chapterData = array();
|
||||||
|
private $cpageFieldName = null;
|
||||||
|
|
||||||
// Grab all book/chapter data.
|
// Grab all book/chapter data.
|
||||||
function __construct()
|
function __construct()
|
||||||
@@ -602,7 +603,7 @@ class cpage_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
if(empty($brow['chapter_sef']))
|
if(empty($brow['chapter_sef']))
|
||||||
{
|
{
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row['book_sef'] = vartrue($brow['chapter_sef'],"no-sef-found"); //$this->getBook();
|
$row['book_sef'] = vartrue($brow['chapter_sef'],"no-sef-found"); //$this->getBook();
|
||||||
@@ -672,6 +673,8 @@ class cpage_shortcodes extends e_shortcode
|
|||||||
function sc_cpagefieldtitle($parm=null)
|
function sc_cpagefieldtitle($parm=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->cpageFieldName = null;
|
||||||
|
|
||||||
if(empty($parm['name']) || empty($this->var['page_fields']))
|
if(empty($parm['name']) || empty($this->var['page_fields']))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -680,6 +683,8 @@ class cpage_shortcodes extends e_shortcode
|
|||||||
$chap = $this->var['page_chapter'];
|
$chap = $this->var['page_chapter'];
|
||||||
$key = $parm['name'];
|
$key = $parm['name'];
|
||||||
|
|
||||||
|
$this->cpageFieldName = $key;
|
||||||
|
|
||||||
$arr = array('name'=>$parm['name']);
|
$arr = array('name'=>$parm['name']);
|
||||||
$value = $this->sc_cpagefield($arr);
|
$value = $this->sc_cpagefield($arr);
|
||||||
|
|
||||||
@@ -712,11 +717,15 @@ class cpage_shortcodes extends e_shortcode
|
|||||||
*/
|
*/
|
||||||
function sc_cpagefield($parm=null)
|
function sc_cpagefield($parm=null)
|
||||||
{
|
{
|
||||||
|
$this->cpageFieldName = null;
|
||||||
|
|
||||||
if(empty($parm['name']) || empty($this->var['page_fields']))
|
if(empty($parm['name']) || empty($this->var['page_fields']))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->cpageFieldName = $parm['name'];
|
||||||
|
|
||||||
$chap = $this->var['page_chapter'];
|
$chap = $this->var['page_chapter'];
|
||||||
$fields = $this->chapterData[$chap]['chapter_fields'];
|
$fields = $this->chapterData[$chap]['chapter_fields'];
|
||||||
|
|
||||||
@@ -725,6 +734,15 @@ class cpage_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the last custom-page field name used.
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
function sc_cpagefieldname()
|
||||||
|
{
|
||||||
|
return $this->cpageFieldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @experimental - subject to change without notice. Use at own risk.
|
* @experimental - subject to change without notice. Use at own risk.
|
||||||
|
225
e107_themes/bootstrap3/templates/page_template.php
Normal file
225
e107_themes/bootstrap3/templates/page_template.php
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* e107 website system
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
|
||||||
|
$PAGE_WRAPPER = array();
|
||||||
|
$PAGE_TEMPLATE = array();
|
||||||
|
|
||||||
|
global $sc_style;
|
||||||
|
|
||||||
|
$sc_style['CPAGEAUTHOR|default']['pre'] = '';
|
||||||
|
$sc_style['CPAGEAUTHOR|default']['post'] = ", ";
|
||||||
|
|
||||||
|
$sc_style['CPAGESUBTITLE|default']['pre'] = '<h2>';
|
||||||
|
$sc_style['CPAGESUBTITLE|default']['post'] = '</h2>';
|
||||||
|
|
||||||
|
$sc_style['CPAGEMESSAGE|default']['pre'] = '';
|
||||||
|
$sc_style['CPAGEMESSAGE|default']['post'] = '<div class="clear"><!-- --></div>';
|
||||||
|
|
||||||
|
$sc_style['CPAGENAV|default']['pre'] = '<div class="f-right pull-right col-md-3">';
|
||||||
|
$sc_style['CPAGENAV|default']['post'] = '</div>';
|
||||||
|
|
||||||
|
#### default template - BC ####
|
||||||
|
// used only for parsing comment outside of the page tablerender-ed content
|
||||||
|
// leave empty if you integrate page comments inside the main page template
|
||||||
|
|
||||||
|
|
||||||
|
$PAGE_TEMPLATE['default']['page'] = '
|
||||||
|
{PAGE}
|
||||||
|
{PAGECOMMENTS}
|
||||||
|
';
|
||||||
|
|
||||||
|
// always used - it's inside the {PAGE} sc from 'page' template
|
||||||
|
$PAGE_TEMPLATE['default']['start'] = '<div id="{CPAGESEF}" class="cpage_body cpage-body">{CHAPTER_BREADCRUMB}';
|
||||||
|
|
||||||
|
// page body
|
||||||
|
$PAGE_TEMPLATE['default']['body'] = '
|
||||||
|
|
||||||
|
{CPAGEMESSAGE|default}
|
||||||
|
|
||||||
|
{CPAGESUBTITLE|default}
|
||||||
|
<div class="clear"><!-- --></div>
|
||||||
|
|
||||||
|
{CPAGENAV|default}
|
||||||
|
{CPAGEBODY|default}
|
||||||
|
|
||||||
|
<div class="clear"><!-- --></div>
|
||||||
|
{CPAGERATING|default}
|
||||||
|
{CPAGEEDIT}
|
||||||
|
|
||||||
|
|
||||||
|
';
|
||||||
|
|
||||||
|
// {CPAGEFIELD: name=image}
|
||||||
|
|
||||||
|
$PAGE_WRAPPER['default']['CPAGEEDIT'] = "<div class='text-right'>{---}</div>";
|
||||||
|
|
||||||
|
// used only when password authorization is required
|
||||||
|
$PAGE_TEMPLATE['default']['authorize'] = '
|
||||||
|
<div class="cpage-restrict ">
|
||||||
|
{message}
|
||||||
|
{form_open}
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">{caption}</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{label}</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
{password} {submit}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{form_close}
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
// used when access is denied (restriction by class)
|
||||||
|
$PAGE_TEMPLATE['default']['restricted'] = '
|
||||||
|
{text}
|
||||||
|
';
|
||||||
|
|
||||||
|
// used when page is not found
|
||||||
|
$PAGE_TEMPLATE['default']['notfound'] = '
|
||||||
|
{text}
|
||||||
|
';
|
||||||
|
|
||||||
|
// always used
|
||||||
|
$PAGE_TEMPLATE['default']['end'] = '{CPAGERELATED: types=page,news}</div>';
|
||||||
|
|
||||||
|
// options per template - disable table render
|
||||||
|
// $PAGE_TEMPLATE['default']['noTableRender'] = false; //XXX Deprecated
|
||||||
|
|
||||||
|
// define different tablerender mode here
|
||||||
|
$PAGE_TEMPLATE['default']['tableRender'] = 'cpage';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$PAGE_TEMPLATE['default']['related']['start'] = '{SETIMAGE: w=350&h=350&crop=1}<h2 class="caption">{LAN=LAN_RELATED}</h2><div class="row">';
|
||||||
|
$PAGE_TEMPLATE['default']['related']['item'] = '<div class="col-md-4"><a href="{RELATED_URL}">{RELATED_IMAGE}</a><h3><a href="{RELATED_URL}">{RELATED_TITLE}</a></h3></div>';
|
||||||
|
$PAGE_TEMPLATE['default']['related']['end'] = '</div>';
|
||||||
|
|
||||||
|
// $PAGE_TEMPLATE['default']['editor'] = '<ul class="fa-ul"><li><i class="fa fa-li fa-edit"></i> Level 1</li><li><i class="fa fa-li fa-cog"></i> Level 2</li></ul>';
|
||||||
|
|
||||||
|
|
||||||
|
#### No table render example template ####
|
||||||
|
|
||||||
|
|
||||||
|
$PAGE_TEMPLATE['custom']['start'] = '<div id="{CPAGESEF}" class="cpage-body">';
|
||||||
|
$PAGE_TEMPLATE['custom']['body'] = '';
|
||||||
|
$PAGE_TEMPLATE['custom']['authorize'] = '
|
||||||
|
';
|
||||||
|
|
||||||
|
$PAGE_TEMPLATE['custom']['restricted'] = '
|
||||||
|
';
|
||||||
|
|
||||||
|
$PAGE_TEMPLATE['custom']['end'] = '</div>';
|
||||||
|
$PAGE_TEMPLATE['custom']['tableRender'] = '';
|
||||||
|
|
||||||
|
|
||||||
|
$PAGE_WRAPPER['profile']['CMENUIMAGE: template=profile'] = '<span class="page-profile-image pull-left col-xs-12 col-sm-4 col-md-4">{---}</span>';
|
||||||
|
$PAGE_TEMPLATE['profile'] = $PAGE_TEMPLATE['default'];
|
||||||
|
$PAGE_TEMPLATE['profile']['body'] = '
|
||||||
|
{CPAGEMESSAGE}
|
||||||
|
{CPAGESUBTITLE}
|
||||||
|
<div class="clear"><!-- --></div>
|
||||||
|
|
||||||
|
{CPAGENAV|default}
|
||||||
|
{SETIMAGE: w=320}
|
||||||
|
{CMENUIMAGE: template=profile}
|
||||||
|
{CPAGEBODY}
|
||||||
|
|
||||||
|
<div class="clear"><!-- --></div>
|
||||||
|
{CPAGERATING}
|
||||||
|
{CPAGEEDIT}
|
||||||
|
';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$PAGE_TEMPLATE['customfields'] = $PAGE_TEMPLATE['default'];
|
||||||
|
|
||||||
|
// Wrap Custom Fields in a table row (hides table row if data is empty)
|
||||||
|
$PAGE_WRAPPER['customfields']['CPAGEFIELDTITLE'] = "<tr id='customfields-{CPAGEFIELDNAME}'><td>{---}</td>";
|
||||||
|
$PAGE_WRAPPER['customfields']['CPAGEFIELD'] = "<td>{---}</td></tr>";
|
||||||
|
|
||||||
|
$PAGE_TEMPLATE['customfields']['body'] = '
|
||||||
|
|
||||||
|
<div class="col-md-5 pull-right" style="margin-right:-15px">
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th class="text-center" colspan="2">Custom Fields</th>
|
||||||
|
</tr>
|
||||||
|
{CPAGEFIELDTITLE: name=mybbarea}
|
||||||
|
{CPAGEFIELD: name=mybbarea}
|
||||||
|
{CPAGEFIELDTITLE: name=myboolean}
|
||||||
|
{CPAGEFIELD: name=myboolean}
|
||||||
|
{CPAGEFIELDTITLE: name=mycheckbox}
|
||||||
|
{CPAGEFIELD: name=mycheckbox}
|
||||||
|
{CPAGEFIELDTITLE: name=mycountry}
|
||||||
|
{CPAGEFIELD: name=mycountry}
|
||||||
|
{CPAGEFIELDTITLE: name=mydatestamp}
|
||||||
|
{CPAGEFIELD: name=mydatestamp}
|
||||||
|
{CPAGEFIELDTITLE: name=mydropdown}
|
||||||
|
{CPAGEFIELD: name=mydropdown}
|
||||||
|
{CPAGEFIELDTITLE: name=myemail}
|
||||||
|
{CPAGEFIELD: name=myemail}
|
||||||
|
{CPAGEFIELDTITLE: name=myfile}
|
||||||
|
{CPAGEFIELD: name=myfile}
|
||||||
|
{CPAGEFIELDTITLE: name=myicon}
|
||||||
|
{CPAGEFIELD: name=myicon}
|
||||||
|
{CPAGEFIELDTITLE: name=myimage}
|
||||||
|
{CPAGEFIELD: name=myimage}
|
||||||
|
{CPAGEFIELDTITLE: name=mylanguage}
|
||||||
|
{CPAGEFIELD: name=mylanguage}
|
||||||
|
{CPAGEFIELDTITLE: name=mynumber}
|
||||||
|
{CPAGEFIELD: name=mynumber}
|
||||||
|
{CPAGEFIELDTITLE: name=myprogressbar}
|
||||||
|
{CPAGEFIELD: name=myprogressbar}
|
||||||
|
{CPAGEFIELDTITLE: name=mytags}
|
||||||
|
{CPAGEFIELD: name=mytags}
|
||||||
|
{CPAGEFIELDTITLE: name=mytext}
|
||||||
|
{CPAGEFIELD: name=mytext}
|
||||||
|
{CPAGEFIELDTITLE: name=myurl}
|
||||||
|
{CPAGEFIELD: name=myurl}
|
||||||
|
{CPAGEFIELDTITLE: name=myvideo}
|
||||||
|
{CPAGEFIELD: name=myvideo}
|
||||||
|
</table>
|
||||||
|
{CPAGEEDIT}
|
||||||
|
</div>
|
||||||
|
{CPAGEBODY}
|
||||||
|
|
||||||
|
{CPAGEMESSAGE}
|
||||||
|
|
||||||
|
{CPAGESUBTITLE}
|
||||||
|
<div class="clear"><!-- --></div>
|
||||||
|
|
||||||
|
{CPAGEFIELDS_DISABLED: generate} <!-- Remove _DISABLED to generated custom-fields template code -->
|
||||||
|
{CPAGEFIELDS_DISABLED} <!-- Remove _DISABLED to render all custom-field values/options -->
|
||||||
|
|
||||||
|
{CPAGENAV}
|
||||||
|
|
||||||
|
<div class="clear"><!-- --></div>
|
||||||
|
{CPAGERATING}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
Reference in New Issue
Block a user