Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Изменение цвеи пунки меню модуля "Информация"


Recommended Posts

Здравствуйте. Вот задался вопросом как сгделать выгделение заголовков опрегделенных ситей в модуле "Информация".

Изначально имеем вид модуля:

Изображение

Есть желание изменить цвет опрегделенного заголовка ситьи и привести его к икому виду:

Изображение

Сам вывод модуля в шаблоне реализован ик

<ul>
<?php foreach ($informations as $information) { ?>
<li><a href="<?php echo str_replace('&', '&', $information['href']); ?>"><?php echo $information['title']; ?></a></li>
<?php } ?>
<li><a href="<?php echo str_replace('&', '&', $contact); ?>"><?php echo $text_contact; ?></a></li>
<li><a href="<?php echo str_replace('&', '&', $sitemap); ?>"><?php echo $text_sitemap; ?></a></li>
</ul>

Вот тут у меня и возник вопрос - как для опрегделенного id ситьи сгделать вывод другим цветом?

Link to comment
Share on other sites


<li><a href="<?php echo str_replace('&', '&', $contact); ?>"><font color="#ff0000"><?php echo $text_contact; ?></font></a></li>
Изображение

Да, для ситей "Наши коникты" и "Кари сайи" гделается именно ик. У меня возник вопрос по ситье которая берется из массива, например ситьи "Политика Безопасности"

<?php foreach ($informations as $information) { ?>
<li><a href="<?php echo str_replace('&', '&', $information['href']); ?>"><?php echo $information['title']; ?></a></li>
<?php } ?>
Edited by shoom
Link to comment
Share on other sites


смотрите ID нужных вам ситей

открываете

catalog/controller/module/information.php

меняете

foreach ($this->model_catalog_information->getInformations() as $result) {
			$this->data['informations'][] = array(
				'title' => $result['title'],
				'href'  => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=information/information&information_id=' . $result['information_id'])
			);
		}
на

foreach ($this->model_catalog_information->getInformations() as $result) {
			
			if ($result['information_id'] == "ТУТ ID, СТАТЬИ, КОТОРУЮ ХОТИТЕ _ПОДКРАСИТЬ_") {
				$information_style_start = "<span style=\"color:#FF0000;\">";
				$information_style_end = "</span>";
			} else {
				$information_style_start = "";
				$information_style_end = "";
			}
			
			$this->data['informations'][] = array(
				'title' => $information_style_start . $result['title'] . $information_style_end,
				'href'  => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=information/information&information_id=' . $result['information_id'])
			);
		}
  • +1 1
Link to comment
Share on other sites

Можно сгделать потому чтолее гибкий вариант... в массив informations добавить игдентификатор ситьи.

В файле catalog/controller/module/information.php найти

foreach ($this->model_catalog_information->getInformations() as $result) {
	$this->data['informations'][] = array(
      		'title' => $result['title'],
   		'href'  => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=information/information&information_id=' . $result['information_id'])
	);
}
и изменить ик

foreach ($this->model_catalog_information->getInformations() as $result) {
	$this->data['informations'][] = array(
      		'id'    => $result['information_id'],
      		'title' => $result['title'],
   		'href'  => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=information/information&information_id=' . $result['information_id'])
	);
}

После этого во вьювере можно каждому элементу списка поэтопить свой класс.

В файле catalog/view/theme/НАЗВАНИЕ_ТЕМЫ/template/module/information.tpl найти строку

<li><a href="<?php echo str_replace('&', '&', $information['href']); ?>"><?php echo $information['title']; ?></a></li>
и изменить ик

<li class="info_<?php echo $information['id']; ?>"><a href="<?php echo str_replace('&', '&', $information['href']); ?>"><?php echo $information['title']; ?></a></li>

Теперь стилями можно изголяться как угодно...

Link to comment
Share on other sites

смотрите ID нужных вам ситей

открываете

catalog/controller/module/information.php

....

Благодарю за помощь:) Выбрал Ваш вариант. Со стилями, как предложил Yesvik, не полулилось, может не им прописывал, хотя его вариант тоже понравился.

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.