* tiaxgame ok! Is |random(array)
2014-07-22 15:59 · (0)
* tiaxgame help @graham. I can't random in array twig :(
2014-07-22 17:36 · (0)
* tiaxgame @graham, i want randon in array
Ex: {% set array=[1,2,3] %}
{{array|str_shuffle}}

I want output=123 or 132 or 213 or 231 or 312 or 321

I NOT want: {{random(array)}} (output= 1 or 2 or 3)
2014-07-22 17:54 · (0)
* Graham * tiaxgame {{data.entries[(random(data.entries|length-1))].url }} will give you a random url from the current page of posts the whole list is not there unless you set entries_per_page="0" in the blog function
2014-07-23 01:17 · (0)
* tiaxgame * Graham Duplicate it still
random results
2014-07-23 01:51 · (0)
* tiaxgame * Graham you see 'Cùng chuyên mục'
http://aiseo.wap.sh/blog/index/__xtblog_entry/10313295-xtgem-random-blog-bang-javascript.html?__xtblog_block_id=1
2014-07-23 01:54 · (0)
* tiaxgame * Graham
{% block entries_list %}
{% for entry in data.entries %}*
{{data.entries[(random(data.entries|length-1))].title }} {% endfor %}{% set data %}
{% for entry in data.entries %}
{% if loop.first == false %}  <div class="list1"><img src="http://giacmovn.com/images/ic.png" alt="" />&#160;{% set rewrite=entry.title %}<a href="http://aiseo.wap.sh/blog/index/__xtblog_entry/{{ entry.url|split('-')|first|split('/')|last }}-{% include 'blog/mod/rewrite.js' %}.html?__xtblog_block_id=1">{{ entry.title }}</a>  ({% include 'blog/time.js' %})</div>*
{{data.entries[(random(data.entries|length-1))].url }} {% if loop.last == false %} <rand> {% endif %} {% endif %} {% endfor %}{% endset %}

{% set array=data|split('<rand>') %}
{% for i in 1..5 %}

{% set rand=random(array) %}
{% set del='<rand>'~rand %}
{{array|length}}{{rand|raw}}
{% set array=data|split(del|raw)|join|split(rand|raw)|join|split('<rand>') %}{% endfor %}
*
{{data.entries[(random(data.entries|length-1))].url }}
{% endblock %}

Copy code
2014-07-23 01:56 · (0)
* tiaxgame @graham help, i can't random in twig as javascript :((
2014-07-24 13:58 · (0)
* tiaxgame * tiaxgame ok! I done! Thank
2014-07-24 17:40 · (0)

Online: Guests: 1