By Paula Livingstone on Saturday, 09 December 2017
Posted in General
Replies 6
Likes 0
Views 842
Votes 0
Hi there,

Im using Gantry and have a particle which has the ability to pick up articles of a given category and display them. Im quite happy modifying this particle at the backend in php(twig) but Id like to know the best way to hook into the easyblog backend to pick up all articles of a given category.

Has this been done before?
Hey Paula,

I am really sorry for the delay of this reply as it is a weekend for us here. Hm, we don't currently have integration with particles in Gantry currently but it should be pretty easy to pick articles from a category up.

Here's the code that you would need:

[gist]
<?php
// Include the engine
include_once(JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php');

// Only fetch 10 posts
$limit = 10;

// Category id's (one or more)
$options = array(1);

$model = EB::model('Category');
$posts = $model->getPosts($options, $limit);
[/gist]
·
Sunday, 10 December 2017 14:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Thats great thanks Mark
·
Sunday, 10 December 2017 18:27
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome Paula, let us know if you still need any further assistance on this.
·
Sunday, 10 December 2017 20:20
·
0 Likes
·
0 Votes
·
0 Comments
·
Paula have you figured out how to do this? I have read the documentation of Gantry and Mark's answer just don't know how to put them together. According to https://github.com/gantry/gantry5/issues/1480 this should be doable.
·
Tuesday, 19 November 2019 23:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Shenkwen,

I think Paula added those PHP code under his template from backend from what I read his first post, but i think it would be best if you can consult with your current template provider and see where you should put those PHP code on your site.
·
Wednesday, 20 November 2019 11:58
·
0 Likes
·
0 Votes
·
0 Comments
·
I am asking her because I am using the same gantry framework with her. So her code should also work for me.
·
Wednesday, 20 November 2019 13:08
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post