We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Newsfeed format (dev opinion) | Forum

Stuart
Stuart May 3 '15
Hi guys just having a go at a bit of oxwall dev for the first time.


I am just playing and hacking with php and oxwall.


If you create a new plugin that has content and you want that content in the newsfeed.


I am confused at the format directory on how you create a plugin that adds a new news feed format?


Anyone any hints in the manner of operation as I am running a bit blind and this one I haven't a clue? 

dave Leader
dave May 3 '15
there are feed functions like feed.action feed.activity and such..  look at the skeleton plugin under the controllers/newsfeed.php bottom of file you will see a sample of a feed call


the skeleton plugin can be found in the store... http://www.oxwall.org/store/item/695



Stuart
Stuart May 4 '15
Sorry Dave I think I am already there as have managed to post to the feed.


What I am confused at is in the newsfeed plugin directory there is a formats directory for various types of feed.


This has confused be on how you could create a different type of feed?

dave Leader
dave May 4 '15
the only two i know about for sure are feed.action and feed.activity  but if  you use agent ransack search and look for feed.  <- there is a dot there, then you will see there are all kinds of feed.???
Stuart
Stuart May 4 '15
Hi pulled this from 1.7.3


event_handler.php for the video plugin.

public function feedEntityAdd( OW_Event $e )    {        $params = $e->getParams();        $data = $e->getData();
        if ( $params['entityType'] != VIDEO_BOL_ClipService::ENTITY_TYPE )        {            return;        }
        $videoService = VIDEO_BOL_ClipService::getInstance();        $clip = $videoService->findClipById($params['entityId']);        $thumb = $videoService->getClipThumbUrl($clip->id, $clip->code, $clip->thumbUrl);        if ( $thumb == "undefined" )        {            $thumb = $videoService->getClipDefaultThumbUrl();        }                $vars = array();        $format = "video";                if ( isset($data["content"]) && is_array($data["content"]) )        {            $vars = empty($data["content"]["vars"]) ? array() : $data["content"]["vars"];                        if ( !empty($data["content"]["format"]) )            {                $format = $data["content"]["format"];            }        }
        $content = array(            "format" => $format,            "vars" => array_merge(array(                "image" => $thumb,                "title" => $title = UTIL_String::truncate(strip_tags($clip->title), 100, '...'),                "description" => $description = UTIL_String::truncate(strip_tags($clip->description), 150, '...'),                "url" => array("routeName" => "view_clip", "vars" => array('id' => $clip->id)),                "embed" => $clip->code            ), $vars)        );
        $data = array_merge($data, array(            'time' => (int) $clip->addDatetime,            'ownerId' => $clip->userId,            'content' => $content,            'view' => array(                'iconClass' => 'ow_ic_video'            )        ));
        $e->setData($data);    }


I have been hacking away with Eclipse and until last week by PHP knowledge was nill so apols. I used to do a lot of dev work over a decade ago :) but horrid M$ stuff.


in the newsfeed plugin directory there is a format directory.

content.php

image_content.php

image_list.php

text.php

video.php


It would seem you can but would seem a bit arse-face? :) I thought maybe the formats would be dynamic and not hardcoded so you could create your own format.

Maybe there is some where to slot this in, haven't worked that one out yet.


Stuart 


ps if you copy and past the code I think it might become readable :)


dumb forum (thought I better edit) the forum doesn't have much function for posting code or anything not you the people :)


The Forum post is edited by Stuart May 4 '15
jack
jack Sep 14 '23
Following this post as I have to write my speech for me on this topic and have to present it in my class
GlassRepairsinTacoma
Maintain the nice perform, My partner and i examine handful of content with this internet site and also I do believe your net website will be genuine intriguing and contains received sectors regarding great details.procreator.website