Jump to content

Подключение комментариев Вконтакте


Recommended Posts

это в head

<!-- Put this script tag to the <head> of your page -->
<script type="text/javascript" src="//vk.com/js/api/openapi.js?86"></script>

остальную часть там где нужно

<script type="text/javascript">
  VK.init({apiId: API_ID, onlyWidgets: true});
</script>

{literal}
<!-- Put this div tag to the place, where the Comments block will be -->
<div id="vk_comments"></div>
<script type="text/javascript">
VK.Widgets.Comments("vk_comments", {limit: 10, width: "496", attach: "*"});
</script>
{/literal}
Link to post
Share on other sites

Я недавно себе подключил, нормально стало, странно

попробуйте так

{literal} <script type="text/javascript"> VK.init({apiId: API_ID, onlyWidgets: true}); </script> {literal} <!-- Put this div tag to the place, where the Comments block will be --> <div id="vk_comments"></div> <script type="text/javascript"> VK.Widgets.Comments("vk_comments", {limit: 10, width: "496", attach: "*"}); </script> {/literal}

 

{literal} ставим перед <script>

Link to post
Share on other sites

Версия 2.1.5
Шаблон product.tpl
В самом верху прописывал: <!-- Put this script tag to the <head> of your page -->
<script type="text/javascript" src="//vk.com/js/api/openapi.js?86"></script>
Дальше в шаблоне перед "Комментарии" вставлял остальное.(id естественно создал и вставил изначально). Пробовал как на сайте, пробовал через literal вставить, один фик вылезает целая куча ошибок вида:
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "W:\home\shop.ws\www\simpla//design/default_1/html\product.tpl" on line 8 "VK.init({apiId: 3*****9, onlyWidgets: true});" - Unexpected ": ", expected one of: "}" , " "' in W:\home\shop.ws\www\simpla\Smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php:431 Stack trace: #0 W:\home\shop.ws\www\simpla\Smarty\libs\sysplugins\smarty_internal_templateparser.php(2855): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 W:\home\shop.ws\www\simpla\Smarty\libs\sysplugins\smarty_internal_templateparser.php(2920): Smarty_Internal_Templateparser->yy_syntax_error(2, ': ') #2 W:\home\shop.ws\www\simpla\Smarty\libs\sysplugins\smarty_internal_smartytemplatecompiler.php(51): Smarty_Internal_Templateparser->doParse(2, ': ') #3 W:\home\shop.ws\www\simpla\Smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php(82): Smarty_Internal_SmartyTemplateCompiler->doCompile('{* ????????????...') #4 W:\home\shop.ws\www\simp in W:\home\shop.ws\www\simpla\Smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 431

Link to post
Share on other sites

Что вы пробовали? Вы знаете что делает - {literal} ?
Вы понимаете, что любой виджет от ВК делится на 2 части, подключаемый скрипт и вывод его на сайте?
Вы понимаете, что такое личный идентификатор и зачем он нужен, от ВК?
подключаем АПИ от вк, дальше идетификатор и подключаемый модуль, дальше блок где будет через айфрейм работать подключаемый модуль.
В результате все делится на 2 части и осмысление, зачем нужен {literal}.
Вы просто не внимательный.
Пробуйте заново.

Link to post
Share on other sites

Лучше было бы не тратить время на такой длинный пост, а просто сказать еще раз точно какой код и куда конкретно вставить в product.tpl Не знаю внимательный или нет, но я пробовал и без этого и с ним.*я про literal

Link to post
Share on other sites

BeZrespeKTA, так какой смысл что вы пробовали, если не работает. Тут понимать нужно что делает этот тег, тогда и все получится. Вы попросили помощи, я помогаю вам разобраться.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...