* Mwebvendor can i use xtcat counters in a blog list?
2016-05-11 06:28 · (0)
* Aash * Mwebvendor yes, Graham will answer you
2016-05-11 07:05 · (0)
* Graham * Mwebvendor I have not tried them in blog
I am away from my pc till friday
I will look into it when I get back home
2016-05-11 09:55 (edited 2016-05-11 09:55 by Graham ) · (0)
* Mwebvendor * Graham ok i understand you.
2016-05-11 10:27 · (0)
* Graham * Mwebvendor it turns out to be surprisingly easy
If your blog is assigned to a xtscript variable and then printed
You can add xt:widgets and xt:functions directly into the twig as xtscript changes the parsing order
this code goes in {% block entries_list %} somewhere inside the '{% for entry in data.entries %} loop to display the counters without updating them
{%set xtcat=entry.url|split('__xtblog_entry/')%}
{%set xtcat=xtcat[1]|split('?')%}
<span class="xt_button"><xt:widget tool="Counter" site="SITE" type="display1" idstring="{{xtcat[0]}}"  key="XTCAT KEY" xtuser="XTCAT USER" id="xt.c.a.t." /></span>

Copy code

This code goes somewhere in {% block entry_post %} to display the count and update it
{%set xtcat=data.post.url|split('__xtblog_entry/')%}
{%set xtcat=xtcat[1]|split('?')%}
<span class="xt_button"><xt:widget tool="Counter" site="SITE" idstring="{{xtcat[0]}}"  key="XTCAT KEY" xtuser="XTCAT USER" id="xt.c.a.t." /></span>

Copy code

demo http://adgj.mw.lt/blog_0
In the demo I also used a gradient text widget to display the post titles
so the same method should work for other widgets
I dont think it will work in forum as that is not available to xtscript
Remember to set your own site user and key in the above code and it will only work via xtscript

Use this trick to set the blog so you can still use it in the building tool
<!--parser:xtscript-->
# </xt:code>
var $blog=<xt:blog tzone="0" format="Y-m-d" display="1" show_time="0" entries_per_page="10" comments_per_page="20" comments_sort="-1" entries_sort="-1" display_limit="0" display_symbol="" version="2" t_back_to_posts="" t_comments="" t_comments_empty="" t_post_a_comment="" t_name="" t_comment="" t_post="" t_tags="" t_search="" t_created="" t_showing_tagged_posts="" t_no_entries_found="" t_no_search_results_found="" t_show_all_comments="" t_see_parent_thread="" t_show_all_replies="" t_show_replies="" t_reply="" t_posting_as="" t_comments_login_required="" t_login="" t_signup="" t_confirm_email="" t_report_spam="" />
# <xt:code>
print $blog
<!--/parser:xtscript-->

Copy code
2016-05-14 00:40 (edited 2016-05-14 09:10 by Graham ) · (0)
* Graham * Mwebvendor To see exactly what is available in the data array of a blog on any blog page
add this at the top of your twig
<textarea>{{ data|json_encode(constant('JSON_PRETTY_PRINT')) }}</textarea>
Copy code
2016-05-14 05:16 (edited 2016-05-14 05:18 by Graham ) · (0)
* Mwebvendor Thank for our graham..

comment my coming soon blog .. BAD or GOOD. http://workpage.xtgem.com/videos
2016-05-14 09:58 · (0)
* Graham So that xtscript $variables and brackets are not parsed in users comments you need to add this filter
|replace({'(': '\\(', '$': '\\$'})
in the {% macro comments_list (comments, ctx) %} near the end of the macro where the comments are output (2 places)
<div class="xt_blog_comment_content">{{ comment.message|replace({'(': '\\(', '$': '\\$'})|raw }}</div>
Copy code

Note you may also see these problems in your posts so you May need to add the filters there as well
or if you wish escape them in the post code
2016-05-16 00:32 (edited 2016-05-17 23:35 by Graham ) · (0)
* rafhj * Graham AJROHAN
2020-06-13 07:38 · (0)

Online: Guests: 1