ElkArte Community

Extending Elk => Addons => Addons ideas and questions => Topic started by: radu81 on January 10, 2015, 04:39:46 pm

Title: A better Board News block for Simple Portal
Post by: radu81 on January 10, 2015, 04:39:46 pm
There a lot of users that are asking an integration with Worpress and in most of cases they ask it just because WP is more flexible in displaying the articles in home page and I'm pretty sure someone will ask here. On Sm.org the answer you'll get is "you cand do it with a portal and some work". Well that "some work" was never been published. Even on simpleportal.net there are different topics that are asking this and no solution has been posted.

I'm not a big fan of WP and will never use it, I still prefer the old and good Joomla but that's a matter of personal taste. So what do you think about giving some more options into the Board News block?

What should do this new Board News block?

I can say I found an alternative way of doing this using the ILA mod but it's not the same thing. I also have a few visitors that saw my sig on sm.org and asked me how I did this using my Contact form. You may also have a look at the old XenPorta that had a lot of success in the past even if it has less features than SP, but had a great block for displaying the last topics from a category with a "blog style look"
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on January 10, 2015, 06:17:21 pm
Ahhh... Spoiler (click to show/hide)

No, I don't want to start typing now otherwise I'm gonna stay awake for the next two hours. LOL
In short:
* use a forum for blogging is no different from using a blog for "foruming"
[1],
yep, a bridge with WP would be nice to have.
yep, a bridge with Joomla! is nice to have [2].
* yep, improve the "board index" would be very nice (there is a topic around, don't remember where... as usual! LOL), maybe even something where guests get something (like a description, or so), while members something else (for example recent activity).
Still, I want to write a simple blog completely integrated into the forum, but that is something for after I have finished my tags addon because blogs need tags.
Actually I have it already in the form of a jFusion plugin and partially of a stand-alone plugin for Joomla!, I just have to find a moment to pack them properly and publish the packages and the code.
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on January 10, 2015, 06:59:08 pm
I started with joomla back in 2007 and choosed smf because at that time it was the only forum which could be integrated into J!. I know Jfusion and I don't have any plans to use a CMS. Think how things changed now :D I want my forum simple, intuitive, fast and easy to manage, and for me smf / elkarte are doing this very well ;) IMHO using a CMS is a pita when it comes to upgrades

What I am asking is just a better block for SP or if there are any plans doing it. I can live without it, but it would be nice to have it ;)
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on January 13, 2015, 11:16:00 am
heh...
I tend to start typing and not be able to stop any more daydreaming all the stuff I would like to do. LOL (At least in my dreams I don't have to hit the wall that is the lack of time. :P)

Point 1 and 2 should not be too difficult to do.
I'm not sure what you mean in point 3... oh, I got it while writing, yes!
/me is still daydreaming (while thinking what's the next step in breaking apart Elk code to decouple the calendar entirely from the main code).
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on January 13, 2015, 11:48:19 am
Emanuele for me there is no hurry, as I said "it will be nice to have it" so take your time ;) Maybe this topic could help
simpleportal.net/index.php?topic=13658
simpleportal.net/index.php?topic=10766.20
destek.smfmod.com/haber-blogu-t18235.0.html

here a "blogish style" using smf and SP aplicacionesmart.com
Title: Re: A better Board News block for Simple Portal
Post by: meetdilip on January 13, 2015, 11:57:35 am
I too like some article system in place.  :)
Title: Re: A better Board News block for Simple Portal
Post by: ahrasis on January 13, 2015, 01:00:10 pm
I like. Article system is meantly something like WP, Jomla and portal addon. I also wish something similar that is an upgrade to profile page to cater something like that. Member can write his own post / article / status at his profile like having his own forum board where he is in control of it. This is what I think I was trying to ask here:

Quote from: ahrasis – Good morning,

I wish to request a permission based addon where a member can add a profile header picture. This picture is to be placed in the header part in his profile. The idea is to make a member feel like having his own personal page.

Also profile thoughts and comments where member can post his thoughts and others can comment with regards to that. He can limit that to his buddies or open for public (or nobody can comment). For this, if it is too much, there is another replacement idea.

Instead of doing the above mentioned addon, is it possible to create a permission based addon that allow a board in a category be used as a member board. Similarly, he can limit that to his buddies or open for public (or nobody can comment).

Permitted members will see a button / menu to create his own board, if that is not yet created. If it is already created, there will be a link to that board. Only board owner can create topic in it and 5-10 of his recent topic will be displayed in his profile page.

Huh... a long one for the second (thoughts and comments) part. Any taker(s)? ;)

ahrasis want to think that his request is relevant
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on April 14, 2015, 05:53:42 pm
I tried this one.
Not tested very deeply, so... use at your own risk, if you have a test board better. ;)

There is a bit of css to add to portal.css:
Code: [Select]
.sp_article_content .sp_attachment_thumb {
float: left;
margin-right: 10px;
}
.sp_article_content .post:after {
content: '';
display: block;
width: 100%;
clear: both;
}

Ohhh... darn!
I just realized this works only for the development branch... darn!
Tomorrow I'll see to backport it to the current stable version.
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on April 16, 2015, 05:40:29 pm
Sorry but how do I use this?   O:-)
Title: Re: A better Board News block for Simple Portal
Post by: Spuds on April 16, 2015, 09:16:28 pm
The development version of SP completely overhauled the way "blocks" are added and in doing that added much coolness :D

The way it used to be (or is) was to adding a block required adding a new function inside of portalblocks and a db entry or perhaps a custom PHP page.  

The new way allows you to add a block by simply adding a file/program to the spblocks directory, where it is auto discovered and made available as a standard block.  So with the new branch you would just take the BoardNews.block.php above and drop it in your spblocks directory and then use it like any other block ... coolness!
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on April 17, 2015, 02:57:00 am
TL;DR: I have to "rewrite" it. I wanted to re-do it yesterday, but this year I'm not lucky at all, I got a cold (after the flu in February) and it's almost gone now. Today I may have some other things to do, so it may take until the week-end to be "converted"... :(
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on April 17, 2015, 08:39:25 am
Quote from: Spuds – The new way allows you to add a block by simply adding a file/program to the spblocks directory, where it is auto discovered and made available as a standard block.  So with the new branch you would just take the BoardNews.block.php above and drop it in your spblocks directory and then use it like any other block ... coolness!
That is a great news, I'll wait for the new version ;)

Quote from: emanuele – Today I may have some other things to do, so it may take until the week-end to be "converted"... :(
Take your time, no hurry for me ;)
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on May 06, 2015, 12:22:39 pm
I'm sorry, I don't have a "normal" version handy and I need to reinstall everything to have one... would you mind give it a try?
Of course take a backup of the current file.
If you have any custom change to some of the blocks, let me know, maybe attach your version and I'll apply the changes. ;D

ETA: removed broken file.
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on May 06, 2015, 03:54:44 pm
I'll try it in localhost, thank you for looking into this.
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on May 13, 2015, 07:08:49 pm
sorry but I cannot understand what is changed in this version  :-[
All I did was to overwrite the Portalblocks.subs.php in sources/subs folder
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on May 15, 2015, 07:00:20 am
That should be enough, if there is something attached to the first message of a board news block, or if there is an image tag, it should show it next to the text (floated) in the new block.
Title: Re: A better Board News block for Simple Portal
Post by: CrimeS on May 15, 2015, 09:56:49 am
Quote from: emanuele – That should be enough, if there is something attached to the first message of a board news block, or if there is an image tag, it should show it next to the text (floated) in the new block.

Which function (in PortalBlocks.subs.php) allows to do that?
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on May 24, 2015, 05:39:11 pm
Oook!

I'm back on this, and this time I've been able to setup a forum and do the appropriate testing. O:-)

@CrimeS I attached a diff as well to highlight the changes. ;D
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on August 24, 2015, 06:04:31 pm
I'm afraid I forgot about this topic :(
I am testing it now ;) It's working, but images are shown in full width.

Thanks for your help!

Code: [Select]
sharkracingclub.it/sharkelk104
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on August 28, 2015, 05:47:14 pm
I can't see the request for resizing... :P

I'm not sure how "strict" the css shold be, but:
Code: [Select]
.action_home .post .sp_attachment_thumb img {
    max-width: 50%
}
should be good enough.
Than you can tweak the width to the size you prefer. ;)
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on September 27, 2015, 03:00:31 pm
Sorry for the delay and thanks for your help.
The block is working fine (demo in the link above) but I get an error:
An Error Has Occurred
Unable to load the 'main' template.

after the news block
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on September 29, 2015, 04:38:01 pm
That's likely another block.
What other block do you have in the home below this one?
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on September 29, 2015, 05:18:14 pm
I think it's something wrong with that install.
I updated Elkarte to 1.0.5, I uninstalled Simple Portal, and installed the latest version, I deleted all blocks in SP and the error persist. I checked with original "PortalBlocks.subs.php " and also the modified one but nothing

I think I should try on a clean install first. Could be for some error in my custom.css? That was the only file I modified (or at least that I remember) :)
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on September 30, 2015, 02:21:41 am
Nope, a css cannot generate such an error.
So you get the error even with SP uninstalled? O_O
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on September 30, 2015, 02:29:40 am
nope, I get that error only on SP homepage. On forum I don't see that error even with SP installed
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on October 12, 2015, 04:13:58 pm
Installed on my forum skoda, but I have some conflicts with fancybox (http://www.elkarte.net/community/index.php?topic=1373.0) addon :( Unable to load the requested image.
Is there a way to solve this?
Title: Re: A better Board News block for Simple Portal
Post by: Flavio93Zena on October 12, 2015, 04:28:28 pm
...Link? It seems to work for me...
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on October 12, 2015, 04:31:34 pm
skodaclub.it/index.php
click on the image, there is Fancybox trying to open the image

(http://i.imgur.com/n0fotHu.png)
Title: Re: A better Board News block for Simple Portal
Post by: Flavio93Zena on October 12, 2015, 05:32:08 pm
So strange, the thumbnails at the bottom work regardless :o
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on October 12, 2015, 05:46:21 pm
in this case the fancybox should be disabled, the thumbnaol should point to topic url
Title: Re: A better Board News block for Simple Portal
Post by: Flavio93Zena on October 12, 2015, 05:55:16 pm
If you can figure out how to disable it in particular spots, let me know, because I want to do the same on smf.
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on October 12, 2015, 06:07:44 pm
In SMF if you are using HS4SMF mod from Spuds you can disable the fancybox effect into posts by using the tag alt=ns

ex:
[img alt="ns"]link_to_img[/img]
Title: Re: A better Board News block for Simple Portal
Post by: Flavio93Zena on October 12, 2015, 06:48:18 pm
No, I can't use that one because of license issues (y u do dis Spuds :( )
And even then, the problems are not images in posts with the one I am using, it's that it also parses custom titles images and sigs if I'm not mistaken ;D
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on October 13, 2015, 02:17:22 am
Re: license issues: O_o there is no license issues on using software. There could be redistributing it, but knowing Spuds he used MPL (v2) that is compatible with BSD (I didn't even change the headers of ILA for Elk 1.1, just plugged in the files and written some code).

Re: fancy box... need time to check.
Title: Re: A better Board News block for Simple Portal
Post by: Flavio93Zena on October 13, 2015, 03:22:22 am
Nope, license issues on commercial stuff, I think it's the only one mod from him that has and can't use it. I had installed it once, but when I realized it got uninstalled quickly :/

Good luck with that fancybox stuff though.
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on October 13, 2015, 04:54:29 pm
HS4SMF is MPL (https://github.com/Spuds/SMF-HS4SMF/blob/master/license.txt), I don't see any problem with using it for commercial purposes.
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on October 14, 2015, 03:02:45 am
This is what I have in HS4SMF:
QuoteEnable the Highslide 4 SMF Modification  Highslide JS is licensed under a Creative Commons Attribution-Non Commercial 2.5 License. This means you must get the author's permission and a commerical license to use Highslide JS on a commercial or governmental website, web application or SaaS project.

Enabling highslide means that you are agreeing to the Highslide License terms

and this in Fancybox for elkarte

QuoteFancybox JS is licensed under a Creative Commons Attribution-Non Commercial 3.0 License. This means you must get the author's permission and a commercial license to use Fancybox JS on a commercial website.

Enabling fancybox means that you are agreeing to the Fancybox License terms.

To support postimage lookups, this addon makes use of Ajax Cross Origin Plugin Licensed under the Creative Commons Attribution 3.0 Unported License.

Now back to topic  :D
Title: Re: A better Board News block for Simple Portal
Post by: Flavio93Zena on October 14, 2015, 09:57:43 am
Thanks, didn't feel like searching it, I'm on a very a bad period.
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on October 14, 2015, 12:26:21 pm
If you are using a 2 years and a half old version... :P
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on November 13, 2015, 04:49:49 am
any news on this? thank you
Title: Re: A better Board News block for Simple Portal
Post by: Spuds on November 13, 2015, 08:47:13 am
Just to note, my code is all MPL based and released that way.  Highslide.js is the one with the license restriction, I just make you acknowledge that license when you install their software.   Those restrictions are why I also moved away from it and started to use fancybox for the ElkArte addon.

Not sure what the issue is on the image in the SP block, sounds like fancybox is just not initialized for some reason.
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on November 13, 2015, 09:19:49 am
Quote from: Spuds – Not sure what the issue is on the image in the SP block, sounds like fancybox is just not initialized for some reason.

I would like to disable the fancybox on custom Portalblocks.subs.php that Emanuele made http://www.elkarte.net/community/index.php?topic=2387.msg17894#msg17894
Title: Re: A better Board News block for Simple Portal
Post by: Spuds on November 13, 2015, 09:41:01 am
I'll take a look at FB and SP this weekend, see what I can do
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on November 13, 2015, 02:21:57 pm
@radu81 I think you can disable it from within the code I wrote, if you open the file and search for:
Code: [Select]
<a href="', $news['href'], '" id="link_', $attachment['id'], '">
replacing the line with:
Code: [Select]
<a href="', $news['href'], '" id="nfb_link_', $attachment['id'], '">
that should be enough and should not break anything... I hope. O:-)
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on November 13, 2015, 03:33:31 pm
That did the trick, thank you very much!  8)
Title: Re: A better Board News block for Simple Portal
Post by: Spuds on November 13, 2015, 05:18:20 pm
Ah-ha ... it was your code :P
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on November 13, 2015, 05:26:59 pm
/me is innocent. :P
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on April 05, 2016, 03:34:13 pm
I'm having some errors in my log if I use php 5.6

Type of  error: General
 preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
File: /.../sources/subs/PortalBlocks.subs.php
Row: 2103

Code: [Select]
	$data = preg_replace('~<\!\[CDATA\[(.+?)\]\]>~eu', '\'#cdata_escape_encode#\' . Util::htmlspecialchars(\'$1\')', $data);

Is there a way to solve this?
Title: Re: A better Board News block for Simple Portal
Post by: Frenzie on April 05, 2016, 03:43:04 pm
Apparently it won't do anything in PHP 7 (http://php.net/manual/en/function.preg-replace.php) anymore. But until then it'll just work.

Anyway, to fix it just do what it says? :P

	$data = preg_replace_callback('~<\!\[CDATA\[(.+?)\]\]>~eu', '\'#cdata_escape_encode#\' . Util::htmlspecialchars(\'$1\')', function($matches){return $matches[0];}, $data);

(or something like that)
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on April 05, 2016, 05:00:59 pm
I think it's more like:
Code: [Select]
	$data = preg_replace_callback('~<\!\[CDATA\[(.+?)\]\]>~u', function($matches){return '#cdata_escape_encode#' . Util::htmlspecialchars($matches[0]);}, $data);[/code]
Title: Re: A better Board News block for Simple Portal
Post by: Spuds on April 05, 2016, 05:07:24 pm
matches[0] or matches[1] ?
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on April 05, 2016, 05:08:13 pm
Thank you Emanuele and Frenzie!
With first code I was getting another error: preg_replace_callback() expects parameter 4 to be long, string given
The version provided by Emanuele works without errors. Thanks again ;)
Title: Re: A better Board News block for Simple Portal
Post by: Frenzie on April 06, 2016, 02:14:59 am
I failed to spot the first comma. xD
Title: Re: A better Board News block for Simple Portal
Post by: emanuele on April 06, 2016, 02:40:18 am
Quote from: radu81 – The version provided by Emanuele works without errors. Thanks again ;)
I feel you should trust Spuds and change $matches[0] to $matches[1], I'm not good with converting to callbacks! xD
Title: Re: A better Board News block for Simple Portal
Post by: Frenzie on April 06, 2016, 02:53:16 am
$matches[0] is probably the full text and $matches[1] the first subpattern. I'm not in a position to test atm.
Title: Re: A better Board News block for Simple Portal
Post by: Antechinus on April 06, 2016, 03:31:40 am
Quote from: emanuele –
Quote from: radu81 – The version provided by Emanuele works without errors. Thanks again ;)
I feel you should trust Spuds...
Sounds like a recipe for disaster. ;)
Title: Re: A better Board News block for Simple Portal
Post by: radu81 on April 06, 2016, 05:55:22 am
Quote from: emanuele – I feel you should trust Spuds and change $matches[0] to $matches[1], I'm not good with converting to callbacks! xD
Ok, I did that, thanks again