#108456 by RobRoy: optional custom teaser lengths and much needed documentation on how node_teaser works

6.x
Gábor Hojtsy 2007-07-01 21:52:43 +00:00
parent a1a556b8c1
commit ef29077044
1 changed files with 15 additions and 2 deletions

View File

@ -204,10 +204,23 @@ function node_teaser_js(&$form, &$form_state) {
/** /**
* Automatically generate a teaser for a node body in a given format. * Automatically generate a teaser for a node body in a given format.
*
* @param $body
* The content for which a teaser will be generated.
* @param $format
* The format of the content. If the content contains PHP code, we do not
* split it up to prevent parse errors.
* @param $size
* The desired character length of the teaser. If omitted, the default
* value will be used.
* @return
* The generated teaser.
*/ */
function node_teaser($body, $format = NULL) { function node_teaser($body, $format = NULL, $size = NULL) {
if (!isset($size)) {
$size = variable_get('teaser_length', 600); $size = variable_get('teaser_length', 600);
}
// Find where the delimiter is in the body // Find where the delimiter is in the body
$delimiter = strpos($body, '<!--break-->'); $delimiter = strpos($body, '<!--break-->');