Inu
Graham Graham Okay I've managed ,, and I want to ask again TWIG code to display in version MOBILE and PC (desktop) Is this code {% if data.device == 'mobile' %} is true for mobile display and to display the PC (desktop) how?
Graham
Inu where I add the 32 that is the offset from the start of the needle (in chars) to the start of the content so you will need to adjust that also
The needle what ever you use
must not appear before the start of the post so if it is a common class the script may break
Inu
Graham xt_blog_content xt_text normal
whether this should be in the dressing my class because I had to replace the class d TWIG
Graham
Inu I have changed the code below
open a post
It now takes the contents of the post up to the first </div>
It then passes it through striptags and uses the result in the description meta tag
This is based on standard twig on a version 2 blog with html enabled in the post
the demo includes a variable dump at thebottom of the page
http://newblogtest.yn.lt/blog
Inu
Graham Xtscript you give do not succeed ... Demo
http://streetfilm.sextg em.com/view/
Graham
Inu This is a complete page code
It now takes the contents of the post up to the first </div>
You can still use the blog on the page from the building tool just be careful of the other lines
disable any other description meta tag the new tag is inserted by {_$$meta|}
<!DOCTYPE html>
<html>
<head>
{_$$meta|}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>x</title>
</head>
<body>
<div data-xtcontainer="container" class="xt_container"><xt:code><!--parser:xtscript-->
# </xt:code>
var $blog=<xt:blog tzone="0" format="Y-m-d" display="1" show_time="0" entries_per_page="3" 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>
var $start_post_content = call strpos $haystack=$blog;$needle=xt_blog_content xt_text normal
if $start_post_content >0
var $start_post_content =($start_post_content+32)
var $end_post_content = call strpos $haystack=$blog;$needle=</div>;$offset=$start_post_content
var $post_content = call substr $val=$blog;$start=$start_post_content;$length=($end_post_content-$start_post_content)
var $cleaned_post_content=call strip_tags $val=$post_content
var $meta=<meta name="description" content="$cleaned_post_content" />
endif
print $blog
del $blog
assign $dump=call dump_vars
assign $dump=call trim $val=$dump ; $charlist={{<pre>
Array/ }}
assign $dump=call trim $val=$dump ; $charlist=( )
assign $dump=call htmlspecialchars $val=$dump
assign $dump=call nl2br $val=$dump
print $dump<br/>
<!--/parser:xtscript--></xt:code>
</div>
</body>
</html>
Copy code
Inu
Graham yes meta tag .. set to _headertags part .... It may show the code ..
Graham
Inu Which meta tags ? and set to which part of the posts content?
It needs to use xtscript
Inu
Graham thanks graham, and how to set the <meta name = automatically on every post in xtblog ....?