* mans_bx pls sir hlp mee
2017-05-04 07:06 · (0)
* Graham * mans_bx Ok you would need to adapt this to fit your own custom blog twig and post list markup it is only to prove the concept
it does not give the entire post but it will give a random post list entry
This is in normal xtgem blog markup where the standard xtblog.twig has been renamed blog.twig
{% if data.translations.t_no_entries_found == 'random' and view == 'entries_list'%}
{% set entry=data.entries[random(data.entries|length-1)]%}
<div>
  <a class="xt_blog_title_link" href="{{ entry.url }}">
    <span class="xt_heading">{{ entry.title }}{% if data.entry_list_show_time %} <span class="xt_blog_entry_time">{{entry.created}}</span>{% endif %}</span>
{% if entry.comments_count %}
<span class="xt_blog_comments_number">( {{ entry.comments_count }} )</span>
{% endif %}
</a>
{% if data.display_type != 'header' and entry.content %}
<span class="xt_description">{{ entry.content|raw }}</span>
{% endif %}
</div>
{%else%}
{%include 'blog.twig'%}
{%endif%}

Copy code
You then need a blog function with entries_per_page="0" and t_no_entries_found="random"
Remember that this can mess up the blog block id if you have other blog functions on the page so you may also need to allow for that
2017-05-04 11:09 (edited 2017-05-04 11:11 by Graham ) · (0)
* Mwebvendor * mans_bx They have no widget for random blog but they have xtblog twig.

Check this articles http://forum.xtgem.com/index/__xt/post-oqp0yi6mk4estv1g33ba4fqp0yi6mk4estv1g3.html

But if use this twig, you have no pagination on your bloglist, the only one is the link to refresh the the bloglist.
2017-05-04 11:14 (edited 2017-05-04 11:15 by Mwebvendor ) · (0)
* Graham * Mwebvendor Yeah that one would also work but this one is simpler
2017-05-04 11:17 · (0)
* Mwebvendor * Graham Thank for that graham,,, by the way that your code have a pagination?
2017-05-04 11:17 · (0)
* Graham * Mwebvendor There is no point in paging a random list you just get another random list all you need is a reload button i had forgotten about that other script this uses the same code at its heart
2017-05-04 11:20 (edited 2017-05-06 13:17 by Graham ) · (0)
* Mwebvendor * Graham You mean is like a multiple bloglist? like one blgolist in main page and one random bloglist in sub-page?
2017-05-04 11:22 · (0)
* Graham * Mwebvendor That script was created before i discovered how to use a blog parameter to select different twig files now I would separate that from the main twig
2017-05-04 11:29 · (0)
* mans_bx How to display it more than one?
2017-05-06 12:00 · (0)
* Graham * mans_bx I am actually having difficulty getting it to work without repeats so I have to think about that
2017-05-07 08:45 · (0)

Online: Guests: 1