Page tree
Skip to end of metadata
Go to start of metadata

This is a short info about integrating Live Blog liveblog output in a Newscoop page.

Download code with liveblog integration

You can download the zip from github.

Copy files to your existing instance

Copy following files/dirs to your newscoop folder in the proper path e.g. library/Guzzle into your library.

  • library/Guzzle,
  • library/Symfony,
  • library/Newscoop/Livedesk,
  • js/apps,
  • application/controllers/LivedeskController.php,
  • include/smarty/campsite_plugins/block.liveblog.php.

Edit settings

edit application/Bootstrap.php and add in _initContainer method right before

Zend_Registry::set('container', $container);

following code:

$container->register('livedesk.client', 'Guzzle\Http\Client')->addArgument('%liveblog_url%');
$container->register('livedesk.blog', 'Newscoop\Livedesk\BlogFacade')->addArgument(new sfServiceReference('livedesk.client'));

and in application/configs/application.ini add in production section:

[production] # only if you don't have it there
liveblog_url = "http://liveblog.lab.sourcefabric.org/" # here put your livedesk instance url

Edit the template

Open you template file where you want to display the liveblog and paste there following code:

<script type="text/template" id="item-tw-template">
<% if (item.has('AuthorPerson') && 'imageLink' in item.get('AuthorPerson')) { %>
<figure><img src="<%= item.get('AuthorPerson').imageLink %>" alt="Gravatar" /></figure>
<% } %>
<div class="result-content">
    <div class="result-text"><%= item.get('Content') %></div>
    <p class="attributes"><i class="source-icon"></i> by <%= item.get('AuthorName') %>
        <time><%= item.getPublished() %></time>
    </p>
</div>
</script>

<script type="text/template" id="item-quotation-template">
<div class="result-content">
    <div class="result-text"><%= item.get('Content')  %></div>
    <p class="attributes">by <%= item.get('AuthorName') %>
        <time><%= item.getPublished() %></time>
    </p>
</div>
</script>

<script type="text/template" id="item-service-template">
<div class="result-content">
    <div class="result-text"><%= item.get('Content')  %></div>
    <p class="attributes"><i class="source-icon"></i> by <%= item.get('AuthorName') %>
        <time><%= item.getPublished() %></time>
    </p>
</div>
</script>

<script type="text/template" id="item-wrapup-template">
<span class="big-toggle"></span>
<h3><%= item.get('Content') %></h3>
</script>

<script type="text/template" id="item-advertisement-template">
<%= item.get('Content')  %>
</script>

{{ liveblog id=1 }}
<div class="live-blog">
    <div id="liveblog-posts"></div>
</div>
{{ /liveblog }}

id parameter of liveblog smarty block must be blog id from liveblog instance.

Customize

You can add css classes and ids to script templates and change the look and feel via css.

  • No labels