Qartvela™ Posted March 25, 2018 Share Posted March 25, 2018 Здравствуйте Как правильно выводит название темы?var title = "{$topic['title']}"; alert(title);Если в title есть двойное кавычки " получаю: Название темы с ":двумя кавычками": Как исправить? Link to comment Share on other sites More sharing options...
Fantik Posted March 25, 2018 Share Posted March 25, 2018 (edited) а если такие использовать «кавычки» ?‘кавычки 2’„кавычки 3“ Edited March 25, 2018 by Fantik Link to comment Share on other sites More sharing options...
Qartvela™ Posted March 25, 2018 Author Share Posted March 25, 2018 @FantikТогда надо найти все темы с кавычками и переименовать, потом запретить в название темы двойное кавычки. ********************** Даже .replace не помогает: var title = ipb.sharelinks.title.replace(/":/g , '"').replace(/!:/g , "!").replace(/':/g, "'").replace(/"/g, '"');В случае !: работает, но не для ": Link to comment Share on other sites More sharing options...
f2065 Posted March 25, 2018 Share Posted March 25, 2018 А если непосредственно перед выводом (помня про опасность SQL-инжектов) делать htmlspecialchars_decode() с этой строкой? Link to comment Share on other sites More sharing options...
newbie Posted March 26, 2018 Share Posted March 26, 2018 Так и в бд хранится не "Title"В случае !: работает, но не для ": Откуда двоеточие в конце, если должна быть точка с запятой? Link to comment Share on other sites More sharing options...
Qartvela™ Posted March 26, 2018 Author Share Posted March 26, 2018 Это я поменял. Если не менять:Название темы с "двумя кавычками": В bbcode code он все равно меняется Link to comment Share on other sites More sharing options...
newbie Posted March 26, 2018 Share Posted March 26, 2018 Работает Link to comment Share on other sites More sharing options...
Qartvela™ Posted March 26, 2018 Author Share Posted March 26, 2018 В topicViewTemplate не работает: Link to comment Share on other sites More sharing options...
newbie Posted March 26, 2018 Share Posted March 26, 2018 Дайте ссылку на тему 1 Link to comment Share on other sites More sharing options...
Qartvela™ Posted March 26, 2018 Author Share Posted March 26, 2018 Один из вариантов<script> var title = "{$topic['title']}"; var re = new RegExp('' + '34;',"g"); var mytitle = title.replace(re,'"'); alert(mytitle); </script> @newbieРаботает. Спасибо огромное! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now