Tricked Out News

Welcome to TON. This site is dedicated to development of addons for the RavenNuke™ CMS
Follow Us:
Tricked Out Mods: Forums

 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Character limit and Title link mods
 
 
Post new topic   Reply to topic   print    Tricked Out News Forum Index -> Tricked Out News
View previous topic :: View next topic  
Author Message
snype
Regular
Regular


Joined: Apr 20, 2010
Posts: 11

Reputation: 1

PostPosted: Tue May 04, 2010 7:15 am 
Post subject: Character limit and Title link mods
Reply with quote

Hello i have a couple of questions and wondered if you could help me out with this.

#1. Is there a way to make it so the news that is posted only show x amounts of the post before the user has to click read more, when i post it posts the whole article and i would sooner it post half of that.

#2. Is there a way to make the title of the news article link to it so a user could click the read more or the title?

Thanks in advance and you have done a magnificent job on this module nuken
  
Back to top
View user's profile Send private message
bobby
Site Admin
Site Admin


Joined: Jan 20, 2009
Posts: 600
Location: North Carolina
Reputation: 543Reputation: 543Reputation: 543
votes: 4

PostPosted: Tue May 04, 2010 8:46 am 
Post subject:
Reply with quote

Thank you for the props... Very Happy

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
View user's profile Send private message
bobby
Site Admin
Site Admin


Joined: Jan 20, 2009
Posts: 600
Location: North Carolina
Reputation: 543Reputation: 543Reputation: 543
votes: 4

PostPosted: Tue May 04, 2010 9:46 am 
Post subject:
Reply with quote

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&amp;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
View user's profile Send private message
snype
Regular
Regular


Joined: Apr 20, 2010
Posts: 11

Reputation: 1

PostPosted: Tue May 04, 2010 10:20 am 
Post subject:
Reply with quote

Wow thats a very quick response all works except the read more link its not linking to anything cant even be clicked, i am runing the latest RN and using simple_blue theme http://phpnuke-install.com

EDIT
It works on some of the news links just not the top one
  
Back to top
View user's profile Send private message
bobby
Site Admin
Site Admin


Joined: Jan 20, 2009
Posts: 600
Location: North Carolina
Reputation: 543Reputation: 543Reputation: 543
votes: 4

PostPosted: Tue May 04, 2010 10:32 am 
Post subject:
Reply with quote

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&amp;sid=' . $sid . '">';


after that add
Code:
$charlimit = 150;

if (strlen($hometext) <= $charlimit)
{
               $hometext = $hometext;
}else{
               $hometext = substr($hometext, 0, strrpos(substr($hometext, 0, $charlimit), ' ')) . '&nbsp;&nbsp;'.$story_link.'' . _READMORE . '</a>';
}


I called story_link before it was set....
_________________
Tricked Out News
  
Back to top
View user's profile Send private message
snype
Regular
Regular


Joined: Apr 20, 2010
Posts: 11

Reputation: 1

PostPosted: Tue May 04, 2010 10:39 am 
Post subject:
Reply with quote

Spot on m8 thanks for the help truly an amazing service you offer

Snype
  
Back to top
View user's profile Send private message
bobby
Site Admin
Site Admin


Joined: Jan 20, 2009
Posts: 600
Location: North Carolina
Reputation: 543Reputation: 543Reputation: 543
votes: 4

PostPosted: Tue May 04, 2010 6:20 pm 
Post subject:
Reply with quote

I came up with a simple title link mod too.

after
Code:
$story_link = '<a href="news.html?amp;file=article&amp;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
Code:
title="'.$title.'"

_________________
Tricked Out News
  
Back to top
View user's profile Send private message
snype
Regular
Regular


Joined: Apr 20, 2010
Posts: 11

Reputation: 1

PostPosted: Sat May 08, 2010 7:49 am 
Post subject:
Reply with quote

That worked a treat thanks again nuken
  
Back to top
View user's profile Send private message
kguske
Blingaholic
Blingaholic


Joined: May 19, 2009
Posts: 24

Reputation: 400.2Reputation: 400.2
votes: 1

PostPosted: Sun Sep 12, 2010 10:11 pm 
Post subject:
Reply with quote

I added some configuration settings and associated logic to enable the ability to configure:
* Link to story on title on index page
* View PDF
* Allow, display ratings
* Allow, display Send to Friend

I also added the HTML compliance fix for the Google link on social bookmarks.
  
Back to top
View user's profile Send private message
bobby
Site Admin
Site Admin


Joined: Jan 20, 2009
Posts: 600
Location: North Carolina
Reputation: 543Reputation: 543Reputation: 543
votes: 4

PostPosted: Mon Sep 13, 2010 6:06 am 
Post subject:
Reply with quote

Thank you.
_________________
Tricked Out News
  
Back to top
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic   print    Tricked Out News Forum Index -> Tricked Out News All times are GMT - 5 Hours
 
 Page 1 of 1

 

Jump to:   
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001-2008 phpBB Group
Forums ©