вопрос
Написал доработку модуля Биография актеров для вывода фото актеров. Вроде все работает на DLE 10.2.
Писал под свои нужды. Модуль брал в паблике. Поправьте плиз код если где есть ошибки или недочеты.
Данный файл подключаю к showshort.php и showfull.php.
Писал под свои нужды. Модуль брал в паблике. Поправьте плиз код если где есть ошибки или недочеты.
Данный файл подключаю к showshort.php и showfull.php.
<?php
if( ! defined( 'DATALIFEENGINE' ) ) {
die( "Hacking attempt!" );
}
include ('engine/api/api.class.php');
$news_id = intval( $_REQUEST['newsid'] );
if ($actors_config['n_links'] == "yes")
foreach ($actors as $alt_name => $name) {
if (strpos($row['full_story'], $name) != FALSE){
if( $config['allow_alt_url'] == 1 ) {
$link_b = $config['http_home_url'] . "biography/" . $alt_name . "/";
$link_a = $config['http_home_url'] . "biography/" . $alt_name . "/";
} else {
$link_b = $config['http_home_url'] . "index.php?do=actors&action=biography&a_name=". $alt_name;
$link_a = $config['http_home_url'] . "index.php?do=actors&action=select&a_name=". $alt_name;
}
$row['full_story'] = str_replace($name, "<a onclick=\"return dropdownmenu(this, event, ActorsMenu('" . $link_b . "', '" . $link_a . "', 'Биография', 'Все фильмы'), '170px')\" href=\"#\">{$name}</a>", $row['full_story']);
}
}
if ($row['actors']){
$actors_cash = $dle_api->load_from_cache( 'actors_cash'.$news_id );
foreach (unserialize($row['actors']) as $alt_name => $name){
if ($actors_cash == ""){
$actors_pi = $db->super_query("SELECT foto FROM " . PREFIX . "_actors WHERE name = '$name' ");
$actor_cash[] = implode(",", $actors_pi);
$dle_api->save_to_cache ('actors_cash'.$news_id, $actor_cash);
$actors_array[] = implode(",", $actors_pi);
$actors_pi = $actors_array;
}else{
$actors_pi = unserialize($actors_cash);
}
if( $name ) {
if( $config['allow_alt_url'] == 1 ) {
$link_b = $config['http_home_url'] . "biography/" . $alt_name . "/";
$link_a = $config['http_home_url'] . "biography/" . $alt_name . "/";
} else {
$link_b = $config['http_home_url'] . "index.php?do=actors&action=biography&a_name=". $actors[$element]['alt_name'];
$link_a = $config['http_home_url'] . "index.php?do=actors&action=select&a_name=". $actors[$element]['alt_name'];
}
$actors_link[] = "<a href=\"{$link_b}\">{$name}</a>";
} else {
$db->query( "INSERT INTO " . PREFIX . "_actors (name, alt_name, birthday) VALUES('$name', '$alt_name','0000-00-00')" );
$actors_link[] = "<a href=\"{$link_b}\">{$name}</a>";
@unlink( ENGINE_DIR . '/cache/system/actors.php' );
clear_cache();
}
}
$actors_plus = array_combine($actors_link , $actors_pi);
foreach ($actors_plus as $key => $value) {
$img_src = $config['http_home_url'] . "uploads/" . "actors/" . "posters/";
$img_src2 = substr($key,0,strpos($key,'>')+1);
if ($value == ""){
$value = "no_foto.jpg";
$value = $img_src2 . "<img src=$img_src$value>" . "</a>";
} else {
$value = $img_src2 . "<img src=$img_src$value>" . "</a>";
}
$actors_link2[] = "<li>" . $value . $key . "</li>";
$actors_link3[] = "<li>" . $key . "</li>";
}
//$actors_link2 = implode($actors_link2);
//$actors_link2 = "helo";
if ($dle_module == "showfull") {
$actors_link2 = implode($actors_link2);
} else {
$actors_link = array();
foreach (unserialize($row['actors']) as $alt_name => $name_a){
if( $name ) {
if( $config['allow_alt_url'] == "yes" ) {
$link_b = $config['http_home_url'] . "biography/" . $alt_name . "/";
$link_a = $config['http_home_url'] . "films/" . $alt_name . "/";
} else {
$link_b = $config['http_home_url'] . "index.php?do=actors&action=biography&a_name=". $actors[$element]['alt_name'];
$link_a = $config['http_home_url'] . "index.php?do=actors&action=select&a_name=". $actors[$element]['alt_name'];
}
if ($alt_name == $a_name) $name = "<b>{$name_a}</b>"; else $name = $name_a;
if ($actors[$alt_name] != '')
$actors_link[] = "<li><a href=\"{$link_b}\">{$name}</a></li>";
else
$actors_link[] = "<li><a href=\"{$link_b}\">{$name}</a></li>";
}
}
$actors_link2 = implode($actors_link);
}
$tpl->set('{actors}', "<ul>" . $actors_link2 . "</ul");
}else{
//$actors_link2 = print_r($row['title']);
$tpl->set('{actors}', "<ul>" . $actors_link2 . "</ul");
}
?>