Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-11-30 01:46:02

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

$c versus $thispage['c'] in different Txp versions

A few months ago, I made some updates to another person’s rss_unlimited_categories mod and posted a download link to the updated mod on the plugin’s forum thread. The mod worked fine for me on a site running 4.0.5, but someone recently posted that they were having problems with it in 4.0.4.

The solution that made it work for them was switching out $thispage['c'] for $c. As I remember (and I don’t remember all that well), switching from $c to $thispage['c'] was part of what made it start working for me in 4.0.5. Could a plugin developer with more experience than me shed any light on this discrepancy? Thanks.

Offline

#2 2007-11-30 02:33:43

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: $c versus $thispage['c'] in different Txp versions

Well, it’s partly deprecated. Most sources as this at focusontheclouds.com are quite old and tell old tips. Firstly, those $c, $s, $id are quite old – as are those tags that call them <txp:c /> in example.

Partly there is also $thispage['c'] and $pretext['c'] – mostly non working in some cases. There is also and that what becomes to the $c, it could also be $category. One that will in any cases work is category() – it does all there work for you and returns the current category. Love them, those functions.

Answer is: look at Textpattern’s source-files: taghandlers.php etc – they tell what to do – what is right or not :)

Cheers!

Offline

#3 2007-11-30 05:05:50

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: $c versus $thispage['c'] in different Txp versions

That’s good info, thanks!

I’m considering buying Textpattern Solutions to get a comprehensive reference for useful functions and variables; I assume it’s up to date with the latest version on such things?

Offline

#4 2007-11-30 07:45:58

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: $c versus $thispage['c'] in different Txp versions

$pretext['c'] and $c are the same thing. Both are used in taghandles.php and as far as I know neither is deprecated. $thispage['c'] works only if you’re in a paginated article list.

Offline

#5 2007-11-30 16:56:14

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: $c versus $thispage['c'] in different Txp versions

I’m considering buying Textpattern Solutions to get a comprehensive reference for useful functions and variables; I assume it’s up to date with the latest version on such things?

Still, source files are the greatest and always up-to-date :)

Offline

#6 2007-11-30 18:34:11

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: $c versus $thispage['c'] in different Txp versions

ruud wrote:

$pretext['c'] and $c are the same thing. Both are used in taghandles.php and as far as I know neither is deprecated. $thispage['c'] works only if you’re in a paginated article list.

That’s good to know, and probably has something to do with the problems that were reported. Thanks. :-)

Gocom wrote

Still, source files are the greatest and always up-to-date :)

True enough, but if you’re not already familiar with the source it can be a time-consuming way to figure things out.

Offline

#7 2007-12-03 12:47:26

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: $c versus $thispage['c'] in different Txp versions

I’ve updated the rss_unlimited_categories_list activeclass patch to fix the problem. Thanks for your help, everyone. :-)

Download it here.

Offline

Board footer

Powered by FluxBB