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

limit the text in blogs index | Forum

Ron Scott
Ron Scott Mar 27 '13
When a member goes to the blogs they get a very long page of full blogs,
is there a way to limit the blogs main page to only show a list of the blogs with a very short few lines of the blog?
The only info I've found in the forums didn't work.
Testers code fix applied a "more" button but didn't limit the amount of text,
the full blog shows with a "more" button at the bottom.
The Forum post is edited by Ron Scott Mar 27 '13
Attachments:
  User blogs now.png (253.2Kb)
  User blogs wanted.png (239.58Kb)
Alia Team
Alia Mar 28 '13
Ron it is possible. Requires custom code modification within the .php code.
Unfortunately I am not a developer myself and can't give exact instructions.
Ron Scott
Ron Scott Mar 29 '13
I've managed to hide all the text (as shown in pic)
but am trying to figure out how to let it show a couple of lines of the blog.
The code I edited is in blog.php in my file line #137
take this code
$text = explode("<!--more-->", $dto->getPost());
and change to,
$text = implode("<!--more-->", $dto->getPost());


I'd like to show a couple of lines of the blog though,
any ideas out there?
I'm no coder, just got lucky with that one.
Thanks for any input
Attachments:
  User blogs.png (260.97Kb)
Ron Scott
Ron Scott Mar 30 '13
I seem to have nailed it,,,

ed claassen
ed claassen Mar 30 '13
and how did you do that?
Ron Scott
Ron Scott Mar 30 '13
In /ow_plugins/blogs/controllers/blog.php look for this code, line 135 in my file.

$text = explode("<!--more-->", $dto->getPost());
Change it to:

$text = explode("<!--more-->", UTIL_String::truncate( strip_tags($dto->getpost()), 200, "<!--more-->" )  );

Change the 200 to however long or short you want the description.
No idea if this is right or wrong way to do it but it works.
ed claassen
ed claassen Mar 31 '13
works for me too thanks
Ron Scott
Ron Scott Mar 31 '13
Glad to help, and now I'd like to do the same with the newsfeed, to limit
long posts,
ANY help as to where to start would be great!!!
hint hint,,,please?
Mohammad
Mohammad Apr 2 '13
Thanks Ron


Ron Scott
Ron Scott Apr 2 '13
You're welcome, glad to help
Xavi
Xavi Apr 6 '13
Good job,Ron,it works for me also,thanks.

Have you solved the problem with newsfeed?

It will be  a very very big problem if some guys post long texts in newsfeed ,unfortunately, it seems that the official haven't noticed the severity of this problem yet.

The Forum post is edited by Xavi Apr 6 '13
DavidZenry
DavidZenry Apr 6 '13
It would be useful to organise Blogs by poster too. Something like a block in sidebar block with a list of latest posts and top bloggers.

Ron Scott
Ron Scott Apr 6 '13
As I mentioned earlier I'm no coder or programmer, learning maybe, lol.
I haven't worked on it much yet but it's a different ballgame altogether than the blogs,
so far no luck at all. Any suggestions would be cool.
Saif
Saif Apr 7 '13
Thanks Ron .. It worked for me :)
Tester
Tester Apr 11 '13
Ron Scott
Happy to see this more than anone for obvious reasons.
Next question is whether it will brave updatings. My code didn't.
I updated the script to 1.5.2; the blog script too was updated.
Now let me test your version. :) Regards.
Ron Scott
Ron Scott Apr 11 '13
I've just upgraded to 1.5.2 and, no, the change is lost.
Mind you I didn't think it would survive.
the same code change still works for the updated version so just redo the change,
after you upgrade the platform and blog plugin.
in my file (/ow_plugins/blogs/controllers/blog.php)  it is now on line #267.
Find:
$text = explode("<!--more-->", $dto->getPost());

Change it to:
$text = explode("<!--more-->", UTIL_String::truncate( strip_tags($dto->getpost()), 200, "<!--more-->" )  );
DavidZenry
DavidZenry Apr 15 '13
How annoying, I don't see why since there doesn't seem to be any actually changes to Blogs in the 1.5.2 era update! They could have included <b>this!</b> *rolls eyes*

It's a good idea to keep a log/file of your mods/changes in the plugins folder with a backup of the old version so you can easily overcome update mess.
Comedian
Comedian Nov 14 '13

Quote from Ron Scott I've just upgraded to 1.5.2 and, no, the change is lost.
Mind you I didn't think it would survive.
the same code change still works for the updated version so just redo the change,
after you upgrade the platform and blog plugin.
in my file (/ow_plugins/blogs/controllers/blog.php)  it is now on line #267.
Find:
$text = explode("<!--more-->", $dto->getPost());

Change it to:
$text = explode("<!--more-->", UTIL_String::truncate( strip_tags($dto->getpost()), 200, "<!--more-->" )  );


Works like a charm, thanks!... but only shows Title and text
Do you know how can I keep showing the ilustrative image on each post? Additionally, how can I enlarge the font of the titles for each post?
Thank you!
Jozko
Jozko Mar 17 '14
Ron, I used your blog code for 1.6 oxwall site. It shorts the preview, but there is no button "more" .  Thx in advance.
Peter
Peter Apr 1 '14
Thanks Ron, your solution helped me a lot!
Pages: 1 2 »