Dle — Авто вывод файлообменников (инфоблок)
16 августа 2010
Открываем engine\modules\show.full.php

находим
1 | $tpl->set( '{full-story}', stripslashes( "<div id=\"news-id-" . $row['id'] . "\" style=\"display:inline;\">" . $row['full_story'] . "</div>" ) ); |
ниже пишем
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
preg_match_all("#http:\/\/([\S][^\/]*)/#is",$row['full_story'], $matches);
$allhosttt = array();
foreach ($matches[1] as $key=>$hosttt) {
if (stristr($hosttt,"2shared")) {
$allhosttt[1] = "<div align=\"right\"><img src=\"/uploads/2shared.gif\" /></div>";
} elseif (stristr($hosttt,"badongo")) {
$allhosttt[2] = "<div align=\"right\"><img src=\"/uploads/badongo.gif\" /></div>";
} elseif (stristr($hosttt,"depositfiles")) {
$allhosttt[3] = "<div align=\"right\"><img src=\"/uploads/depositfiles.gif\" /></div>";
} elseif (stristr($hosttt,"divshare")) {
$allhosttt[4] = "<div align=\"right\"><img src=\"/uploads/divshare.gif\" /></div>";
} elseif (stristr($hosttt,"f-forge")) {
$allhosttt[5] = "<div align=\"right\"><img src=\"/uploads/f-forge.gif\" /></div>";
} elseif (stristr($hosttt,"filefactory")) {
$allhosttt[6] = "<div align=\"right\"><img src=\"/uploads/filefactory.gif\" /></div>";
} elseif (stristr($hosttt,"filefront")) {
$allhosttt[7] = "<div align=\"right\"><img src=\"/uploads/filefront.gif\" /></div>";
} elseif (stristr($hosttt,"fileho")) {
$allhosttt[8] = "<div align=\"right\"><img src=\"/uploads/fileho.gif\" /></div>";
} elseif (stristr($hosttt,"gigasize")) {
$allhosttt[9] = "<div align=\"right\"><img src=\"/uploads/gigasize.gif\" /></div>";
} elseif (stristr($hosttt,"megaupload")) {
$allhosttt[10] = "<div align=\"right\"><img src=\"/uploads/megaupload.gif\" /></div>";
} elseif (stristr($hosttt,"rapidshare")) {
$allhosttt[11] = "<div align=\"right\"><img src=\"/uploads/rapidshare.gif\" /></div>";
} elseif (stristr($hosttt,"sendspace")) {
$allhosttt[12] = "<div align=\"right\"><img src=\"/uploads/sendspace.gif\" /></div>";
} elseif (stristr($hosttt,"storeandserve")) {
$allhosttt[13] = "<div align=\"right\"><img src=\"/uploads/storeandserve.gif\" /></div>";
} elseif (stristr($hosttt,"uploading")) {
$allhosttt[14] = "<div align=\"right\"><img src=\"/uploads/uploading.gif\" /></div>";
} elseif (stristr($hosttt,"zshare")) {
$allhosttt[15] = "<div align=\"right\"><img src=\"/uploads/zshare.gif\" /></div>";
} else {
//$allhosttt[16] = "<div align=\"right\"><img src=\"/uploads/Other.gif\" /></div>";
};
}
$allhosttt_txt='';
foreach ($allhosttt as $key=>$value) {
$allhosttt_txt .= $value;
}
$tpl->set('{whereis}',$allhosttt_txt); |
и в щаблоне полной новости пишем
{whereis}
в месте где будут отображаться те файл обменники , из которых предлагается скачать в статье
А для короткой новости в файле show.short.php
1 2 3 4 5 6 7 8 | находим $sql_result = $db->query( $sql_select ); и выше пишем $sql_select = str_replace( 'short_story,', 'short_story, full_story as full_story2,', $sql_select); а для верхнего меняем preg_match_all("#http:\/\/([\S][^\/]*)/#is",$row['full_story'], $matches); на preg_match_all("#http:\/\/([\S][^\/]*)/#is",$row['full_story2'], $matches); |
в shortstory.tpl пишем {whereis}
Скачать тут
http://teaseo.ru/_soft/dle-uploads-failoobmenniti_dle-85.rar
(вместе с кнопками)
(Измнеения выделены коментариями)
1 | /*DLE-uploads-failoobmenniti*/ |
ПС. объяснил галимо, но те кто что то понимает то исправит )