Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Merge pr #96 from branch 'samsonasik/fix-fb-count-share'
Browse files Browse the repository at this point in the history
* fix-fb-count-share:
  [#96: changelog]
  fixes typo
  Fixes #51 : Share facebook button count
  • Loading branch information
samsonasik committed Jan 4, 2015
2 parents 2eea3a3 + 2bc2973 commit e973644
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [89: Fixes bug : using viewmodel->terminate() to check whenever view has layout](https://github.com/sitrunlab/LearnZF2/pull/89)
- [90: hotfix : restrict other "in db" modules to be download-able](https://github.com/sitrunlab/LearnZF2/pull/90)
- [91: remove "ant" on .travis.yml, use "parallel" instead](https://github.com/sitrunlab/LearnZF2/pull/91)
- [96: Share facebook button count fix](https://github.com/sitrunlab/LearnZF2/pull/96)

## 0.0.2 - 2014-12-03

Expand Down
11 changes: 11 additions & 0 deletions module/Application/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,25 @@ public function onDispatch(MvcEvent $e)
$controllerClass = get_class($controller);
$moduleNamespace = substr($controllerClass, 0, strpos($controllerClass, '\\'));

$fbMeta['title'] = 'Real Live Learn ZF2';
$fbMeta['description'] = '';

// set title prepend of module desc...
$moduleDetail = $this->services->get('Doctrine\ORM\EntityManager')->getRepository('Application\Entity\ModuleList')->findOneBy([
'moduleName' => $moduleNamespace,
]);

if ($moduleDetail) {
$this->services->get('ViewHelperManager')->get('headTitle')->prepend($moduleDetail->getModuleDesc());
$title = $moduleDetail->getModuleDesc();
$description = $moduleDetail->getModuleDesc();

$fbMeta['title'] = $title.'-'.$fbMeta['title'];
$fbMeta['description'] = $description.'-'.$fbMeta['description'];
}

$e->getViewModel()->setVariable('fbMeta', $fbMeta);

$e->getViewModel()->setVariable('modulenamespace', $moduleNamespace);
$controller->layout('layout/2columns');
}
Expand Down
3 changes: 1 addition & 2 deletions module/Application/view/layout/2columns.phtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php echo $this->render('layout/header'); ?>


<div class="container container-main">

<!-- sidebar -->
Expand All @@ -26,7 +25,7 @@
<iframe src="http://ghbtns.com/github-btn.html?user=sitrunlab&repo=LearnZF2&type=fork&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe>
<div class="fb-wrap">
<div class="fb-share-button" data-layout="button_count" data-href="https://developers.facebook.com/docs/plugins/"></div>
<div class="fb-share-button" href="<?php echo $this->serverUrl() . $this->url(); ?>" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button_count"></div>
</div>
<br />
<br />
Expand Down
23 changes: 12 additions & 11 deletions module/Application/view/layout/header.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<?php echo $this->headMeta()
->appendName('viewport', 'width=device-width, initial-scale=1.0')
->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
->setProperty('og:title', $this->layout()->fbMeta['title'])
->setProperty('og:description', $this->layout()->fbMeta['description'])
->setProperty('og:image', $this->serverUrl() . '/img/zf2-logo.png');
?>

<!-- Le styles -->
Expand All @@ -27,20 +30,18 @@
->prependFile($this->basePath() . '/js/jquery.min.js')
->prependFile($this->basePath() . '/js/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9',))
->prependFile($this->basePath() . '/js/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9',))
; ?>

;
?>
</head>
<body>
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=471963102931624&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/id_ID/sdk.js#xfbml=1&appId=581080422025637&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
Expand Down

0 comments on commit e973644

Please sign in to comment.