Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
4.6 : Textiled Body & Excerpt are now analyzed separately, I'm sad
I’m sad.
Ok, it’s not a Troubleshooting because it was a non documented feature. But i liked it !
With Texpattern ≤ 4.5.7 it was possible to write some Textile text to body field and write Textile footnotes or links alias to excerpt field. I don’t now why by the 2 fields was analysed together by Textile parser.
I used this feature for move footnotes to a sidebar for example. You can see a exemple to my website (only for viewport > 10124px, in 2 cols layout) : Click on green number in body text, and after scroll page.
ok, I played with fire.
Now with 4.6, this feature stopped
I need to find a solution to patch my problem.
- Someone has a sql code to move except content à the end of body content ?
- And after that I need to find solution for wrap footnotes and move to sidebar…
Ay help or ideas welcome
Thanks
Offline
Re: 4.6 : Textiled Body & Excerpt are now analyzed separately, I'm sad
Cast Away
Offline
Re: 4.6 : Textiled Body & Excerpt are now analyzed separately, I'm sad
It might be a lot of work but did you think of using the images fields? You could for example upload some 1×1px images just to create entries in the database and use them for your own needs.
Something like <txp:images id="##"><txp:image_info type="caption" /><txp:images>
The image id could be fetched by a custom_field in the article, which you could call footnotes
. In such case the code above could change to
<txp:if_custom_field name="footnotes">
<txp:else />
<txp:images id='<txp:custom_field name="footnotes" />'>
<txp:image_info type="caption" escape="" />
</txp:images>
</txp:if_custom_field>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: 4.6 : Textiled Body & Excerpt are now analyzed separately, I'm sad
sacripant wrote #302297:
Someone has a sql code to move except content à the end of body content ?
That’s rather straightforward:
UPDATE `textpattern` SET `Body` = CONCAT(`Body`, '\n\n', `Excerpt`), `Body_html` = CONCAT(`Body_htm`, '\n', `Excerpt_html`) WHERE ...
And after that I need to find solution for wrap footnotes and move to sidebar…
You can wrap Excerpt_html
in some markup when concatenating and use css/jquery/etc_query to display/move it where you want.
Offline
Re: 4.6 : Textiled Body & Excerpt are now analyzed separately, I'm sad
You can kind of restore the 4.5.7 behaviour with this plugin (to test):
# Name: abc_merge v0.1
# Type: Admin/AJAX plugin
#
# Author:
# URL:
# Recommended load order: 5
# .....................................................................
# This is a plugin for Textpattern CMS - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................
YToxMTp7czo0OiJuYW1lIjtzOjk6ImFiY19tZXJnZSI7czo2OiJhdXRob3IiO3M6MDoiIjtz
OjEwOiJhdXRob3JfdXJpIjtzOjA6IiI7czo3OiJ2ZXJzaW9uIjtzOjM6IjAuMSI7czoxMToi
ZGVzY3JpcHRpb24iO3M6MDoiIjtzOjQ6ImNvZGUiO3M6NTcwOiJyZWdpc3Rlcl9jYWxsYmFj
aygnYWJjX21lcmdlJywgJ2FydGljbGVfc2F2ZWQnKTsNCnJlZ2lzdGVyX2NhbGxiYWNrKCdh
YmNfbWVyZ2UnLCAnYXJ0aWNsZV9wb3N0ZWQnKTsNCg0KZnVuY3Rpb24gYWJjX21lcmdlKCRl
dmVudCwgJHN0ZXAsICRycykgew0KCWlmICghKCRyb3cgPSBzYWZlX3JvdygnQm9keSwgRXhj
ZXJwdCcsICd0ZXh0cGF0dGVybicsICdJRD0nLiRyc1snSUQnXSkpKSByZXR1cm47DQoJZXh0
cmFjdCgkcm93KTsNCgkkdGV4dGlsZSA9IG5ldyBcVGV4dHBhdHRlcm5cVGV4dGlsZVxQYXJz
ZXIoKTsNCgkkbWVyZ2VkID0gJHRleHRpbGUtPnRleHRpbGVUaGlzKCRCb2R5Lm4ubi4nbm90
ZXh0aWxlLiA9PT09PT09PT09Jy5uLm4uJEV4Y2VycHQpOw0KCWxpc3QoJGJvZHlfaHRtbCwg
JGV4Y2VycHRfaHRtbCkgPSBkb1NsYXNoKGV4cGxvZGUobi4nPT09PT09PT09PScubiwgJG1l
cmdlZCwgMikpOw0KCXNhZmVfdXBkYXRlKCd0ZXh0cGF0dGVybicsICJCb2R5X2h0bWwgPSAn
JGJvZHlfaHRtbCcsIEV4Y2VycHRfaHRtbCA9ICckZXhjZXJwdF9odG1sJyIsICdJRCA9ICcu
JHJzWydJRCddKTsNCn0iO3M6NDoidHlwZSI7czoxOiI0IjtzOjU6Im9yZGVyIjtzOjE6IjUi
O3M6NToiZmxhZ3MiO3M6MToiMCI7czo0OiJoZWxwIjtiOjA7czozOiJtZDUiO3M6MzI6ImJi
MzRlMTJjOTBjZWY3Y2M1YTVhYmY5NGY5ZjViYTAxIjt9
Your Body
and Excerpt
must not contain ==========
string :-)
Last edited by etc (2016-10-20 16:12:28)
Offline
Re: 4.6 : Textiled Body & Excerpt are now analyzed separately, I'm sad
@Colac, I’m not sure you understood my request
@etc. Excellent, my rescuer!
I moved Excerpt content to body content with sql “Update + Set” command when I see your plugin proposition.
Your small plugin work perfect.
Just some questions to better understand your code :
register_callback('abc_merge', 'article_saved');
register_callback('abc_merge', 'article_posted');
Why you need to launch abc_merge
to article_saved AND article_posted callbacks ?
By default, a Textile parser is launched when you save article. A article_saved
callback replace this default parsing or add a new function after (in this case, Parser is launched 2 times or not ?)
function abc_merge($event, $step, $rs) {
if (!($row = safe_row('Body, Excerpt', 'textpattern', 'ID='.$rs['ID']))) return;
extract($row);
$textile = new \Textpattern\Textile\Parser();
$merged = $textile->textileThis($Body.n.n.'notextile. =========='.n.n.$Excerpt);
list($body_html, $excerpt_html) = doSlash(explode(n.'=========='.n, $merged, 2));
safe_update('textpattern', "Body_html = '$body_html', Excerpt_html = '$excerpt_html'", 'ID = '.$rs['ID']);
}
If I understand your plugin,
- you extract (only if exist) Body and Excerpt from BDD,
- You merge the 2 fields and add between a specifique caracters list (.n.n.‘notextile. ======’.n.n)
- You launch textile parser to the merged result
- you split the result and save to
*_html
column in BDD
I find this very interesting because it’s possible to parse a specifique custom field and save/cache the result in another custom field.
Just for test: Textpattern offers a console.log function debuging for PHP ? Or what is the best way to test/display PHP vars values in browser ?
Offline
Re: 4.6 : Textiled Body & Excerpt are now analyzed separately, I'm sad
Glad it helps.
sacripant wrote #302488:
Just some questions to better understand your code :
Why you need to launch
abc_merge
toarticle_saved
ANDarticle_posted
callbacks ?
Because article_posted
is fired only when you create a new article, and article_saved
when you modify an existing article. In both cases we need to re-textile it.
By default, a Textile parser is launched when you save article. A
article_saved
callback replace this default parsing or add a new function after (in this case, Parser is launched 2 times or not ?)
Yes, twice, unfortunately, each time on the same texts (Body
or Excerpt
). In 4.6 you can(?) replace the default parsing of Body and Excerpt, but only separately.
If I understand your plugin,
- you extract (only if exist) Body and Excerpt from BDD,
- You merge the 2 fields and add between a specifique caracters list (.n.n.‘notextile. ==’.n.n)
- You launch textile parser to the merged result
- you split the result and save to
*_html
column in BDD
5 sur 5 :-) if we add that Excerpt_html
contains now (in your case) the footnotes linked to Body_html
.
Just for test: Textpattern offers a console.log function debuging for PHP ? Or what is the best way to test/display PHP vars values in browser ?
Not that I know. For debugging I merely include dmp($var)
or var_dump($var)
in the code. Sometimes forgetting to remove them afterwards… :-)
Offline
Re: 4.6 : Textiled Body & Excerpt are now analyzed separately, I'm sad
Textpattern offers a console.log function debuging for PHP?
Do you mean this ? I think that’s a js console but I’ve never used it.
Like etc, I tend to stick to dmp ()
for outputting PHP.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: 4.6 : Textiled Body & Excerpt are now analyzed separately, I'm sad
Do you mean this ? I think that’s a js console but I’ve never used it.
It look like a JS console.log with store logs in a history array and only if you are in ‘debug’ status.
I was thinking more of a function that makes a bridge between PHP and JS console like that.
For a beginner as me, it facilitates the understand of a plugin.
Offline