Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-12 08:54:28

schmappel
New Member
Registered: 2006-01-12
Posts: 2

'hu' prefix

Please excuse me if this has been covered elsewhere already. I have searched the FAQs and forum, but nothing turned up. I don’t use Textpattern, just classTextile.php. Excellent syntax and midway solution btw, thanks for making it GPL! My question is this: when typing urls or creating images, why does the script prefix it with ‘hu’? I have not a clue as to why this would even be remotely useful in any case :)

The function in question:

function relURL($url)
{
$parts = parse_url($url);
if ((empty($parts['scheme']) or $parts[‘scheme’] == ‘http’) and@
empty($parts['host']) and
preg_match('/^\w/', $parts[‘path’]))@
$url = hu.$url;
return $url;
}

Of course I could just as easily remove the ‘hu.’ part (or the full ‘if’ condition for that matter), but i would like to understand what it does and why it’s there in the first place. Must be some reason for it if it’s there, right?

In my case the problem appears when I’m trying to create a relative image link:
! images/file.png !

I need it to be a relative link since I’m on a development server now and i don’t like having to change all the links when the site moves to a production server.

Thanks!

Last edited by schmappel (2006-01-12 09:04:12)

Offline

#2 2006-01-12 09:04:17

Sencer
Developer emeritus
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: 'hu' prefix

That is textpattern-specfic code. hu is the constant that usually contains the site-url (domain+subdirectory). We use it so that when people use relative urls in textpattern, we can give them the correct path (given that with clean urls, the paths are often different).

In a non-Textpattern environment there’s probably little use for it.

(When PHP sees that hu is not a defined constant, it probably converts it into a string and prepends that.)

Offline

#3 2006-01-12 09:11:26

schmappel
New Member
Registered: 2006-01-12
Posts: 2

Re: 'hu' prefix

Thank you, Sencer, for the fast reply! In that case, why not publish a stand-alone, cleaned up version of the Textile class? It’s likely that more people use only the class and run into this problem, right? Or am I overlooking something?

Offline

#4 2006-01-12 09:44:17

Sencer
Developer emeritus
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: 'hu' prefix

I’ll see that we can get this cleaned up, so in cases where hu is undefined, we’ll revert to the old behaviour. Releasing and maintaining it seperately is quite some work, I think we’d rather try to avoid this, if possible.

Offline

Board footer

Powered by FluxBB