Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
😄

Takuro Hishikawa hissy

💭
😄
View GitHub Profile
@hissy
hissy / view.php
Created Feb 25, 2014
[concrete5] Display Year as heading in the list of Page List template
View view.php
<?php
$dh = Loader::helper('date');
$year = new DateTime('first day of next year');
$isFirst = true;
?>
<?php foreach ($pages as $page):
// Prepare data for each page being listed...
$title = $th->entities($page->getCollectionName());
@hissy
hissy / view.php
Created Mar 18, 2014
#concrete5 #PageList Force sort option from Page List Block template
View view.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$rssUrl = $showRss ? $controller->getRssUrl($b) : '';
$th = Loader::helper('text');
// Get PageList again
$pl = $controller->getPageList();
// Set sortby
$pl->sortBy('ak_example_attribute_handle','asc');
// Get pages again
@hissy
hissy / view.php
Last active Aug 29, 2015
#concrete5 #DesignerContentPro Manual Nav block made with Designer Content Pro ("Combo" Link field, additional option field)
View view.php
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<?php /* This block was made with Designer Content Pro. Visit http://theblockery.com/dcp for documentation. */ ?>
<?php
/**
* link: Link Field
* css_class: Textbox field
*/
// Get current page path
@hissy
hissy / default.php
Created Mar 30, 2014
#concrete5 The link to force desktop theme
View default.php
<?php
$uh = Loader::helper('concrete/urls');
$url = $uh->getToolsURL('disable_mobile') . '?rcID=' . $c->getCollectionID();
?>
<a href="<?php echo $url; ?>"><?php echo t('View desktop site'); ?></a>
@hissy
hissy / controller.php
Last active Aug 29, 2015
[concrete5] Add split form for date/time attribute type (5.6)
View controller.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
class DateTimeAttributeTypeController extends Concrete5_Controller_AttributeType_DateTime {
public function form() {
$this->load();
$dt = Loader::helper('form/date_time');
$caValue = $this->getValue();
$html = Loader::helper('html');
View gist:8211ed84e3af80db7519
<h1><?php
$c = Page::getCurrentPage();
$nh = Loader::helper('navigation');
// concrete5 第4階層以降であれば、第3階層 のページタイトルを表示させる。
// [現在のページタイトル] - [第3階層のページタイトル]
// ページ属性 display_secondary_title がチェックされていれば第3階層のタイトルを表示しない
// $trail [0] はトップ
// $trail [1] は第2階層
echo h($c->getCollectionName());
if (!$c->getAttribute('display_secondary_title')){
@hissy
hissy / site_post.php
Created Jul 9, 2014
#concrete5 quick debug snippet
View site_post.php
<?php
$req = Request::get();
if ($req->getRequestPath() == 'debug') {
// debug some stuff
exit;
}
@hissy
hissy / view.php
Last active Aug 29, 2015
#concrete5 Override View to exclude tablet devices from checkMobileView
View view.php
<?php
// For concrete5 ~5.6.x
// libraries/view.php
defined('C5_EXECUTE') or die("Access Denied.");
class View extends Concrete5_Library_View {
public function checkMobileView() {
if(isset($_COOKIE['ccmDisableMobileView']) && $_COOKIE['ccmDisableMobileView'] == true) {
define('MOBILE_THEME_IS_ACTIVE', false);
@hissy
hissy / controller.php
Created Jul 16, 2014
#concrete5 How to load required models by the package controller
View controller.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
class ExamplePackage extends Package {
protected $pkgHandle = 'example';
protected $appVersionRequired = '5.6.3';
protected $pkgVersion = '1.0';
@hissy
hissy / controller.php
Last active Aug 29, 2015
an example of 5.7 compatible package controller (just trial)
View controller.php
<?php
namespace Concrete\Package\SocialShareLite;
use Package;
use BlockType;
class Controller extends Package {
protected $pkgHandle = 'social_share_lite';
protected $appVersionRequired = '5.6.9';
protected $pkgVersion = '1.1';
You can’t perform that action at this time.