Last active
August 29, 2015 14:01
-
-
Save hertsch/86fd4d8a037e7d0e56e4 to your computer and use it in GitHub Desktop.
Code Examples for the TemplateTools used at kit2.phpmanufaktur.de
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code Examples for the TemplateTools used at kit2.phpmanufaktur.de |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($template['browser']->name() == BROWSER_CHROME) { | |
// do something special for the Chrome Browser | |
?><p>Sie verwenden einen Chrome Browser!</p><?php | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($template['browser']->is_mobile()) { ?> | |
<p>Sie verwenden ein mobiles Endgerät!</p> | |
<?php } | |
elseif ($template['browser']->is_tablet()) { ?> | |
<p>Sie verwenden ein Tablet!</p> | |
<?php } | |
else { ?> | |
<p>Sie betrachten diese Seite auf einem Desktop!</p> | |
<?php } | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if browser_is_mobile() %} | |
<p>Sie verwenden ein mobiles Endgerät!</p> | |
{% elseif browser_is_tablet() %} | |
<p>Sie verwenden ein Tablet!</p> | |
{% else %} | |
<p>Sie betrachten diese Seite auf einem Desktop!</p> | |
{% endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Sie verwenden den Browser {{ browser_name() }} in der Version {{ browser_version() }} auf der Plattform {{ browser_platform }}</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<?php | |
// initialize the TemplateTools | |
require_once WB_PATH.'/kit2/extension/phpmanufaktur/phpManufaktur/TemplateTools/initialize.php'; | |
// load as simple <head> section | |
$template['twig']->display('@pattern/bootstrap/head.simple.twig'); | |
?> | |
<body> | |
<div class="content-body"> | |
<div class="container"> | |
<?php $template['cms']->page_content(); ?> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="content-body"> | |
<div class="container"> | |
{% set MAIN_CONTENT = page_content('Main Content') %} | |
{% set SIDEBAR_LEFT = page_content('Sidebar, Left') %} | |
{% set SIDEBAR_RIGHT = page_content('Sidebar, Right') %} | |
{% if SIDEBAR_LEFT|length > 0 %} | |
<div class="row"> | |
<div class="col-md-4 col-sm-12 sidebar-left">{{ SIDEBAR_LEFT }}</div> | |
{% if SIDEBAR_RIGHT|length > 0 %} | |
<div class="col-md-4 col-sm-12 main-content">{{ MAIN_CONTENT }}</div> | |
<div class="col-md-4 col-sm-12 sidebar-right">{{ SIDEBAR_RIGHT }}</div> | |
{% else %} | |
<div class="col-md-8 col-sm-12 main-content">{{ MAIN_CONTENT }}</div> | |
{% endif %} | |
</div> | |
{% elseif SIDEBAR_RIGHT|length > 0 %} | |
<div class="row"> | |
<div class="col-md-8 col-sm-12 main-content">{{ MAIN_CONTENT }}</div> | |
<div class="col-md-4 col-sm-12 sidebar-right">{{ SIDEBAR_RIGHT }}</div> | |
</div> | |
{% else %} | |
<div class="main-content">{{ MAIN_CONTENT }}</div> | |
{% endif %} | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<div class="content-body"> | |
<div class="container"> | |
<?php | |
// get the block contents into variables | |
$MAIN_CONTENT = $template['cms']->page_content('Main Content', false); | |
$SIDEBAR_LEFT = $template['cms']->page_content('Sidebar, Left', false); | |
$SIDEBAR_RIGHT = $template['cms']->page_content('Sidebar, Right', false); | |
if (!empty($SIDEBAR_LEFT)) { | |
// the Sidebar LEFT is not empty and must be shown! | |
?> | |
<div class="row"> | |
<div class="col-md-4 col-sm-12 sidebar-left"><?php echo $SIDEBAR_LEFT; ?></div> | |
<?php if (!empty($SIDEBAR_RIGHT)) { | |
// the Sidebar RIGHT is not empty and must be shown! | |
?> | |
<div class="col-md-4 col-sm-12 main-content"><?php echo $MAIN_CONTENT; ?></div> | |
<div class="col-md-4 col-sm-12 sidebar-right"><?php echo $SIDEBAR_RIGHT; ?></div> | |
<?php } else { ?> | |
<div class="col-md-8 col-sm-12 main-content"><?php echo $MAIN_CONTENT; ?></div> | |
<?php } ?> | |
</div> | |
<?php } elseif(!empty($SIDEBAR_RIGHT)) { | |
// the Sidebar RIGHT is not empty and must be shown! | |
?> | |
<div class="row"> | |
<div class="col-md-8 col-sm-12 main-content"><?php echo $MAIN_CONTENT; ?></div> | |
<div class="col-md-4 col-sm-12 sidebar-right"><?php echo $SIDEBAR_RIGHT; ?></div> | |
</div> | |
<?php } else { | |
// no sidebar is active so we show only the Main Content | |
?> | |
<div class="main-content"><?php echo $MAIN_CONTENT; ?></div> | |
<?php } ?> | |
</div> | |
</div> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$block[1] = 'Main Content'; | |
$block[2] = 'Sidebar, Left'; | |
$block[3] = 'Sidebar, Right'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="<?php echo LIBRARY_URL; ?>/normalize/latest/normalize.min.css" rel="stylesheet" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="{{ LIBRARY_URL }}/normalize/latest/normalize.min.css" rel="stylesheet" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="<?php echo WB_URL; ?>/kit2/extension/phpmanufaktur/phpManufaktur/Library/normalize/latest/normalize.min.css" rel="stylesheet" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Anmeldemaske für den Backendzugang einbinden | |
if(FRONTEND_LOGIN AND !$wb->is_authenticated() AND VISIBILITY != 'private' ) { | |
$redirect_url = ((isset($_SESSION['HTTP_REFERER']) | |
&& $_SESSION['HTTP_REFERER'] != '') ? $_SESSION['HTTP_REFERER'] : WB_URL ); | |
$redirect_url = (isset($thisApp->redirect_url) | |
? $thisApp->redirect_url : $redirect_url ); | |
?> | |
<div id="loginmaske"> | |
<form name="login" action="<?php echo LOGIN_URL; ?>" method="post"> | |
<input type="hidden" name="redirect" value="<?php echo $redirect_url;?>" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// initialize the TemplateTools | |
require_once WB_PATH.'/kit2/extension/phpmanufaktur/phpManufaktur/TemplateTools/initialize.php'; | |
if ($template['cms']->cms_maintenance_active()) { | |
// show the maintenance screen | |
$template['twig']->display('@pattern/bootstrap/maintenance.twig'); | |
// exit the script | |
exit(); | |
} | |
// show the template | |
$template['twig']->display('twig/template.twig'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// initialize the TemplateTools | |
require_once WB_PATH.'/kit2/extension/phpmanufaktur/phpManufaktur/TemplateTools/initialize.php'; | |
if ($template['cms']->cms_maintenance_active()) { | |
if (false === $template['cms']->cms_maintenance_header_searchbot()) { | |
// if the site is not crawled by a searchbot show the maintenance screen | |
$template['twig']->display('@pattern/bootstrap/maintenance.twig'); | |
} | |
// important: exit the script | |
exit(); | |
} | |
// show the template | |
$template['twig']->display('twig/template.twig'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
{# show a hint if the maintenance mode is active #} | |
{% include '@pattern/bootstrap/maintenance.hint.twig' %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<?php | |
require_once WB_PATH.'/kit2/extension/phpmanufaktur/phpManufaktur/TemplateTools/initialize.php'; | |
$template['twig']->display('@pattern/bootstrap/head.simple.twig'); | |
?> | |
<body> | |
<div class="container"> | |
<div class="logo-container row"> | |
<div class="logo col-sm-3 hidden-xs"> | |
<a href="<?php echo CMS_URL; ?>" title="<?php echo CMS_TITLE; ?>"> | |
<img src="<?php echo MANUFAKTUR_URL; ?>/TemplateTools/extension.jpg" class="img-responsive" alt="TemplateTools" /> | |
</a> | |
</div> | |
<div class="template-name col-sm-9 col-xs-12"> | |
<div class="template-name-header"> | |
<?php echo TEMPLATE_NAME; ?> | |
</div> | |
<div class="template-name-path"> | |
<?php echo TEMPLATE_PATH; ?> | |
</div> | |
</div> | |
</div> | |
<div class="content row"> | |
<div class="main col-sm-9 col-sm-push-3"> | |
<?php $template['twig']->display('@pattern/bootstrap/search.div.twig'); ?> | |
<?php $template['bootstrap']->breadcrumb(); ?> | |
<?php $template['cms']->page_content(); ?> | |
</div> | |
<div class="navigation col-sm-3 col-sm-pull-9"> | |
<?php $template['cms']->show_menu2(); ?> | |
</div> | |
</div> | |
<div class="footer row"> | |
<div class="col-sm-9 col-sm-offset-3"> | |
<?php echo PAGE_FOOTER; ?> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="<?php echo CMS_URL; ?>" title="<?php echo CMS_TITLE; ?>"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "@pattern/bootstrap/html.simple.twig" %} | |
{% block body %} | |
<div class="container"> | |
<div class="logo-container row"> | |
<div class="logo col-sm-3 hidden-xs"> | |
<a href="{{ CMS_URL }}" title="{{ CMS_TITLE }}"> | |
<img src="{{ MANUFAKTUR_URL }}/TemplateTools/extension.jpg" class="img-responsive" alt="TemplateTools" /> | |
</a> | |
</div> | |
<div class="template-name col-sm-9 col-xs-12"> | |
<div class="template-name-header"> | |
{{ TEMPLATE_NAME }} | |
</div> | |
<div class="template-name-path"> | |
{{ TEMPLATE_PATH }} | |
</div> | |
</div> | |
</div> | |
<div class="content row"> | |
<div class="main col-sm-9 col-sm-push-3"> | |
{% include('@pattern/bootstrap/search.div.twig') %} | |
{{ bootstrap_breadcrumb() }} | |
{{ page_content() }} | |
</div> | |
<div class="navigation col-sm-3 col-sm-pull-9"> | |
{{ show_menu2() }} | |
</div> | |
</div> | |
<div class="footer row"> | |
<div class="col-sm-9 col-sm-offset-3"> | |
{{ PAGE_FOOTER }} | |
</div> | |
</div> | |
</div> | |
{% endblock body %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="{{ CMS_URL }}" title="{{ CMS_TITLE }}"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment