- Moderated by:
- Support Team
-
- rank:
-
Professional
- registered:
- August 2002
- Status:
- offline
- last visit:
- 25.11.05
- Posts:
- 994
Theme templates rely on and for everything from images to CSS files. However, these are relative paths. I need them to be absolute paths. Not sure if there are other theme vars I need to be aware of.
This past week I've looked back into PN and ShortURLs, and found it wanting. I've overhauled the output filter and htaccess file and made a complete extensible Core implemetation of ShortURLs in pnModURL allowing for module plugins, and changed a bunch of other files, what I need now is to be able to set these two theme variables to absolute URL paths, eg http://www.site.com/nuke/themes/ rather than just /themes for themepath, in order to be able to use ShortURLs with eg /Calendar/30-04-2005/day or /topic/ArticleXXX/this-is-a-story-title.html
So far it does URLs like /ArticleXXX-this-is-the-story-title.html which suits me and search engines just fine, but it would be preferable to be able to use path separators too. It could be up to the module developer as to the desired URL.
So, I need to know where they're defined, and if there's any conflicts with it being used for Filepaths too, in which case a new var is called for. -
- rank:
-
Professional
- registered:
- September 2003
- Status:
- offline
- last visit:
- 21.10.07
- Posts:
- 2423
those paths are defined in the theme.php
// get the theme name from the file system
$thename = basename(dirname(__FILE__));
// set the theme path
$themepath = 'themes/'.$thename;
// set the image path
$imagepath = $themepath.'/images';
..hope I read all that right and that's what you need ;)
--
http://www.invalidresponse.com -
- rank:
-
Professional
- registered:
- August 2002
- Status:
- offline
- last visit:
- 25.11.05
- Posts:
- 994
Thanks, Invalid, simpler than I thought. Well, almost. Was looking in Xanthia, which also has $themepath vars in several places. I just thought I'd defer to the core developers before going to bed for some much-needed sleep. Hopefully Mark is around.
Initial test in changing it wasn't reflected in the theme, though. I changed
$themepath = (pnModGetVar('Xanthia', 'shorturls') ? pnGetBaseURL() : '').'themes/'.$thename;
in the current theme. I've got no caching, force recompile and no DB store set.
But I'm awake now, and further digging has brought up a discrepancy, which may have an explanation.
Although the above is executed every time, it doesn't appear to be ctually used. The answer is in Xanthia. If I make the following change in Xanthia's core class, it all works:
modules/Xanthia/pnclasses/Xanthia.php line 689:
Code
if (!(empty($cWhereIsPerso))) {
$this->themepath = (pnModGetVar('Xanthia', 'shorturls') ? pnGetBaseURL() : '').$cWhereIsPerso . 'themes/'.$this->thename;
} else {
$this->themepath = (pnModGetVar('Xanthia', 'shorturls') ? pnGetBaseURL() : '').'themes/'.$this->thename;
}
The vars are initialised further down:
Code
// Define some helpful paths and holder tags
$this->DTS_attrib = array('themepath' => $this->skinspath, // the skins path (themes/$skinName)
'imagepath' => $this->imagepath); // image path ($themepath/images)
So, what's with the misdirection in theme.php? Legacy being phased out? Else the Xanthia class would've checked this theme var, surely. Or has it already been changed in the CVS, perhaps?
Well, the change above doesn't seem to have broken anything, and in fact everything now works as desired. I can produce any shortURL I like, for instance
/[category]/ArticleXXX-title-of-story.html
or maybe
/[category]/[Topic]/ArticleXXX-title-of-story.html
The separtion of Category and Topic is a little confused in PN, I understand it as Topics being subcategories of Category.
I'll do some cleanup, write a ReadMe, package and upload for people to discuss.
Martin
