Admun's NUDN


  • San Francisco, CA




7 Wonder(ing)s of FancyURL

I'm chasing after some FancyURL problem that // is appended to the parmalink in some plugins. I was confused to see some plugins need to manually append the blog URL when creating link with createItemLink(), but others is not needed.....

Wondering #1
In globalfunctions.php, I saw this code:

$CONF['ItemURL'] = $CONF['Self'];
function createItemLink($itemid, $extra = '') {
  global $CONF;
  if ($CONF['URLMode'] == 'pathinfo')
    $link = $CONF['ItemURL'] . '/item/' . $itemid;
    $link = $CONF['ItemURL'] . '?itemid=' . $itemid;
  return addLinkParams($link, $extra);
It seem that some plugins need to manually append IndexURL after calling createItemLink(), due to some problem that $CONF['Self'] is empty.

Wondering #2
In createItemLink(), it has the line:
$link = $CONF['ItemURL'] . '/item/' . $itemid;
This suggest ItemURL (which I believed is from $CONF['Self'] in fancyurls.config.php... with $CONF['Self'] in index.php set to "." Why?) should be without a trailing "/". Since the FancyURL link alreasy adding a / in front of item/itemid... True? I think the URL in normal need to to trail with /, even through browser can calm with it.

Wondering #3
In NP_Trackback, I saw this:
// a little hack to get a working permanent URL for the item
if (!$CONF['ItemURL'])
  $CONF['ItemURL'] = $blog->getURL();
$url = createItemLink($itemid);
This seem to fix the problem for plugin that need to add IndexURL in front of $url..... to make wonder #1 working properly.

Wondering #4
All the plugins that is working properly without have to append IndexURL or use the ItemURL hack in Wonder #3 seem to be those with only doSkinVar.... is that CONF['Self'] only function in doSkinVar?

Wondering #5
Given Wonder #1 and #3, should we put the #blog->getURL fix in globalfunctions.php so it's fixed once and for all?

Wondering #6
Is that only me find that there are many places with the Blog's URL too confusing?
  • $CONF['Self'] in index.php
  • $CONF['Self'] in fancyurls.config.php
  • Site URL in global setting
  • (Blog) URL in blog setting
  • Some plugin cans even access $CONF['IndexURL']
Can we simpify this?

Wondering #7
karma, where are you? (seem to be on vacation or something.... offline)

00:46:11 on 07/13/04 by Admun - Category: My Work - tags: none - print


hcgtv wrote:

Maybe karma is following the tour de france?

07/13/04 10:08:21

Admun wrote:

karma's answer can be found here:

07/27/04 12:06:53

Add Comments