realblog show categorie in template

Third Party Plugins to CMSimple - how to install, use and create plugins

Moderator: Tata

bastingse
Posts: 272
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

realblog show categorie in template

Post by bastingse » Tue Sep 06, 2016 11:18 am

Folks,

Did search the forum but can't find a solution.
On this website: http://infobergterblijtviltgeulhem.nl/index.php
I'm using 2 categories with RealBlog.

I create a H1 page named 'Agenda' and i do add this code to the page {{{Realblog_blog(true, 'Agenda');}}} and i add this code {{{rbCat('|Agenda|');}}} to a article. Now that H1 page is showing only that article.
I create a H1 page named 'Nieuws' and i do add this code to the page {{{Realblog_blog(true, 'Nieuws');}}} and i add this code {{{rbCat('|Nieuws|');}}} to a article. Now that H1 page is showing only that article.

So far so good!

In the template i added this code:
<?php echo Realblog_link('Nieuws')?>
and a bit below i added this code:
<?php echo Realblog_link('Agenda')?>

Now i did expecting that it was showing only the articles specified in the code but unfortunately it shows all articles.
Can this be solve???

Any help is much appreciated!!

Michael_G
Posts: 63
Joined: Thu Feb 18, 2016 11:01 pm

Re: realblog show categorie in template

Post by Michael_G » Thu Sep 08, 2016 11:47 am

Hi bastingse,

since today I have decided to use RealBlog, too.
Therefore I have read the help file http://3-magi.net/demo/presentation/plu ... p/help.htm and have found the answer for you:
Categories
It is not possible for visitors to filter for categories, but you can prepare separate CMSimple_XH pages for each category, and display the respective posts on these pages by passing a second argument to Realblog_blog():

{{{Realblog_blog(false, 'Category 1');}}}
This means you have to make separate pages for each category. It´s not possible to show it sorted on one page together.

Maybe it´s not so bad to do it separate.

At my website I will use it for my News-Category with separate submenus for
-News on one´s own account
-Exhibitions

So I will set two links on the main menu "News" to them. It´s very similar as your scheme I think.
Ciao,
Michael

cmb
Posts: 13316
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: realblog show categorie in template

Post by cmb » Thu Sep 08, 2016 2:11 pm

bastingse wrote:Now i did expecting that it was showing only the articles specified in the code but unfortunately it shows all articles.
Can this be solve???
The basic problem is that Realblog is actually meant for a single blog only, it has no notion of multiple separate blogs yet (as can be seen in the plugin administration, where all articles are listed).

Another, secondary issue is that the categories are not stored as separate field in the database, but rather as some pseudo-plugin-calls in the blog article. That makes filtering by category slower than necessary, and will be real issue if the FlatFile database will be replaced by something that is still maintained.

Anyhow, for now the simplest solution to have two independent blogs would be to install another copy of Realblog and rename all occurrences of "realblog" to "realblog2". Not clean, but should work (I've did that with an older version of Realblog once).

Another option might be to use Miniblog.
Christoph M. Becker – Plugins for CMSimple_XH

bastingse
Posts: 272
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

Re: realblog show categorie in template

Post by bastingse » Thu Sep 08, 2016 5:17 pm

Michael_G wrote: This means you have to make separate pages for each category. It´s not possible to show it sorted on one page together.

So I will set two links on the main menu "News" to them. It´s very similar as your scheme I think.
Thanks Michael for helping. I already came to that conclusion and i already made 2 pages, that all works fine. But what i want is add them in the template as well and that is not possible.

Thanks anyway for trying to help!

bastingse
Posts: 272
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

Re: realblog show categorie in template

Post by bastingse » Thu Sep 08, 2016 5:20 pm

cmb wrote:for now the simplest solution to have two independent blogs would be to install another copy of Realblog and rename all occurrences of "realblog" to "realblog2". Not clean, but should work (I've did that with an older version of Realblog once).
Thanks Christoph for explenation, clear for me now.
Indeed i think the most simple way is to rename 'Realblog' to another name, for example 'agenda'. textwrangler is a easy tool do this. I will let you know the results!

bastingse
Posts: 272
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

Re: realblog show categorie in template

Post by bastingse » Sun Sep 11, 2016 6:45 am

Funny but it didn't work...... :cry:

I did rename all the strings in the plugin with a '2' after it:
realblog
Realblog
RealBlog
realBlog
REALBLOG

Also in the template i did rename it.
Now i do get a white page when i upload the plugin.....
Any idea??

lck
Posts: 1976
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: realblog show categorie in template

Post by lck » Sun Sep 11, 2016 12:49 pm

Hello bastingse,

I've tested it and it worked so.

I copy and rename: ./plugins/realblog to realblog2

With Notepad++: Search "Find in Files" > "Replace in Files" (!important, enable Option: "Match case")
REALBLOG to REALBLOG2
Realblog to Realblog2
RealBlog to RealBlog2
realblog to realblog2
realBlog to realBlog2

On a CMSimple_XH page, write:

Code: Select all

{{{Realblog2_blog();}}} 
After doing this, you get an:
Fatal error: Cannot redeclare rbCat() (previously declared in D:\xampp\htdocs\cmsimplexh167\plugins\realblog\compat.php:109) in D:\xampp\htdocs\cmsimplexh167\plugins\realblog2\compat.php on line 110
after comment out this function i get:
Fatal error: Cannot redeclare commentsMembersOnly() (previously declared in D:\xampp\htdocs\cmsimplexh167\plugins\realblog\compat.php:122) in D:\xampp\htdocs\cmsimplexh167\plugins\realblog2\compat.php on line 123
I could solve it, by changing the name of function in plugins\realblog2\compat.php, e.g.:
rbCat to rbCat2
commentsMembersOnly to commentsMembersOnly2
(@ Christoph: Is it the right solution?)

I can send you a copy of my realblog2.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

cmb
Posts: 13316
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: realblog show categorie in template

Post by cmb » Sun Sep 11, 2016 2:25 pm

lck wrote:I could solve it, by changing the name of function in plugins\realblog2\compat.php, e.g.:
rbCat to rbCat2
commentsMembersOnly to commentsMembersOnly2
(@ Christoph: Is it the right solution?)
Indeed, these two functions don't follow the naming convention, so they have to be renamed "manually".

And indeed, turning on Debug-Mode in case of a white screen is always a good idea.
Christoph M. Becker – Plugins for CMSimple_XH

bastingse
Posts: 272
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

Re: realblog show categorie in template

Post by bastingse » Sun Sep 11, 2016 6:25 pm

lck wrote:I've tested it and it worked so.

I can send you a copy of my realblog2.
Fantastic that you find the solution!!!
And yes, i copy would be much appreciated..... am i lazy now?? :D

lck
Posts: 1976
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: realblog show categorie in template

Post by lck » Sun Sep 11, 2016 8:42 pm

bastingse wrote:And yes, i copy would be much appreciated.
Done.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

Post Reply