Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-06-20 17:31:41

monkeyninja
Plugin Author
From: Sheffield, UK
Registered: 2008-10-14
Posts: 239
Website

Is there a variable for the 'textpattern' directory?

I know that some people like to rename their textpattern directory to something else. Is this path obtainable via a variable or function call built into Textpattern itself like the site URL, hu? I ask as I am needing to build URLs in the form: hu.'textpattern/index.php?event='.$event.'&step='.$step; and would like to properly handle the Textpattern directory in that too.

If anyone is aware of a nice tidy way of doing this already in Textpattern I’d like to know as I really don’t like re-inventing the wheel!

If this currently isn’t possible perhaps it is something that should get built in to Textpattern in the future maybe?

Offline

#2 2010-06-20 18:48:38

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

Re: Is there a variable for the 'textpattern' directory?

monkeyninja wrote:

I ask as I am needing to build URLs in the form: hu.'textpattern/index.php?event='.$event.'&step='.$step; and would like to properly handle the Textpattern directory in that too.

I expect you are linking to the admin panel from outside the admin panel. Within the admin panel you can use ?event='.$event.'&step='.$step.

I know that some people like to rename their textpattern directory to something else. Is this path obtainable via a variable or function call built into Textpattern itself like the site URL, hu?

Not really. The directory is directly added to txpath and it shouldn’t be changed at all. You can get the location inside the filesystem which isn’t always what you want as the URI can be different, also remember multisite functionality.

So, no there isn’t a global nor constant that stores the actual URI location of the admin panel, just file system locations.

Tho, you could store the request uri of the admin panel (or something like that), or make the location configurable so those that have modified the core could change the path to match theirs.

Eitherway, those that have changed the path, are running modified version of TXP. Supporting something that is hacked is hard.

If this currently isn’t possible perhaps it is something that should get built in to Textpattern in the future maybe?

Hopefully, but in my books that would be requirement only when/if TXP gets official feature that allows the re-naming.

Offline

#3 2010-06-21 05:48:13

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Is there a variable for the 'textpattern' directory?

Eitherway, those that have changed the path, are running modified version of TXP. Supporting something that is hacked is hard.

I think Andy is referring to those of us who have multi-sites setup on their servers (like me). By default /textpattern becomes /admin and breaks some plugins which may have /textpattern hardcoded.

This really does need to be resolved otherwise multi-site as a feature is rather devalued.

Offline

#4 2010-06-21 08:21:38

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

Re: Is there a variable for the 'textpattern' directory?

Well there’s txpath, etc…

Scratch all my crap I wrote. That’s for the admin side file paths not URL from the public side. Erm, short answer is I don’t know if there’s a publicly accessible dir or constant that’s available. If there isn’t one and it’s possible to add, you’re right there should be.

Last edited by Bloke (2010-06-21 08:29:37)


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

#5 2010-06-21 08:32:38

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

Re: Is there a variable for the 'textpattern' directory?

One thought / workaround: why are you building fully qualified URLs? Can you not just do:

/index.php?event='.$event.'&step='.$step;

or, depending on if you’re referring to the same page, you might even be able to get away with:

?event='.$event.'&step='.$step;

which should take care of the rest of the URL for you.


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

#6 2010-06-21 08:41:45

monkeyninja
Plugin Author
From: Sheffield, UK
Registered: 2008-10-14
Posts: 239
Website

Re: Is there a variable for the 'textpattern' directory?

Bloke wrote:

One thought / workaround: why are you building fully qualified URLs?

I’m building the full URL to communicate with Twitter as part of the OAuth process. When initiating a connection with Twitter a user is temporarily taken away from Textpattern to Twitter who require a callback URL to return the user to their site. (This is basically in relation to my arc_twitter plugin.)

I’m sure there are workarounds, but a clean TXP approach would be nice. I much prefer to make use of what TXP already has on offer than doing it independently.

Offline

#7 2010-06-21 08:50:40

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

Re: Is there a variable for the 'textpattern' directory?

monkeyninja wrote:

I’m building the full URL to communicate with Twitter as part of the OAuth process.

Makes sense. In which case, a TXP solution is what you need. Hmmmmmmmm. I wonder if Sam, wet or someone else might have a better grasp on this part of the core than I have?


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

#8 2010-06-21 18:52:50

artagesw
Member
From: Seattle, WA
Registered: 2007-04-29
Posts: 227
Website

Re: Is there a variable for the 'textpattern' directory?

Seems like something the installer could do. Since the installer knows its own URL, it could add it to the list of config file entries or write it to the txp_prefs table.

Offline

#9 2010-06-23 19:29:41

monkeyninja
Plugin Author
From: Sheffield, UK
Registered: 2008-10-14
Posts: 239
Website

Re: Is there a variable for the 'textpattern' directory?

Bloke wrote:

Makes sense. In which case, a TXP solution is what you need. Hmmmmmmmm. I wonder if Sam, wet or someone else might have a better grasp on this part of the core than I have?

Considering the rise in the use of services like Twitter and Facebook, being able to build a correct full url to the TXP admin would be a very handy addition. As artagesw says it would make sense to have it stored in the txp_prefs table and added to the table at setup.

Offline

Board footer

Powered by FluxBB