2017 © Pedro Peláez
 

library zf-disqus

ZF module which facilitates integration of Disqus widgets

image

nikolaposa/zf-disqus

ZF module which facilitates integration of Disqus widgets

  • Sunday, July 2, 2017
  • by nikolaposa
  • Repository
  • 2 Watchers
  • 12 Stars
  • 9,458 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 6 % Grown

The README.md

ZfDisqus

![Build Status][ico-build] ![Code Quality][ico-code-quality] Code Coverage Latest Version, (*1)

ZF module which facilitates integration of Disqus widgets., (*2)

Installation

The preferred method of installation is via Composer. Run the following command to install the latest version of a package and add it to your project's composer.json:, (*3)

composer require nikolaposa/zf-disqus

Provide your Disqus shortname through configuration:

<?php
return [
    'disqus' => [
        'shortname' => 'your_disqus_shortname'
        //any other Disqus config can be provided here
    ],
    // ...
];

Enable the module in your application.config.php:

<?php
return [
    'modules' => [
        // ...
        'ZfDisqus',
    ],
    // ...
];

Usage

This module provides a Disqus view helper (ZfDisqus\View\Helper\Disqus) which is essentially a wrapper around the DisqusHelper. Refer to the DisqusHelper project documenation for more information about available widget methods., (*4)

Examples

Typical example would be in some application which uses layouts. Widgets should be rendered in specific templates, while Disqus assets will be rendered somewhere in the layout, most commonly within the head or tail sections:, (*5)

Template, (*6)



disqus()->configure([
        'identifier' => 'article_' . $this->post->id
        'title' => $this->post->title,
    ]);
?>

<article>
    <h1><?php echo $this->escapeHtml($this->post->title); ?></h1>

    <?php echo $this->post->body; ?>
</article>



Comments:

disqus()->thread(); ?>

Layout, (*7)


<html>
    <head>
        <title>Blog</title>
    </head>

    <body>
        <?php echo $this->content; ?>

        <!-- Render Disqus JS code -->
        <?php echo $this->disqus(); ?>
    </body>
</html>

Credits

License

Released under MIT License - see the License File for details., (*8)

The Versions