Академический Документы
Профессиональный Документы
Культура Документы
In node-type.tpl.php replace
<h2 class="title">
<a href="<?php print $node_url; ?>" title="<?php print $title ?>">
<?php print $title; ?>
</a>
</h2>
WITH
<h2 class="title">
<a href="<?php print $node_url; ?>" title="<?php print $title ?>">
<?php
if(($teaser) && ($is_front) ){ //teaser of front page only
$l_title = strlen($title);
$title_len = 12;//change this value to change the lenght of
the node title to display
if($l_title > $title_len){
$title_show = substr($title, 0, $title_len);
$is_space_t = substr($body_show, -1, 1);
if($is_space_t == " "){//if last character is space,
omit it
$title_show = substr($body_show, 0,$title_len-
1);
}
print $title_show;
print "...";
}
else {
print $title;
}
}
else {
print $title;
}
?>
</a>
</h2>
FOR NODE TEASER of custom content type
-This works on Drupal 6 and will work on Drupal 5 as well. (www.geshan.com.np)
In node-type.tpl.php (type is your node type like page or story) replace
<div class="content">
<?php print $content; ?>
</div>
WITH
<div class="content">
<?php if( ($teaser) && ($is_front) ){
preg_match('/(<p>.*<\/p>)/Usi',$content, $matches); //does
the magic as body is always in <p> </p>
$body= $matches[1];
$len_of_body = strlen($body);
print $content;
}
else {
//for teaser not for front page and full node
print $content;
}
?>
</div>