Advertisement
bloggerwan

Contoh Twig Blog XtGem

Sep 6th, 2020
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 23.99 KB | None | 0 0
  1. <div class="xt_blog_parent" id="xt_blog">
  2. {% if view == 'entries_list' %}
  3.  
  4.     {% block entries_list_tag %}
  5.         {% if data.tag %}
  6.             <div class="xt_container"><h2 class="xt_blog_title">{{ data.translations.t_showing_tagged_posts }} {{ data.tag }}</h2></div>
  7.         {% endif %}
  8.     {% endblock %}
  9.  
  10.     <div class="xt_list">
  11.         {% block entries_list %}
  12.             <div class="xt_blog_post_list">
  13.                 {% for entry in data.entries %}
  14.                     <div class="xt_item">
  15.                         <span>
  16.                             <a class="xt_blog_title_link" href="{{ entry.url }}">
  17.                                 <span class="xt_heading">{{ entry.title }}{% if data.entry_list_show_time %} <span class="xt_blog_entry_time">{{entry.created}}</span>{% endif %}</span>
  18.                                 {% if entry.comments_count %}
  19.                                     <span class="xt_blog_comments_number">( {{ entry.comments_count }} )</span>
  20.                                 {% endif %}
  21.                                 <span class="arrow"></span>
  22.                             </a>
  23.                             {% if data.display_type != 'header' and entry.content %}
  24.                                 <span class="xt_description">{{ entry.content|raw }}</span>
  25.                             {% endif %}
  26.                         </span>
  27.                     </div>
  28.                 {% endfor %}
  29.             </div>
  30.         {% endblock %}
  31.     </div>
  32.  
  33.     {% block entries_list_footer %}
  34.         {% if data.back_url %}
  35.             <div class="xt_container"><a href="{{ data.back_url }}" class="xt_blog_back_to_posts xt_link xt_button">{{ data.translations.t_back_to_posts }}</a></div>
  36.         {% endif %}
  37.         {{ data.pagination_html|raw }}
  38.     {% endblock %}
  39.  
  40.     {% block entries_list_searchbox %}
  41.         {% if data.searchbox %}
  42.             <div class="xt_container xt_blog_search">
  43.                 <form action="{{ data.searchbox.url }}" method="get" class="xt_blog_search_form">
  44.  
  45.                     {% for key, value in data.searchbox.params %}
  46.                         {% if value %}
  47.                             <input type="hidden" name="{{ key }}" value="{{ value }}" />
  48.                         {% endif %}
  49.                     {% endfor %}
  50.  
  51.                     <span class="xt_input"><input type="text" name="__xtblog_search" value="{{ data.searchbox.phrase }}"></span>
  52.                     <span class="xt_submit"><input class="xt_button" type="submit" value="{{ data.translations.t_search }}" /></span>
  53.                 </form>
  54.             </div>
  55.         {% endif %}
  56.     {% endblock %}
  57.  
  58. {% elseif view == 'entry' %}
  59.  
  60.     <div class="xt_blog">
  61.  
  62.         {% block entry_tags %}
  63.             {% if not data.entry.in_comments_thread %}
  64.                 {% if data.hide_tags == false and data.post.tags %}
  65.                     <div class="xt_tags">
  66.                         {{ data.translations.t_tags }}
  67.                         {% for tag in data.post.tags %}
  68.                             <a href="{{ tag.url }}">{{ tag.name }}</a>{% if loop.last == false %}, {% endif %}
  69.                         {% endfor %}
  70.                     </div>
  71.                 {% endif %}
  72.             {% endif %}
  73.         {% endblock %}
  74.  
  75.         {% block entry_post %}
  76.             <h2 class="xt_blog_title">{{ data.post.title }}</h2>
  77.             {% if not data.entry.in_comments_thread %}
  78.                 {% if data.post.subtitle %}
  79.                     <div class="xt_blog_subtitle">{{ data.post.subtitle }}</div>
  80.                 {% endif %}
  81.                 <div class="xt_blog_content xt_text normal">{{ data.post.content|raw }}</div>
  82.  
  83.                 <div class="xt_blog_entry_date xt_text small">{{ data.translations.t_created }} {{ data.post.date }}</div>
  84.  
  85.                 {% if data.post.feed_data %}
  86.                     {% if data.device == 'mobile' %}
  87.                         <div class="xt_blog_social">
  88.                             <img src="http://xtgem.com/images/icons/mobile2/rateup.png" />{{ data.post.feed_data.ratings_up }} {% if data.post.feed_data.has_rated %}<a class="rateup rated_up" href="{{ data.post.feed_data.rate_url }}">Unrate</a>{% else %}<a class="rateup" href="{{ data.post.feed_data.rate_url }}">Rate up</a>{% endif %}
  89.                             {% if data.post.feed_data.has_starred %}<a class="star starred" href="{{ data.post.feed_data.star_url }}"><img src="http://xtgem.com/images/icons/mobile2/star.png" />Unstar</a>{% else %}<a class="star" href="{{ data.post.feed_data.star_url }}"><img src="http://xtgem.com/images/icons/mobile2/unstar.png" />Star</a>{% endif %}
  90.                             {% if data.post.feed_data.is_featured %}<br /> This post is featured on <a href="http://xtgem.com/feed">XtGem</a>{% endif %}
  91.                         </div>
  92.                     {% else %}
  93.                         <div class="xt_blog_social">
  94.                             {% if data.post.feed_data.has_rated %}<a class="rate_up rated_up" href="{{ data.post.feed_data.rate_url }}">{{ data.post.feed_data.ratings_up }} <span class="icon-arrow-up"><!-- --></span></a>{% else %}<a class="rate_up" href="{{ data.post.feed_data.rate_url }}">{{ data.post.feed_data.ratings_up }} <span class="icon-arrow-up"><!-- --></span></a>{% endif %}
  95.                             {% if data.post.feed_data.has_starred %}<a class="star starred" href="{{ data.post.feed_data.star_url }}">Unstar <span class="icon-star"><!-- --></span></a>{% else %}<a class="star" href="{{ data.post.feed_data.star_url }}">Star <span class="icon-star"><!-- --></span></a>{% endif %}
  96.                             {% if data.post.feed_data.is_featured %}<div class="featured">This post is featured on <a href="http://xtgem.com/feed">XtGem</a></div>{% endif %}
  97.                         </div>
  98.                     {% endif %}
  99.                 {% endif %}
  100.  
  101.                     {% if data.social_share_enabled %}
  102.                         <div class="xt_social_shares">
  103.                             <a
  104.                                title="Share on facebook"
  105.                                href="http://www.facebook.com/sharer.php?u={{data.post.url}}"
  106.                                class="xt_fb_share"
  107.                                target="_blank"
  108.                                onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent('{{data.post.url}}'), 'facebook-share-dialog', 'width=600,height=400');return false;"
  109.                               >
  110.                                 {% if data.device == 'mobile' %}
  111.                                     <img height="16px" width="16px" src="http://xtgem.com/images/facebook.png" alt="Share on facebook">
  112.                                 {% else %}
  113.                                     <span class="icon-fb"><!-- --></span>
  114.                                 {% endif %}
  115.                             </a>
  116.                             <a
  117.                                title="Share on twitter"
  118.                                href="http://twitter.com/home?status={{data.post.url}}"
  119.                                class="xt_tw_share"
  120.                                target="_blank"
  121.                                onclick="window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"
  122.                               >
  123.                                 {% if data.device == 'mobile' %}
  124.                                     <img height="16px" width="16px" src="http://xtgem.com/images/twitter.png" alt="Share on twitter">
  125.                                 {% else %}
  126.                                     <span class="icon-tw"><!-- --></span>
  127.                                 {% endif %}
  128.                             </a>
  129.                             <a
  130.                                title="Share on Google+"
  131.                                href="https://plus.google.com/share?url={{data.post.url}}"
  132.                                class="xt_gp_share"
  133.                                target="_blank"
  134.                                onclick="window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"
  135.                               >
  136.                                 {% if data.device == 'mobile' %}
  137.                                     <img height="16px" width="16px" src="http://xtgem.com/images/google_plus.png" alt="Share on google+">
  138.                                 {% else %}
  139.                                     <span class="icon-gp"><!-- --></span>
  140.                                 {% endif %}
  141.                             </a>
  142.                             <a
  143.                                title="Share via mail"
  144.                                href="mailto:?subject=Have a look&body={{data.post.url}}"
  145.                                class="xt_mail_share"
  146.                                target="_blank"
  147.                               >
  148.                                 {% if data.device == 'mobile' %}
  149.                                     <img height="16px" width="16px" src="http://xtgem.com/images/email.png" alt="Share via mail">
  150.                                 {% else %}
  151.                                     <span class="icon-mail"><!-- --></span>
  152.                                 {% endif %}
  153.                             </a><!--
  154.                     --></div>
  155.                     {% endif %}
  156.  
  157.             {% endif %}
  158.  
  159.             <a class="xt_blog_back_to_posts xt_link xt_button" href="{{ data.back_url }}">{{ data.translations.t_back_to_posts }}</a>
  160.         {% endblock %}
  161.  
  162.         {% block entry_comments_list %}
  163.             {% if data.post.allow_comments %}
  164.                 {% if data.new_comments_system %}
  165.                     <div class="xt_blog_comments" id="xt_blog_comments">
  166.  
  167.                         {% if data.entry.in_comments_thread %}
  168.  
  169.                             <br /><div><a href="{{ data.entry.comments_thread_all }}" class="xt_button xt_link">&larr; {{ data.translations.t_show_all_comments }}</a></div><br />
  170.                             {% if data.entry.comments_thread_parent %}
  171.                                 <div><a href="{{ data.entry.comments_thread_parent }}" class="xt_button xt_link">&larr; {{ data.translations.t_see_parent_thread }}</a></div>
  172.                             {% endif %}
  173.                         {% endif %}
  174.  
  175.                         <span class="xt_blog_comments_title">
  176.                             {% if data.entry.comments %}
  177.                                 {{ data.translations.t_comments }}
  178.                             {% else %}
  179.                                 {{ data.translations.t_comments_empty }}
  180.                             {% endif %}
  181.                         </span>
  182.                         {% macro comments_list (comments, ctx) %}
  183.                             {% for comment in comments %}
  184.                                 <div class="xt_blog_comment{% if comment.owner_of_comment %} xt_blog_comment_author_admin{% endif %}">
  185.                                     <span class="xt_blog_comment_date">[{{ comment.date }}]</span>
  186.                                     <span class="xt_blog_comment_author">
  187.                                         {% if comment.author_profile %}
  188.                                             <a href="{{ comment.author_profile.link }}"><img src="{{ comment.author_profile.avatars[16] }}" style="display:inline">{{ comment.author_profile.name }}</a>
  189.                                         {% else %}
  190.                                             {{ comment.nick }}
  191.                                         {% endif %}:
  192.                                     </span>
  193.                                     {% if not ( ctx.data.entry.in_comments_thread and comment.childs and (comment.childs_count > 0) ) %}
  194.                                         <div class="xt_blog_comment_actions">
  195.                                             <a href="{{ comment.reply_link }}" class="xt_blog_comment_action_reply">{{ ctx.data.translations.t_reply }}</a>
  196.                                             {% if ctx.data.is_logged_in and not comment.is_hidden and not data.comments_form.is_maintenance %}
  197.                                                 {% if ctx.data.reported_spam and ctx.data.reported_spam == comment.id %}
  198.                                                     <span class="xt_blog_comment_action_reported">{{ctx.data.translations.t_reported}}</span>
  199.                                                 {% else %}
  200.                                                     <a href="{{ comment.spam_link }}" class="xt_blog_comment_action_report_spam">{{ ctx.data.translations.t_report_spam }}</a>
  201.                                                 {% endif %}
  202.                                             {% elseif not ctx.data.is_logged_in and not comment.is_hidden and not data.comments_form.is_maintenance %}
  203.                                                 <a href="{{ comment.login_link }}" class="xt_blog_comment_action_report_spam">{{ ctx.data.translations.t_report_spam }}</a>
  204.                                             {% endif %}
  205.                                             {% if not comment.childs and (comment.childs_count > 0) %}
  206.                                                 <a href="{{ comment.reply_link }}" class="xt_blog_comment_action_reply">{{ ctx.data.translations.t_show_replies }} ({{comment.childs_count}})</a>
  207.                                             {% endif %}
  208.                                             {% if comment.show_more %}
  209.                                                 <a href="{{ comment.reply_link }}" class="xt_blog_comment_action_reply">{{ ctx.data.translations.t_show_all_replies }}</a>
  210.                                             {% endif %}
  211.                                         </div>
  212.                                     {% endif %}
  213.                                     {% if comment.is_hidden %}
  214.                                         <div class="xt_blog_comment_content">{{ ctx.data.translations.t_hidden_comment }}</div>
  215.                                     {% else %}
  216.                                         <div class="xt_blog_comment_content">{{ comment.message|raw }}</div>
  217.                                     {% endif %}
  218.  
  219.                                     {% if comment.childs %}
  220.                                         <div class="xt_reply" style="margin: 5px 6px;">
  221.                                             {{ _self.comments_list(comment.childs, ctx) }}
  222.                                         </div>
  223.                                     {% endif %}
  224.                                 </div>
  225.                             {% endfor %}
  226.                         {% endmacro %}
  227.                         {{ _self.comments_list(data.entry.comments, _context) }}
  228.  
  229.                     </div><br />
  230.                     {{ data.pagination_html|raw }}
  231.                 {% else %}
  232.                     <div class="xt_blog_comments" id="xt_blog_comments">
  233.                         <span class="xt_blog_comments_title">{{ data.translations.t_comments }}</span>
  234.  
  235.                         {% for comment in data.entry.comments %}
  236.                             <div class="xt_blog_comment">
  237.                                 <span class="xt_blog_comment_date">[{{ comment.date }}]</span>
  238.                                 <span class="xt_blog_comment_author">{{ comment.nick }}:</span>
  239.                                 <div class="xt_blog_comment_content">{{ comment.message|raw }}</div>
  240.                             </div>
  241.                         {% endfor %}
  242.                     </div><br />
  243.                     {{ data.pagination_html|raw }}
  244.                 {% endif %}
  245.             {% endif %}
  246.         {% endblock %}
  247.  
  248.         {% block entry_comments_form %}
  249.             {% if data.comments_form.is_maintenance %}
  250.                 {{ data.comments_form.maintenante_markup|raw }}
  251.             {% elseif data.is_logged_in and data.new_comments_system and not data.community_name %}
  252.                 <div class="xt_blog_write_a_comment">
  253.                     <span class="xt_blog_write_a_comment_title">{{ data.translations.t_provide_community_name }}</span>
  254.                     <form action="{{ data.community_name_submit_url }}" method="post" id="xt_blog_comment_form">
  255.                         {% if data.entry.in_comments_thread %}
  256.                             <input type="hidden" name="__xtblog_comment_thread_id" value="{{ data.entry.in_comments_thread }}" />
  257.                         {% endif %}
  258.                         <div class="xt_input">
  259.                             <input type="text" name="community_name" value="{{data.community_name_tmp}}" /><br />
  260.                         </div>
  261.                         <div class="xt_submit">
  262.                             <input class="xt_button" type="submit" value="{{ data.translations.t_submit }}" />
  263.                         </div>
  264.                     </form>
  265.                 </div>
  266.             {% else %}
  267.                 {% if data.post.allow_comments %}
  268.                     <div class="xt_blog_write_a_comment">
  269.                         <span class="xt_blog_write_a_comment_title">{{ data.translations.t_post_a_comment }}</span>
  270.                         {% if data.comments_form.comments_restriction == "logged_in" and not data.is_logged_in %}
  271.                             <div>{{ data.translations.t_comments_login_required }}: <a href="{{ data.comments_form.login_link }}"> {{ data.translations.t_login }} </a> | <a href="{{ data.comments_form.signup_link }}"> {{ data.translations.t_signup }} </a></div>
  272.                         {% elseif data.comments_form.comments_restriction == "logged_in" and data.is_logged_in and not data.is_confirmed_email %}
  273.                             <div>
  274.                                 <a href="{{ data.confirm_email_link }}?redir={{ data.comments_form.url_encoded }}" class="xt_blog_confirm_email">
  275.                                     {{ data.translations.t_confirm_email }}
  276.                                 </a>
  277.                             </div>
  278.                         {% else %}
  279.                             <form action="{{ data.comments_form.url }}" method="post" id="xt_blog_comment_form">
  280.  
  281.                                 {% if data.entry.in_comments_thread %}
  282.                                     <input type="hidden" name="__xtblog_comment_thread_id" value="{{ data.entry.in_comments_thread }}" />
  283.                                 {% endif %}
  284.  
  285.                                 <input type="hidden" name="__xtblog_post" value="Post" />
  286.                                 <input type="hidden" name="__xtx" value="{{ data.comments_form.fields.xtx }}" />
  287.                                 <input type="hidden" name="__xtxs" value="{{ data.comments_form.fields.xtxs }}" />
  288.                                 <input type="text" name="__xtblog_blog" value="" style="display:none" />
  289.                                 <input type="hidden" name="__xtblog_entry" value="{{ data.comments_form.entry_id }}" />
  290.  
  291.                                 {% if data.is_logged_in and data.new_comments_system %}
  292.                                     <div class="xt_label">
  293.                                         <label>{{ data.translations.t_posting_as }}: <span class="xtblog_community_name">{{ data.community_name }}</span></label>
  294.                                     </div>
  295.                                 {% else %}
  296.                                     {% if data.comments_form.spam_comments_reserved_name and data.new_comments_system %}
  297.                                         <div>{{ data.translations.t_reserved_name }}</div>
  298.                                     {% endif %}
  299.                                     {% if data.comments_form.poster %}
  300.                                         <input type="hidden" name="__xtblog_nick" value="{{ data.comments_form.poster }}" />
  301.                                     {% else %}
  302.                                         <div class="xt_label">
  303.                                             <label>{{ data.translations.t_name }} </label>
  304.                                         </div>
  305.                                         <div class="xt_input">
  306.                                             <input type="text" name="__xtblog_nick" value="{{ data.comments_form.spam_comments_nick }}" /><br />
  307.                                         </div>
  308.                                     {% endif %}
  309.                                 {% endif %}
  310.                                 {% if data.comments_form.comments_restriction == "email_required" and not data.is_logged_in %}
  311.  
  312.                                     <div class="xt_label">
  313.                                         <label>{{ data.translations.t_email }} </label>
  314.                                     </div>
  315.                                     <div class="xt_input">
  316.                                         <input type="text" name="__xtblog_email" value="{{ data.comments_form.spam_comments_email }}" /><br />
  317.                                     </div>
  318.                                 {% endif %}
  319.  
  320.                                 <div class="xt_label">
  321.                                     <label>{{ data.translations.t_comment }} </label>
  322.                                 </div>
  323.                                 <div class="xt_textarea">
  324.                                     <textarea id="xtblog_comment_msg" name="__xtblog_msg">{{ data.comments_form.spam_comments_msg }}</textarea>
  325.                                 </div>
  326.  
  327.                                 {% if data.comments_form.spam_comments %}
  328.                                     Please enter the text you can see on the image below: <br />
  329.                                     <input type="hidden" name="hash" value="{{ data.comments_form.spam_hash }}" />
  330.                                     <img src="{{ data.comments_form.spam_captcha_url }}" alt="" /><br />
  331.                                     <div class="xt_label">
  332.                                         <label>Code: </label>
  333.                                     </div>
  334.                                     <div class="xt_input">
  335.                                         <input type="text" name="code" />
  336.                                     </div><br />
  337.                                 {% endif %}
  338.  
  339.                                 <div class="xt_submit">
  340.                                     <input class="xt_button" type="submit" value="{{ data.translations.t_post }}" />
  341.                                 </div>
  342.                             </form>
  343.                         {% endif %}
  344.                     </div>
  345.                 {% endif %}
  346.             {% endif %}
  347.         {% endblock %}
  348.     </div>
  349. {% elseif view == 'no_contents' %}
  350.     {% block no_contents %}
  351.         {% if data.searchbox.phrase %}
  352.             <div class="xt_blog xt_list">{{ data.translations.t_no_search_results_found }}</div>
  353.         {% else %}
  354.             <div class="xt_blog xt_list">{{ data.translations.t_no_entries_found }}</div>
  355.         {% endif %}
  356.     {% endblock %}
  357.  
  358.     {% block no_contents_searchbox %}
  359.         {% if data.searchbox %}
  360.             <div class="xt_container xt_blog_search">
  361.                 <form action="{{ data.searchbox.url }}" method="get" class="xt_blog_search_form">
  362.  
  363.                     {% for key, value in data.searchbox.params %}
  364.                         {% if value %}
  365.                             <input type="hidden" name="{{ key }}" value="{{ value }}" />
  366.                         {% endif %}
  367.                     {% endfor %}
  368.  
  369.                     <span class="xt_input"><input type="text" name="__xtblog_search" value="{{ data.searchbox.phrase }}" /></span>
  370.                     <span class="xt_submit"><input class="xt_button" type="submit" value="{{ data.translations.t_search }}" /></span>
  371.                 </form>
  372.             </div>
  373.  
  374.             {% if data.back_url %}
  375.                 <div class="xt_container"><a href="{{ data.back_url }}" class="xt_blog_back_to_posts xt_link xt_button">{{ data.translations.t_back_to_posts }}</a></div>
  376.             {% endif %}
  377.             {{ data.pagination_html|raw }}
  378.  
  379.         {% endif %}
  380.     {% endblock %}
  381. {% elseif view == 'no_entry' %}
  382.     {% block no_entry %}
  383.         <div class="xt_blog xt_list">No blog entry found</div>
  384.     {% endblock %}
  385. {% endif %}
  386. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement