How to manually modify or add blocks to the right sidebar?

Ed Bespyatkin Posted in General Discussion 5 years ago

My task is to insert a list of all blogs in the right sidebar (allblogsitem.php).
I understand that you need to change the code in the blog plugin. What function is responsible for the placement of blocks in the design of the cms?
"sidebar:right"?

Sorry if the question is not correct ...

Replies
us Rishi B Replied 5 years ago

It seems that you may not be familiar with the basics of how components work in Ossn as Z-Man said. It's rather easy to get all blogs, just look at the functions in components/Blog/classes/Blog.php. There are built in functions to get all blog posts site-wide as well a function to get all blog posts by user.

Russian Ed Bespyatkin Replied 5 years ago

I already understood and read the manuals. I will try to make my own plugin. Thanks for the advice.

German Michael Zülsdorff Replied 5 years ago

Looks like you didn't have a look at the example components I mentioned?

Please do so. And aside from that please study the complete Ossn documentation, as you will learn that Ossn is based on a modular concept. 'Modular' means that changing or adding functionality has to be achieved by creating your own new component (module) instead of altering anything existing.

So first of all: Don't touch the Blog component since the next update will overwrite all that you would have changed.

Next, create your own component and as a first exercise just apply that hook the way I said and a function of yours which will simply display a 'hello' on the right sidebar.

Russian Ed Bespyatkin Replied 5 years ago

In file
components/Blog/ossn_com.php
in lines

case 'all_blogs_by_date':
                        $blog = new Blog;
                        $blogs = $blog->getBlogsByDate();
                        $count = $blog->getBlogsByDate(array(
                            'count' => true
                        ));
                        $title               = ossn_print('com:blog:blog:all');
                        $contents['content'] = ossn_plugin_view('blog/pages/all_blogs_by_date', array(
                            'blogs' => $blogs,
                            'count' => $count,
                            'page_header' => ossn_print('com:blog:list:sort:by:date:page:header')
                        ));
                        $contents              = ossn_set_page_layout('newsfeed', $contents);
                        echo ossn_view_page($title, $content);

tried to apply

ossn_add_hook('newsfeed', "sidebar:right", $contents);

Not work.

tried to output in the template (themes/goblue/plugins/default/theme/page/layout/newsfeed.php)
this file
components/Blog/plugins/default/blog/pages/allblogsby_date.php
Not work. Please, what am I doing wrong?

German Michael Zülsdorff Replied 5 years ago

Some so-called 'hooks' are responsible for what is going to be displayed on the right sidebar.
You may add your own hook like

ossn_add_hook('newsfeed', "sidebar:right", 'YOUR-OWN-FUNCTION');

See OssnAds and HTMLSidebar components for examples.

Russian Ed Bespyatkin Replied 5 years ago

imageenter image description here