Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-06-28 13:07:26

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

[solved] txp 4.7.1: safe_count no longer works

The code used to return the number of links under the contributors link category but since the upgrade, no number is returned. Does anyone have any advice on what the new php should be?

<txp:php>echo safe_count('txp_link', "category = 'contributors'");</txp:php>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2018-06-28 14:19:45

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

Re: [solved] txp 4.7.1: safe_count no longer works

Hi Yiannis, any complains in debug mode? Where and how do you use this code?

Offline

#3 2018-06-28 14:54:13

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: [solved] txp 4.7.1: safe_count no longer works

Using colak’s code in an article, with a link category contributors, I get this in debug mode:

Parse error: syntax error, unexpected '=', expecting ',' or ')' in /var/www/vhosts/textpattern.co/release-demo/live/textpattern/publish/taghandlers.php(4248) : eval()'d code on line 1

…and nothing else.

Edit: I had Textile enabled. Mea culpa.

Last edited by gaekwad (2018-06-28 15:01:35)

Offline

#4 2018-06-28 14:59:30

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

Re: [solved] txp 4.7.1: safe_count no longer works

I get a plain zero as expected. Unless the code is textiled, perhaps?

Offline

#5 2018-06-28 15:01:03

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: [solved] txp 4.7.1: safe_count no longer works

Actually, I have Textile enabled. Please ignore p312749 – the office is hot today and my brain isn’t working!

Offline

#6 2018-06-28 15:58:00

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: [solved] txp 4.7.1: safe_count no longer works

It is in a page not in an article. github.com/colak/neme/blob/master/pages/default.tpl#L683

> Edit solved… It’s a good thing I have backups on github:)

Last edited by colak (2018-06-28 16:02:27)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB