collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 659
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: limiting lines  (Read 3956 times)

0 Members and 1 Guest are viewing this topic.

Offline sevrva22

  • Semi Newbie
  • *
  • Posts: 19
    • MusiCommunity
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
limiting lines
« on: May 04, 2011, 11:11:43 PM »
Hi i want to know if there is a possibility to make a limit of one line per post on the recent posts.

Example

   Slash: At Guitar Center, Technique At Guitar Center, Fat Strings and Simple
 and Style    [M.C.TV]

with the limites lines:

        Slash: At Guitar Center, Technique At Guitar Cente....    [M.C.TV]

is there a way to do ito or putt a limit of characters?

Offline Eudemon

  • Jr. Member
  • **
  • Posts: 91
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: limiting lines
« Reply #1 on: May 05, 2011, 12:44:12 AM »
i think u have to set the limit of characters for that
it's hard to make it cutoff at first line because the width of the block, the font size etc is not always the same

↑also offer free SMF support and customization↑

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: limiting lines
« Reply #2 on: May 05, 2011, 07:09:02 AM »
The Recent Posts/Topics  does not show any of the the message body -- only the subject line.
Are you talking about a boardnews block?
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: limiting lines
« Reply #3 on: May 05, 2011, 10:44:19 AM »
Sources/PortalBlocks.php

Code: (Find) [Select]
if ($display == 'compact')
Code: (Replace) [Select]
foreach ($items as $key => $item)
$items[$key]['subject'] = shorten_subject($item['subject'], 25);

if ($display == 'compact')

Change 25 as the number of characters you want.
And slowly, you come to realize... It's all as it should be...

Offline sevrva22

  • Semi Newbie
  • *
  • Posts: 19
    • MusiCommunity
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: limiting lines
« Reply #4 on: May 05, 2011, 11:28:16 AM »
Exelent thank you very much  :D,

(I refer the recent posts)

Offline sevrva22

  • Semi Newbie
  • *
  • Posts: 19
    • MusiCommunity
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: limiting lines
« Reply #5 on: May 05, 2011, 03:43:56 PM »
How can i adapt it to this two blocks? (the recent post block worked perfectly)

Media Gallery block (customized)
Code: [Select]
if ($mod == 'aeva_media')
{
echo '
<img src="http://musicommunity.org/Themes/default/images/sp/mediaspicon.png">  <a href="', $galurl, 'sa=item;id=', $item['id'], '">', $item['title'], '</a>', $item['is_new'] ?'<img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '';
}

and top boards block (customized)

Code: [Select]
if (empty($boards))
{
echo '
', $txt['error_sp_no_boards_found'];
return;
}
else
$boards[count($boards) - 1]['is_last'] = true;

echo '
<ul class="sp_list">';

foreach ($boards as $board)
echo '
<li class="sp_list_top">', sp_embed_image('board'), ' ', $board['link'], '</li>';

echo '
</ul>';
}

Thanks!

Offline Eudemon

  • Jr. Member
  • **
  • Posts: 91
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: limiting lines
« Reply #6 on: May 05, 2011, 06:59:41 PM »
for aeva
Code: [Select]
if ($mod == 'aeva_media')
{
echo '
<img src="http://musicommunity.org/Themes/default/images/sp/mediaspicon.png">  <a href="', $galurl, 'sa=item;id=', $item['id'], '">', $item['title'], '</a>', $item['is_new'] ?'<img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '';
}

replace with
Code: [Select]
if ($mod == 'aeva_media')
{
$item['title'] = shorten_subject($item['title'], 25);
echo '               
<img src="http://musicommunity.org/Themes/default/images/sp/mediaspicon.png">  <a href="', $galurl, 'sa=item;id=', $item['id'], '">', $item['title'], '</a>', $item['is_new'] ?'<img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '';
}

tested on my own site, works

for top boards, find
Code: [Select]
foreach ($boards as $board)
echo '
<li class="sp_list_top">', sp_embed_image('board'), ' ', $board['link'], '</li>';

replace with
Code: [Select]
foreach ($boards as $board)
$board['link'] = shorten_subject($board['link'], 25);
echo '
<li class="sp_list_top">', sp_embed_image('board'), ' ', $board['link'], '</li>';

haven't test the second one, so make a backup first

again change the number 25 to the number of characters u want
« Last Edit: May 05, 2011, 07:07:22 PM by Eudemon »

↑also offer free SMF support and customization↑

Offline sevrva22

  • Semi Newbie
  • *
  • Posts: 19
    • MusiCommunity
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: limiting lines
« Reply #7 on: May 05, 2011, 07:54:05 PM »
Thank you vey much the aeva work perfectly, the boards one doesn´t but thanks for trying  :D

Offline Eudemon

  • Jr. Member
  • **
  • Posts: 91
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: limiting lines
« Reply #8 on: May 05, 2011, 07:59:18 PM »
the boards don't have the html makeup like aeva and recent topic/post
which is <a href="board url">board name</a>
so i guess those codes are located somewhere else

the team member like sinan or angelia probably would have a better answer

↑also offer free SMF support and customization↑

Offline sevrva22

  • Semi Newbie
  • *
  • Posts: 19
    • MusiCommunity
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: limiting lines
« Reply #9 on: May 05, 2011, 08:49:55 PM »
ok

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: limiting lines
« Reply #10 on: May 06, 2011, 09:09:07 AM »
In your second example, you'll have to go a bit further. Here's why.
Take a look at $board['link'].  It is not just a subject or title. It is the entire link. What goes into it? To find that out, I had to find out where it came from. It comes from ssi_topBoards, found in SSI.php. I see that ['link'] is made like this:
Code: [Select]
  $boards[] = array(
   'id' => $row['id_board'],
   'num_posts' => $row['num_posts'],
   'num_topics' => $row['num_topics'],
   'name' => $row['name'],
   'new' => empty($row['is_read']),
   'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
   'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'
  );

So I know I can use that information in the topBoards block. And I remember to use {} to surround a foreach block. http://www.w3schools.com/php/php_looping_for.asp
Code: [Select]
foreach ($boards as $board)
{
    $board['link'] =  '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . shorten_subject($row['name']) . '</a>';
    echo '
 <li class="sp_list_top">', sp_embed_image('board'), ' ', $board['link'], '</li>';
}


 
 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline Eudemon

  • Jr. Member
  • **
  • Posts: 91
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: limiting lines
« Reply #11 on: May 08, 2011, 10:54:37 AM »
oops i forgot to add {} you can see i have that in my first example
and the second one i knew it is coming from some where
but i just didnt know whete to look for
thx for the tips tho

↑also offer free SMF support and customization↑

Offline sevrva22

  • Semi Newbie
  • *
  • Posts: 19
    • MusiCommunity
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: limiting lines
« Reply #12 on: May 08, 2011, 11:40:08 PM »
Thanks for the help  :D

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: limiting lines
« Reply #13 on: May 10, 2011, 07:54:03 AM »
Glad to help. I've marked this solved.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?