PHP Portal » PHP Forum » Entwicklung » Code-Schnipsel » Gekürzte Beiträge für Gäste in phpBB3

Gekürzte Beiträge für Gäste in phpBB3 

von
Neuling
Zitat
Version: phpBB 3.0.4
Template: prosilver

OPEN: viewtopic.php

FIND

PHP Code
1
2
3
4
5
6
// Highlight active words (primarily for search) if ($highlight_match) { $message = preg_replace('#(?!<.*)(?<!\w)(' . $highlight_match . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#is', '<span class="posthilit">\1</span>', $message); $row['post_subject'] = preg_replace('#(?!<.*)(?<!\w)(' . $highlight_match . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#is', '<span class="posthilit">\1</span>', $row['post_subject']); }


AFTER, ADD

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//Cutting text for guests $cuttettext = false; if ($user->data['user_id'] == ANONYMOUS) { if (strlen($message) > CUTTINGLENGTH) { $tmppos = 0; $pos = 0; $stoppchars = array(':','[','<'); foreach ($stoppchars as $char) { $tmppos = strpos($message, $char); if ($tmppos !== FALSE) { if ($pos == 0) { $pos = $tmppos; } else { $pos = ($pos > $tmppos)?$tmppos:$pos; } } } $pos = ($pos > CUTTINGLENGTH)?CUTTINGLENGTH:$pos; $message = substr($message, 0, $pos) . ' ...';
für die ungekürzte Fassung bitte einloggen


FIND

PHP Code
1
'S_IGNORE_POST' => ($row['hide_post']) ? true : false,


AFTER, ADD

PHP Code
1
'S_CUTTET_TEXT' => $cuttettext,


OPEN: language/de/common.php

FIND

PHP Code
1
?>


BEFORE, ADD

PHP Code
1
2
3
4
// Cutting text for guests $lang = array_merge($lang, array( 'REGISTER_TO_READ_MORE' => 'Registrieren, um mehr zu lesen' ));


OPEN: styles/prosilver/template/viewtopic_body.html

[FIND]

Code
1
<div class="content">{postrow.MESSAGE}</div>


INLINE, FIND

Code
1
.MESSAGE}


INLINE AFTER, ADD

Code
1
<!-- IF postrow.S_CUTTET_TEXT --><br /><br /><!-- IF S_REGISTER_ENABLED -->[<a href="{U_REGISTER}">{L_REGISTER_TO_READ_MORE}</a>]<!-- ENDIF --><!-- ENDIF -->


OPEN: includes/constants.php

FIND

PHP Code
1
?>


BEFORE, ADD

PHP Code
1
2
//Cutting text for guests define('CUTTINGLENGTH', 125);


Safe all files and refresh template cache.

Werbung

Schnellantwort