[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: необходим вывод изображения
permstyle
необходимо сделать вывод и в первом модуле.

код модуля, где нужно сделать вывод фото:

<?php if ($news) { ?>
<div class="box">
<
div class="box-heading"><?php echo $heading_title; ?></div>
<
div class="box-content">
<?php foreach ($news as $news_story) { ?>
<div class="box-news">
<
h1><?php echo $news_info['title']; ?></h1>
<!--<
b><?php echo $news_story['date_added']; ?></b>: -->
<
h3><?php echo $news_story['title']; ?></h3>
<?php echo $news_story['description']; ?></p>
<
div><a href="<?php echo $news_story['href']; ?>"><?php echo $text_read_more; ?></a><br><br></div>
</
div>
<?php } ?>
</div>
</
div>
<?php } ?>



код отображения полной новости с фото:

<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
<div class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<?php
echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
<?php } ?>
</div>

<?php if (isset($news_info)) { ?>
<div class="news" <?php if ($image) { echo 'style="min-height: ' . $min_height . 'px;"'; } ?>>
<?php if ($image) { ?>
<a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="fancybox"><img align="left" style="border: none; margin-left: 10px; padding: 10px; " src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
<?php } ?>
<?php
echo $description; ?>
</div>
<
div class="buttons">
<
div class="right"><a onclick="location='<?php echo $news; ?>'" class="button"><span><?php echo $button_news; ?></span></a></div>
</
div>
<?php } elseif (isset($news_data)) { ?>
<?php
foreach ($news_data as $news) { ?>
<div class="content">
<
h3 style="margin-top: 5px;"><?php echo $news['title']; ?></h3>
<?php echo $news['description']; ?></p>
<
p><b><?php echo $news['date_added']; ?></b> <a href="<?php echo $news['href']; ?>"><?php echo $text_read_more; ?></a></p>
</
div>
<?php } ?>
<?php
} ?>
<?php
echo $content_bottom; ?>
</div>
<?php echo $footer; ?>



задача добавить вывод фото и в модуле.
самостоятельно не получается сделать. может кто подскажет?



Спустя 26 минут, 14 секунд (1.08.2012 - 09:49) DarkLynx написал(а):

var_dump($image);

и что вывело
а вот этот код отвечает за вывод картинки

<?php if ($image) { ?>
<a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="fancybox"><img align="left" style="border: none; margin-left: 10px; padding: 10px; " src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
<?php } ?>

Спустя 37 минут, 19 секунд (1.08.2012 - 10:26) permstyle написал(а):
вывело мне NULL

Спустя 3 минуты, 5 секунд (1.08.2012 - 10:29) permstyle написал(а):
<?php
var_dump($image);
?>
<?php
if ($news) { ?>
<div class="box">
<
div class="box-heading"><?php echo $heading_title; ?></div>
<
div class="box-content">
<?php foreach ($news as $news_story) { ?>
<div class="box-news">
<
h1><?php echo $news_info['title']; ?></h1>
<!--<
b><?php echo $news_story['date_added']; ?></b>: -->
<
h3><?php echo $news_story['title']; ?></h3>
<?php if ($image) { ?>
<a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="fancybox"><img align="left" style="border: none; margin-left: 10px; padding: 10px; " src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
<?php } ?>
<?php
echo $news_story['description']; ?></p>
<
div><a href="<?php echo $news_story['href']; ?>"><?php echo $text_read_more; ?></a><br><br></div>
</
div>
<?php } ?>
</div>
</
div>
<?php } ?>


или я не правильно написал

Спустя 4 минуты, 9 секунд (1.08.2012 - 10:33) DarkLynx написал(а):
Если вывело NULL значит изображение в анонсе новости не запрашивается..
Копай не шаблон а код где дергаются новости из базы..

Спустя 17 минут, 30 секунд (1.08.2012 - 10:51) permstyle написал(а):
php код модуля

<?php
class
ControllerModuleNews extends Controller {
protected function index($setting) {
$this->load->language('module/news');
$this->load->model('fido/news');

$this->data['heading_title'] = $this->language->get('heading_title');

$this->data['text_read_more'] = $this->language->get('text_read_more');
$this->data['text_date_added'] = $this->language->get('text_date_added');

$this->data['show_headline'] = $this->config->get('news_module_headline');

$this->data['news_count'] = $this->model_fido_news->getTotalNews();

$this->data['news'] = array();

$results = $this->model_fido_news->getNewsShorts($setting['limit']);

foreach ($results as $result) {
$this->data['news'][] = array(
'title' => $result['title'],
'description' => substr(html_entity_decode($result['description']), 0, $setting['numchars']),
'href' => $this->url->link('information/news', 'news_id=' . $result['news_id']),
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
);

}

$this->id = 'news';

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/news.tpl')) {
$this->template = $this->config->get('config_template') . '/template/module/news.tpl';
} else {
$this->template = 'default/template/module/news.tpl';
}

$this->render();
}
}

?>


код вывода новости

<?php
class
ControllerInformationNews extends Controller {
public function index() {
$this->load->language('information/news');
$this->load->model('fido/news');

$this->data['breadcrumbs'] = array();

$this->data['breadcrumbs'][] = array(
'href' => $this->url->link('common/home'),
'text' => $this->language->get('text_home'),
'separator' => FALSE
);

if (isset($this->request->get['news_id'])) {
$news_id = $this->request->get['news_id'];
} else {
$news_id = 0;
}

$news_info = $this->model_fido_news->getNewsStory($news_id);

if ($news_info) {
$this->document->setTitle($news_info['title']);

$this->data['breadcrumbs'][] = array(
'href' => $this->url->link('information/news'),
'text' => $this->language->get('heading_title'),
'separator' => $this->language->get('text_separator')
);


$this->data['breadcrumbs'][] = array(
'href' => $this->url->link('information/news', 'news_id=' . $this->request->get['news_id']),
'text' => $news_info['title'],
'separator' => $this->language->get('text_separator')
);


$this->data['news_info'] = $news_info;

$this->data['heading_title'] = $news_info['title'];

$this->document->setDescription($news_info['meta_description']);

$this->data['description'] = html_entity_decode($news_info['description']);

$this->load->model('tool/image');

if ($news_info['image']) {
$this->data['image'] = TRUE;
} else {
$this->data['image'] = FALSE;
}

$this->data['min_height'] = $this->config->get('news_thumb_height');

$this->data['thumb'] = $this->model_tool_image->resize($news_info['image'], $this->config->get('news_thumb_width'), $this->config->get('news_thumb_height'));
$this->data['popup'] = $this->model_tool_image->resize($news_info['image'], $this->config->get('news_popup_width'), $this->config->get('news_popup_height'));

$this->data['button_news'] = $this->language->get('button_news');

$this->data['news'] = $this->url->link('information/news');

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/news.tpl')) {
$this->template = $this->config->get('config_template') . '/template/information/news.tpl';
} else {
$this->template = 'default/template/information/news.tpl';
}

$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);

$this->response->setOutput($this->render());
} else {
$news_data = $this->model_fido_news->getNews();

if ($news_data) {
foreach ($news_data as $result) {
$this->data['news_data'][] = array(
'title' => $result['title'],
'description' => substr(html_entity_decode($result['description']), 0, $this->config->get('news_headline_chars')),
'href' => $this->url->link('information/news', 'news_id=' . $result['news_id']),
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
);

}

$this->document->setTitle($this->language->get('heading_title'));

$this->document->breadcrumbs[] = array(
'href' => $this->url->link('information/news'),
'text' => $this->language->get('heading_title'),
'separator' => $this->language->get('text_separator')
);


$this->data['heading_title'] = $this->language->get('heading_title');

$this->data['text_read_more'] = $this->language->get('text_read_more');
$this->data['text_date_added'] = $this->language->get('text_date_added');

$this->data['button_continue'] = $this->language->get('button_continue');

$this->data['continue'] = $this->url->link('common/home');

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/news.tpl')) {
$this->template = $this->config->get('config_template') . '/template/information/news.tpl';
} else {
$this->template = 'default/template/information/news.tpl';
}

$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);

$this->response->setOutput($this->render());
} else {
$this->document->setTitle($this->language->get('text_error'));

$this->document->breadcrumbs[] = array(
'href' => $this->url->link('information/news'),
'text' => $this->language->get('text_error'),
'separator' => $this->language->get('text_separator')
);


$this->data['heading_title'] = $this->language->get('text_error');

$this->data['text_error'] = $this->language->get('text_error');

$this->data['button_continue'] = $this->language->get('button_continue');

$this->data['continue'] = $this->url->link('common/home');

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
} else {
$this->template = 'default/template/error/not_found.tpl';
}

$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);

$this->response->setOutput($this->render());
}
}
}
}

?>
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.