xoops forums

Brandon

Just popping in
Posted on: 2002/7/4 1:38
Brandon
Brandon (Show more)
Just popping in
Posts: 2
Since: 2002/7/4 1
#1

Extending the Titles of Submitted News

Hi,

The submitted news titles are being cut off by a default character limit or something and I need to edit this to display a larger length. For an example:
Recent News: Thanks for Visiti......

I need this to to display up to say 35 characters
Any help would be great..Thanks

smib

Just popping in
Posted on: 2002/7/4 6:42
smib
smib (Show more)
Just popping in
Posts: 7
Since: 2002/5/1 6
#2

Re: Extending the Titles of Submitted News

Is this for the recent news block? Because I know there is a fix for it. I did this fix to my block as well. Let me find it.

Ok found it... Click Here!
Posted on: 2002/7/4 15:06
goghs
goghs (Show more)
Posts: 8
Since: 2001/12/13
#3

Re: Extending the Titles of Submitted News

Yes you can change the character limit to larger, but please ba careful because this change may make the display messy esp when you use two column blocks. The default setting is 18 characters. For Recent News and Top Read News block, you can change like this:

open modules/news/blocks/news_top.php, within function b_news_top_show() (should be line 35-37):
change
if (strlen($title) >= 19) {
$title = substr($title,0,18)."...";
}

to
if (strlen($title) > 35 ) {
$title = substr($title,0,35)."...";
}

this way it displays 35 characters.

For other blocks, you can look into all files under blocks/ dir of the module, and change as you like. You should test to find the best character limit and it should be dependant on your theme. If you dont allow theme change, and use only one theme and the best the theme has fixed width, you can get the best result.

Try it, and be cautious.

BTW, you should know the max length of the subject is 80 characters. If you need change to longer, you can do , but the ultimate limit is 255 characters. The best you dont change, or seek help before doing.

Brandon

Just popping in
Posted on: 2002/7/4 18:31
Brandon
Brandon (Show more)
Just popping in
Posts: 2
Since: 2002/7/4 1
#4

Re: Extending the Titles of Submitted News

Thanks for all the help guys, I appreciate it much.

elo

Just popping in
Posted on: 2002/9/13 18:46
elo
elo (Show more)
Just popping in
Posts: 1
Since: 2002/9/7 2
#5

Re: Extending the Titles of Submitted News

Thanks for this tip!

Another question. Can you display this block by itself without the news and contents listed below?
Thanks

marook

Friend of XOOPS
Posted on: 2002/11/30 2:47
marook
marook (Show more)
Friend of XOOPS
Posts: 89
Since: 2002/9/9 1
#6

Re: Extending the Titles of Submitted News

This might go to Feature Requests:

I think this should be moved to a function xoops_substr() that has a default pref in the admin section, and then all bloks that use it should have a way to overwrite the default lenght. We should not be forced to edit php scripts to change this!!!

thanhhai

Just popping in
Posted on: 2002/12/5 8:20
thanhhai
thanhhai (Show more)
Just popping in
Posts: 1
Since: 2002/11/30
#7

Re: Extending the Titles of Submitted News

I found these lines in news_top.php:

if ( strlen($title) > $options[2] ) {
$title = substr($title, 0, $options[2])."..";
}

Where $options[2] value is stored, so that I can modify it? Thanks.

Yero

Just popping in
Posted on: 2003/1/1 21:28
Yero
Yero (Show more)
Just popping in
Posts: 24
Since: 2002/10/1
#8

Re: Extending the Titles of Submitted News

Semi offtopic:
Is it also possible to show more informatie in the recent news lines? Such as author and category?

See:
https://xoops.org/modules/newbb/viewto ... pic_id=5315&forum=7jump=1

I tried to edit function b_news_top_show() but nothing works. Do I first have to call things from the database?

Anonymous

Posted on: 2004/5/19 1:06
Anonymous
Anonymous (Show more)
Posts: 0
Since:
#9

Re: Extending the Titles of Submitted News

i like the XOOPS

wf4sure

Friend of XOOPS
Posted on: 2004/5/27 21:05
wf4sure
wf4sure (Show more)
Friend of XOOPS
Posts: 29
Since: 2004/2/12
#10

Re: Extending the Titles of Submitted News

Since this topic is "sticky", does anyone know the current answer? When I open new_top.php, I'm seeing the same things as thannhhai.