SimplePortal
Customization => Blocks and Modifications => Topic started by: ccbtimewiz on May 19, 2009, 05:17:22 PM
-
Performing this edit will allow you, on Simple Portal, to define where the article should stop showing and proceed with a <view more> link.
This will render the character count cut-off useless unless you forget to define a cut-off.
SP version 2.2.1
Open ./SPortal2.php
Find:
$all_link = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
}
Replace with:
$all_link = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
}
// If you find "" if the body, then process this...
if (preg_match('/\/i', $row['body']))
{
// First, count each character in the body, and then locate when occurs.
$cutoff = strrpos(un_htmlspecialchars($row['body']), '');
// Now, fix the article by only showing the text that was counted before occured.
$fixed_article = $smcFunc['substr']($row['body'], 0, $cutoff);
// And now, assign the article as the fixed article.
$row['body'] = $fixed_article;
// The "click here for more" link.
$row['body'] .= '...
<br /><a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">(view full article)</a>';
}
Open ./Sources/Subs-SPortal2.php
Find:
if ((SMF == 'SSI' && empty($context['standalone'])) || empty($context['template_layers']) || WIRELESS || $initialized)
return $tourniquet;
Replace with:
if ((SMF == 'SSI' && empty($context['standalone'])) || empty($context['template_layers']) || WIRELESS || $initialized)
return $tourniquet;
$tourniquet = str_replace('', '', $tourniquet);
After doing these edits, you can define, in a post, the tag: . If said post is an article, the article will stop showing and proceed with a "view more" link where to define said tag.
will appear invisible to users-- so you can define it without worry.
-
Moved to the Blocks and Modifications board.
Looks good. :)
-
Is it possible to implant this into SMF 1.1.9 as i have no SPortal2.php but i have SPortal1-1.php
-
Never tried it, but it should work if it has a similar code structure.
-
Why not just upgrade to a newer Simpleportal?
-
Why not just upgrade to a newer Simpleportal?
Won't work, we dont want ( YET ) to update to SMF 2 rc1 - we dont like beta's and that kind of stuff ;)
And to above H, nope, it gives all kind of weird errors...
-
Simpleportal 2 will run on SMF 1.1.x :)
-
Simpleportal 2 will run on SMF 1.1.x :)
I Know but we dont have the SPortal2.php and Sub-Portal for that matter we have 1...
(http://lorddusk.netii.net/screenshots/2009-07-09_212929.png)
-
Konkaen, were you able to get my trick to work?
-
hello in SPortal2.php i cant fint the
$all_link = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
}
code. What is wrong here?
-
Attach the file please.
-
here it is.
-
This might do it;
Find:
if (!empty($modSettings['articlelength']) && $smcFunc['strlen']($row['body']) > $modSettings['articlelength'])
$row['body'] = parse_bbc(sp_truncateText($row['body']), $row['smileys_enabled'], $row['id_message']) . '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
else
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_message']);
Replace with:
if (!empty($modSettings['articlelength']) && $smcFunc['strlen']($row['body']) > $modSettings['articlelength'])
$row['body'] = parse_bbc(sp_truncateText($row['body']), $row['smileys_enabled'], $row['id_message']) . '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
else
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_message']);
// If you find "" if the body, then process this...
if (preg_match('/\/i', $row['body']))
{
// First, count each character in the body, and then locate when occurs.
$cutoff = strrpos(un_htmlspecialchars($row['body']), '');
// Now, fix the article by only showing the text that was counted before occured.
$fixed_article = $smcFunc['substr']($row['body'], 0, $cutoff);
// And now, assign the article as the fixed article.
$row['body'] = $fixed_article;
// The "click here for more" link.
$row['body'] .= '...
<br /><a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">(view full article)</a>';
}
-
thanks for your help, now it funtcioning. But there is a little problem now.
The place of cutoff is not the same place where i write the cutoff tag. The cut place is 14-15 characters longer.
-
I'll have to look into it as the new SP version apparently broke the cutoff code.
I'll get back to you. :)
-
hey i was wondering if there is any news on getting the working again as no matter how long i let the article length be without it been ridiculously long it seems to cut off the article part way through a word or through a sentence.
thanks
Robin
-
hey i was wondering if there is any news on getting the working again as no matter how long i let the article length be without it been ridiculously long it seems to cut off the article part way through a word or through a sentence.
thanks
Robin
I agree... this is a huge function that should be incoporated in SP. :nervous-happy:
-
I can't find SPortal.php in /Sources :(
I have only Subs-Portal.php, this is it?