Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

trimming news & articles to guests

Asked Modified Viewed 3,353 times
P
Pete_Hes
P
  • Junior Member, joined since
  • Contributed 14 posts on the community forums.
  • Started 4 threads in the forums
  • Started this discussions
asked
Junior Member

Hi

I am considering trimming the news stories and articles to unregistered guests.

Is that possible to do by modifying theme.php in render_news and render_article functions?

say 500 characters to guest, but if member logged in show full story or article?

Thanks :)
0 replies

4 posts

A
afaaro
A
afaaro 10
  • Senior Member, joined since
  • Contributed 295 posts on the community forums.
  • Started 68 threads in the forums
answered
Senior Member

I think you can do it this way

if(iGUEST){
echo trimlink(nl2br(striplashes($data['news_body'])), 500);
}elseif(iMEMBER){
echo nl2br(striplashes($data['news_body']));
}


try that way
Edited by PeaceLaced on 12-05-2014 13:43,
0 replies
P
Pete_Hes
P
  • Junior Member, joined since
  • Contributed 14 posts on the community forums.
  • Started 4 threads in the forums
  • Started this discussions
answered
Junior Member

Hi afaaro

I tried it but to no joy.
I am not sure if I inserted it in the wrong place

Where should it be placed in theme TLCB?
http://www.php-fusion.co.uk/infusions/addondb/view.php?addon_id=42

Thanks
0 replies
A
afaaro
A
afaaro 10
  • Senior Member, joined since
  • Contributed 295 posts on the community forums.
  • Started 68 threads in the forums
answered
Senior Member


function render_news($subject, $news, $info) {
   if(iGUEST){
      $text = substr($news,0,500).'...';
   }elseif(iMEMBER){
      $text = $news;
   }
   echo "<table cellpadding='0' cellspacing='0' style='width:100%;'>";
   echo "<tr>";
   echo "<td class='capmain-left'></td>\n";
   echo "<td class='capmain'>".$subject."</td>\n";
   echo "<td align='right' class='capmain-right'></td>\n";
   echo "</tr>\n";
   echo "</table>\n";
   echo "<table width='100%' cellpadding='0' cellspacing='0'>";
   echo "<tr>";
   echo "<td class='purple-left'></td>";
   echo "<td class='main-body middle-border'>".$text."</td>\n";
   echo "<td align='right' class='purple-right'></td>";
   echo "</tr>\n<tr>\n";
   echo "<td class='purple-left'></td>";
   echo "<td align='center' class='news-footer middle-border'>\n";
   echo newsposter($info," &middot;").newsopts($info,"&middot;").itemoptions("N",$info['news_id']);
   echo "</td>\n";
   echo "<td align='right' class='purple-right'></td>";
   echo "</tr>\n";
   echo "</table>\n";
   echo "<table cellspacing='0' cellpadding='0' style='width:100%;'>";
   echo "<tr>";
   echo "<td><img src='".THEME."images/purple-btm-left.png' alt='purple-btm-left.png' /></td>\n";
   echo "<td class='purple-btm' style='width:100%;'></td>\n";
   echo "<td align='right'><img src='".THEME."images/purple-btm-right.png' alt='purple-btm-right.png' /></td>\n";
   echo "</tr>\n";
   echo "</table>\n";
   echo "<div class='spacer'></div>\n";

}
0 replies
P
Pete_Hes
P
  • Junior Member, joined since
  • Contributed 14 posts on the community forums.
  • Started 4 threads in the forums
  • Started this discussions
answered
Junior Member

afaaro,

Thank you my friend :)
Absolutely Perfect

I tried the same with articles, but it did not work, could you help please?
.. and put a link in both news and article to register for more info as guests are limited to data??

Huge ask I know

Many Thanks
:G

Merged on May 15 2014 at 18:33:30:
Hi

Any assistance with the articles function would be great,
thanks
Edited by Pete_Hes on 15-05-2014 19:33,
0 replies

Category Forum

User Administration - 8

Labels

None yet

Statistics

  • Views 0 views
  • Posts 4 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

A
A
afaaro 10
  • Senior Member, joined since
  • Contributed 295 posts on the community forums.
  • Started 68 threads in the forums
P
P
  • Junior Member, joined since
  • Contributed 14 posts on the community forums.
  • Started 4 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet