Skip to content

Instantly share code, notes, and snippets.

@hissy

hissy/pagetype.php

Last active Dec 20, 2015
Embed
What would you like to do?
[concrete5] Hard code a Social Share Lite Block into Page Type template (~5.6.x)
<?php defined('C5_EXECUTE') or die("Access Denied.");
// controllers/blog_entry.php
class BlogEntryPageTypeController extends Controller {
public function on_start() {
$social_share_lite = BlockType::getByHandle('social_share_lite');
$social_share_lite->controller->setBlockObject($social_share_lite);
$social_share_lite->controller->fblike = 1;
$social_share_lite->controller->tweet = 1;
$social_share_lite->controller->outputAutoHeaderItems();
$social_share_lite->controller->on_page_view();
}
}
<?php
// in themes/your_theme/blog_entry.php
$bt = BlockType::getByHandle('social_share_lite');
$bv = new BlockView();
$bv->render($bt, 'view', array('fblike'=>1,'tweet'=>1));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment