The Easter Sale is on! Join now or renew your subscription with a 25% OFF! Read More

Support Forum

vincent
vincent
Offline
I know this is a gantry issue so I put it here in the general offtopic.
The concept of particle is great, even greater along with IT's particles. But sometimes I get tired with Joomla article system. From time to time, I'd like to use K2 or Easyblog as my main content organizer, especially when Easyblog provides you the option to directly edit and upload articles from Microsoft Word, which is a huge bonus for clients that are not very comfortable with Joomla's editors. So the problem is, how to retrieve these contents?

I know that for com_content, we can do something like
joomla.finder('cateogory', options)


For easyblog, their posts can be retrieved like this:
<?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);


So do I have to edit some PHP files to hookup twig environment with easyblog so that I can do
easyblog.finder('cateogory', options)

?

I think this should be doable, can you tell me where I should start looking?
Responses (6)
  • Accepted Answer

    Wednesday, November 20 2019, 06:27 PM - #Permalink
    Hi Vincent,

    The Gantry 5 particles cannot fetch content from a 3rd party extension (K2, EasyBlog, SEBLOD, etc). They can fetch Joomla Articles only. This is a limitation of the Gantry 5 API.
    For more details, please have a look at this discussion and the links in it.
    The reply is currently minimized Show
  • Accepted Answer

    vincent
    vincent
    Offline
    Friday, November 22 2019, 04:19 AM - #Permalink
    They replied me on Github. Looks like it is not hard, just creating a plugin will do.

    class Easyblog { ... }

    class plgGantryEasyblog extends \Joomla\CMS\Plugin\CMSPlugin
    {
    public function onGantry5ThemeInit($theme)
    {
    if ($this->app->isClient('site'))
    {
    $gantry = \Gantry\Framework\Gantry::instance();
    $gantry['easyblog'] = function() { return new Easyblog(); };
    }
    }
    }


    and then
    {% set easyblog = gantry.easyblog %}


    I will test this out once I get my current project done. Before that I will just go back to using roksprocket which can use easyblog as content provider.
    The reply is currently minimized Show
  • Accepted Answer

    vincent
    vincent
    Offline
    Friday, November 22 2019, 04:20 AM - #Permalink
    However I don't quite understand what he means by saying

    PPS. If you have a custom theme, you can do it from there, too.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, November 22 2019, 01:15 PM - #Permalink
    Hi Vincent,

    I don't understand if you have got a reply from the Gantry team or from the EasyBlog Team.
    I also don't know the context of "If you have a custom theme, you can do it from there, too."
    Anyway, I'm glad you figured it out since there is nothing we can do on our end.
    The reply is currently minimized Show
  • Accepted Answer

    vincent
    vincent
    Offline
    Friday, November 22 2019, 06:23 PM - #Permalink
    Sorry I messed up this post with a stackoverflow question of mine where people post a link to the Github issue. So for your information, the issue is here: https://github.com/gantry/gantry5/issues/1480
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, November 23 2019, 02:53 AM - #Permalink
    Thanks.
    The reply is currently minimized Show
Your Reply

Become an insider | Subscribe to our Newsletter
Subscribe to our mailing list and stay up-to-date with all our awesome releases, latest updates and amazing discount offers!