Ссылка на первоисточник Хак выводит похожие новости с картинками. Картинки берутся из полной новости, а у меня все картинки выведены через доп поле, как сделать чтобы они брались из доп поля?
Код |
---|
И так, для начала откройте файл "engine/modules/show.full.php". |
Код |
---|
Найдите сточку:
SELECT id, title, date, category, alt_name, flag FROMИ замените ее на:
SELECT id, title, date, category, alt_name, short_story, flag FROM
Далее найдите строку:
$buffer .= "<li><a href=\"" . $full_link . "\">" . stripslashes( $related['title'] ) . "</a></li>";Замените на:
preg_match('|<img(.*) src="([^"]*)"[^>]*>|is', $related['short_story'], $pts);
$thumba_parts = pathinfo($pts[2]);
if($pts[2]){
$pictitle = stripslashes( $related['title'] );
$pic = $thumba_parts['dirname'].'/'.$thumba_parts['basename'];
$wide = str_replace('thumbs/', "", $pic);
if(file_exists($wide)) $preview = "<a href=\"$wide\" onclick=\"return hs.expand(this)\"><img src=\"$pic\" width=\"70px\"; alt=\"$pictitle\" title=\"$pictitle\"></a>";
else $preview = "<img src=\"$pic\" width=\"70px\"; alt=\"$pictitle\" title=\"$pictitle\">";
}
else $preview = "<img style=\"border: medium none;\" src=\"{THEME}/images/nothumb.gif\" width=\"70px\" height=\"70px\">";
$related['short_story'] = preg_replace("/\[attachment=[[:digit:]]*\]/si","",stripslashes($related['short_story']));
$related['short_story'] = preg_replace("/<!--*-->/si","",$related['short_story']);
$related['short_story'] = strip_tags($related['short_story']);
if( strlen( $related['short_story'] ) > 106 ) $related['short_story'] = substr( $related['short_story'], 0,200 ) . " ...";
$iz++;
if($iz%1==0) {
$z_s = "<tr>";
$z_e = "";
} else {
$z_s = "";
$z_e = "</tr>";
}
$buffer .= $z_s.'<td><table width="95%" border="0" cellpadding="5" cellspacing="2" style="border-bottom: 1px dotted #8D8D8D;">
<tr>
<td width="100" height="100" align="center" valign="middle">'.$preview.'</td>
<td width="91%" valign="top" style="padding-left: 7px; padding-bottom: 7px;"><br><strong><a href="'.$full_link.'">'.stripslashes( $related['title']).'</a></strong><br>
'.stripslashes($related['short_story']).'</td>
</tr>
</table></td>'.$z_e; |