Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2020-06-02 18:14:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,434
Website GitHub

Re: Feedback to: Textpattern CMS 4.8.1 Released

etc wrote #323507:

What a buffoon I am!

Haha! Don’t worry about it, and thanks for fixing it. My fault for mentioning the feature and not testing it thoroughly enough.

There’s a workaround for now, but we could squeeze 4.8.2 out in a week or two to patch this and anything else we spot. Won’t affect 4.9 work as that’s got its own branch (dev).

EDIT: though, annoyingly, when merging from 4.8.2 to dev, it pulls the version numbers from 4.8.2 and overwrites the dev ones. So with each merge we need to manually readjust textpattern/textpattern.js, textpattern/index.php and package.json. No biggie. Just something to be aware of. Quite why git thinks 4.9.0 is greater than 4.8.2 and splats the higher values instead of creating merge conflicts or figuring it out, I’m not sure. Maybe it’s a bug and I need to upgrade my local git environment. I’m running 2.8.1, which is way out of date.

Last edited by Bloke (2020-06-02 18:48:56)


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

#14 2020-06-23 10:22:02

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: Feedback to: Textpattern CMS 4.8.1 Released

Updated three sites from 4.8.0 to 4.8.1 without any problem yet.

PHP version: 7.3.19-1+0~20200612.60+debian8~1.gbp6c8fe1
GD Graphics Library: 2.2.5; Supported formats: GIF, JPEG, PNG, WebP.
MySQL: 5.5.5-10.2.32-MariaDB-10.2.32+maria~jessie-log
Web server: nginx/1.16.1

Offline

#15 2020-06-23 10:25:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,434
Website GitHub

Re: Feedback to: Textpattern CMS 4.8.1 Released

Brilliant, thanks @whocarez.

4.8.2 is shaping up nicely for imminent release too. Just mops up a few little issues we discovered, tweaks a couple of tags and enhances some stuff for a smoother ride with international users (see forum.textpattern.com/viewtopic.php?id=50806).


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

#16 2020-06-23 15:34:53

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: Feedback to: Textpattern CMS 4.8.1 Released

Updated the fourth site, which uses the tru_tags plugin and the problem described here is IMHO solved.

But I recognized another problem.

I used to build my own hover title for article lists with the following line:

<txp:php>echo htmlspecialchars_decode(html_entity_decode(trim(strip_tags(category1(array('title'=>'1')) . ": " . title(array("no_widow"=>"0")) . " - " . excerpt())), ENT_HTML5));</txp:php>

Somehow category1 is not usable. I got an "Call to undefined function category1" error.

If I use category1 directly, I’ll get at least one category with "&amp;" in hover title and that’s not really beautiful.

Last edited by whocarez (2020-06-23 15:42:35)

Offline

#17 2020-06-23 15:59:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,434
Website GitHub

Re: Feedback to: Textpattern CMS 4.8.1 Released

whocarez wrote #323947:

category1 is not usable. I got an "Call to undefined function category1" error.

Yes, that function is no more, and this unfortunately highlights the dangers of relying on PHP function calls as we gradually move away from a function-based to OO core.

The slightly more future-proof way of doing it (assuming we keep parse() around!) is:

<txp:php>
echo htmlspecialchars_decode(
    html_entity_decode(
        trim(
            strip_tags(
                parse('<txp:category1 title />: <txp:title no_widow="0" />  - <txp:excerpt />')
            ))
    , ENT_HTML5)
);
</txp:php>

or even (untested) since we have escape attributes that can do strip_tags() and trim():

<txp:php>
echo htmlspecialchars_decode(
    html_entity_decode(
        parse('<txp:category1 title escape="tidy,tags" />: <txp:title no_widow="0"  escape="tidy,tags" />  - <txp:excerpt escape="tidy,tags" />')
    , ENT_HTML5)
);
</txp: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

#18 2020-06-23 16:08:02

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: Feedback to: Textpattern CMS 4.8.1 Released

Thanks for your quick response. Both variants are working. So I have to go through the old code and “modernize” direct php calls.

Offline

#19 2020-06-23 16:22:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,434
Website GitHub

Re: Feedback to: Textpattern CMS 4.8.1 Released

whocarez wrote #323949:

So I have to go through the old code and “modernize” direct php calls.

Yes, unfortunately. General rule of thumb is that if you’re using any Txp public tags as function calls, replace them with a call to parse() and pass a string of actual tags into it.

Another option, which is even more future proof might be to create a shortcode:

  1. (optional) Register a new Form type called something like ‘shortcode’ so you can collect all of the codes together in your own group.
  2. Write your tag template / HTML / PHP code in a Form. Name it (e.g. ‘hover’).
    1. Use <txp:yield name="some_att" default="default value" /> to get access to attributes passed into the shortcode.
    2. Use <txp:yield /> to get access to the container (note: you’ll need 4.8.2 for this as there’s a bug in 4.8.1 related to this).
    3. Use <txp:yield else /> to get access to the ‘false’ part of any container tag.
  3. In your article or template code, call your new function: <txp::hover />. Note the double colon. If you elected to use attributes, pass them in too: <txp::hover some_att="my value" />.

Thus, any time you need to make such a change in future or want to expand the scope of your function, you can just do it once in your shortcode.

P.S. smd_where_used might be able to help you find all instances of where you’ve used your code :)

Last edited by Bloke (2020-06-23 16:25:56)


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

#20 2020-06-24 09:29:27

etc
Developer
Registered: 2010-11-11
Posts: 5,153
Website GitHub

Re: Feedback to: Textpattern CMS 4.8.1 Released

whocarez wrote #323947:

Somehow category1 is not usable. I got an "Call to undefined function category1" error.

You also should be able to replace category1(...) with

Txp::get('\Textpattern\Tag\Registry')->process('category1', ...)

Offline

#21 2020-07-03 16:48:03

DragonBard
Member
Registered: 2014-07-01
Posts: 16

Re: Feedback to: Textpattern CMS 4.8.1 Released

I’m seeing some odd issues around front end Themes. I recently updated to 4.8.1, and sorry to say, I don’t remember which version I was on previously (definitely a 4.x release, as it was probably two years or so old).

I created a new, empty theme (named Empty), along with my previous theme (named Default). Often when attempting to switch between forms and pages with identical names in the two themes, I end up in the wrong Theme. When I switch back to the correct theme, I end up on a different form or page from the one I selected. This repeats quite often.

I did a quick look in the GitHub issues list, but didn’t see anything.

Thanks.

Offline

#22 2020-07-03 17:00:01

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,434
Website GitHub

Re: Feedback to: Textpattern CMS 4.8.1 Released

Sorry if you’re having trouble with it. A quick explanation:

When editing a Form/Page/Style, the selector above the list of assets indicates which Theme you’re using. Txp will try and remember the last Page/Form/Style that you saved. If you switch theme using the selector then it’ll ‘jump’ to the last saved asset of that type. (if it can and it has the same name as one you last saved).

If that’s the not behaviour you’re experiencing, there maybe some odd caching going on. If so, please would you let us have your Diagnostics info and we’ll look into it.


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

#23 2020-07-03 17:07:07

DragonBard
Member
Registered: 2014-07-01
Posts: 16

Re: Feedback to: Textpattern CMS 4.8.1 Released

Bloke wrote #324247:

Sorry if you’re having trouble with it. A quick explanation:

When editing a Form/Page/Style, the selector above the list of assets indicates which Theme you’re using. Txp will try and remember the last Page/Form/Style that you saved. If you switch theme using the selector then it’ll ‘jump’ to the last saved asset of that type. (if it can and it has the same name as one you last saved).

Okay, the above explains some of what is going on, but what I am seeing is not using the Theme selector, but simply switching between the forms within a theme, I will end up switching Themes, rather than the Form.

For example, I was on Empty theme, looking at the article default form. Then I clicked on the Comments comments form, and instead of seeing the Empty version, I now see the Default theme version.

Offline

#24 2020-07-03 17:46:46

DragonBard
Member
Registered: 2014-07-01
Posts: 16

Re: Feedback to: Textpattern CMS 4.8.1 Released

Okay, this happens if I am trying to compare the content between two different versions of the same form. It flips back to the last form viewed in the other theme, then when I click on the form I wanted, it again flips back to the last version viewed in the other theme. I’d prefer for the view to stay locked to the selected theme in the Theme drop down. Right now it is near impossible for me to compare the contents of two forms between the themes.

Thanks.

Offline

Board footer

Powered by FluxBB