| View previous topic :: View next topic |
| Author |
Message |
snype Regular


Joined: Apr 20, 2010 Posts: 11
 
|
|
| Back to top |
|
 |
bobby Site Admin


Joined: Jan 20, 2009 Posts: 600 Location: North Carolina
    votes: 4
|
Posted: Tue May 04, 2010 8:46 am Post subject: |
|
|
Thank you for the props...
1) There are several ways to do this. for example, in News/index.php around line 146 to 164 find
Code:while ($row = $db->sql_fetchrow($result)) {
$topicname = $row['topicname'];
$topicimage = $row['topicimage'];
$topictext = stripslashes(check_html($row['topictext'], 'nohtml'));
$sid = intval($row['ssid']);
$catid = intval($row['catid']);
$aid = stripslashes($row['aid']);
$title = stripslashes(check_html($row['title'], 'nohtml'));
$time = $row['time'];
$hometext = stripslashes($row['hometext']);
$bodytext = stripslashes($row['bodytext']);
$comments = stripslashes($row['comments']);
$counter = intval($row['counter']);
$topic = intval($row['topic']);
$informant = stripslashes($row['informant']);
$notes = stripslashes($row['notes']);
$acomm = intval($row['acomm']);
$score = intval($row['score']);
$ratings = intval($row['ratings']);
|
and add Code:$hometext = substr($hometext, 0, 150);
|
where 150 is the limit of characters displayed. You would probably want a few more bells and whistles but that is a simple way to do it.
2) It depends on the theme.
here is a how to I did a few years ago
News Title Link_________________ Tricked Out News |
|
| Back to top |
|
 |
bobby Site Admin


Joined: Jan 20, 2009 Posts: 600 Location: North Carolina
    votes: 4
|
Posted: Tue May 04, 2010 9:46 am Post subject: |
|
|
Here is a very cool way to limit characters and add a read more link after the text....
In modules/News/index.php find on around line 175
Code:$story_link = '<a href="news.html?amp;file=article&sid=' . $sid . '">';
|
after add
Code:$charlimit = 150;
if (strlen($hometext) <= $charlimit)
{
$hometext = $hometext;
}else{
$hometext = substr($hometext, 0, strrpos(substr($hometext, 0, $charlimit), ' ')) . ' '.$story_link.'' . _READMORE . '</a></p>';
}
|
charlimit can be set to however many characters you want to display. Spaces, line breaks and paragraphs count for different numbers of characters, I believe paragraphs count for 3 characters.
Edited correct location. _________________ Tricked Out News
Last edited by bobby on Thu May 27, 2010 7:08 am; edited 2 times in total |
|
| Back to top |
|
 |
snype Regular


Joined: Apr 20, 2010 Posts: 11
 
|
|
| Back to top |
|
 |
bobby Site Admin


Joined: Jan 20, 2009 Posts: 600 Location: North Carolina
    votes: 4
|
Posted: Tue May 04, 2010 10:32 am Post subject: |
|
|
I put the wrong place to put the code, sorry.
a few lines down from find Code:$story_link = '<a href="news.html?amp;file=article&sid=' . $sid . '">';
|
after that add
Code:$charlimit = 150;
if (strlen($hometext) <= $charlimit)
{
$hometext = $hometext;
}else{
$hometext = substr($hometext, 0, strrpos(substr($hometext, 0, $charlimit), ' ')) . ' '.$story_link.'' . _READMORE . '</a>';
}
|
I called story_link before it was set.... _________________ Tricked Out News |
|
| Back to top |
|
 |
snype Regular


Joined: Apr 20, 2010 Posts: 11
 
|
|
| Back to top |
|
 |
bobby Site Admin


Joined: Jan 20, 2009 Posts: 600 Location: North Carolina
    votes: 4
|
Posted: Tue May 04, 2010 6:20 pm Post subject: |
|
|
I came up with a simple title link mod too.
after
Code:$story_link = '<a href="news.html?amp;file=article&sid=' . $sid . '">';
|
add
Code:$title= ''.$story_link.''.$title.'</a>';
|
It seems to work with most themes although I did not test them all.
If you use this with the Tricked Out News mod, you will need to make 2 changes.
in modules/News/index.php around line 191 and 220 find:
Code: line 191 if ($fullcount > 0) {
$bottomlink = '<a title="'.$title.'" class="colorbox3
line 220 $toplink .= '<a title="'.$title.'" class="colorbox3
|
and remove
_________________ Tricked Out News |
|
| Back to top |
|
 |
snype Regular


Joined: Apr 20, 2010 Posts: 11
 
|
|
| Back to top |
|
 |
kguske Blingaholic


Joined: May 19, 2009 Posts: 24
   votes: 1
|
|
| Back to top |
|
 |
bobby Site Admin


Joined: Jan 20, 2009 Posts: 600 Location: North Carolina
    votes: 4
|
|
| Back to top |
|
 |
|
|