@XenTerSeO

Как вывести спец. символы вместо HTML кодов?

Есть следующий код:

function(_followers, next) {
			    followers = _followers;
			    if (!followers.length) {
			        return callback();
			    }
			    title = postData.topic.title;
			    if (title) {
			        title = S(title).decodeHTMLEntities().s;
			    }

			    notifications.create({
          bodyShort: '<i class="fa fa-times"></i>',
					bodyLong: postData.content,
					pid: postData.pid,
					nid: 'tid:' + postData.topic.tid + ':pid:' + postData.pid + ':uid:' + exceptUid,
					tid: postData.topic.tid,
					from: exceptUid
				}, function(err, notification) {
					if (err) {
						return next(err);
					}
					if (notification) {
						notifications.push(notification, followers);
					}
					next();
				});
			},


В итоге, при просмотре кода выводимого элемента видно, что строка <i class="fa fa-times"></i>
выводится как &lt;i class="fa fa-times"&gt;&lt;/i&gt;. Как вывести её в первородном варианте?
  • Вопрос задан
  • 277 просмотров
Пригласить эксперта
Ответы на вопрос 2
@XenTerSeO Автор вопроса
Никита Баев:

<div class="notifications">
	<div component="notifications/mark_all" href="#" class="mark_all_read" data-ajaxify="false">
    <i class="fa fa-bell-slash-o"></i>
  </div>
	<ul class="notifications-list">
	<!-- BEGIN notifications -->
		<li data-nid="{notifications.nid}" class="{notifications.readClass}" component="notifications/item">
			<a class="nitif_avatar" href="{config.relative_path}/user/{notifications.user.userslug}">
        <img class="user-img" src="{notifications.image}">
      </a>
			<a class="nitif_alert"
				<a component="notifications/item/link" href="{notifications.path}">{notifications.bodyShort}</a>
			</a>
		</li>
	<!-- END notifications -->
	</ul>
</div>


{notifications.bodyShort} - тут он должен отображаться.
Ответ написан
drugoi
@drugoi
Front-end Developer
Попробуйте поменять {notifications.bodyShort} на {{notifications.bodyShort}}
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы