August 2, 2012 at 9:36 am #144Daniel MénardMember
I’m testing piklist on a windows 7 dev machine and I found a problem: nothing appears in wp-admin (as if the plugin wasn’t activated).
I traced the problem back to
includes/class-piklist.php:86(PikList::load), the line which initializes the plugin path:
self::$paths['plugin'] = rtrim(substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/includes')), '/');
On windows the directory_separator is backslash. As we’re looking for ‘/includes’, it can’t work.
A simple workaround would be:
… strpos(dirname(__FILE__), DIRECTORY_SEPARATOR. 'includes') …
But thinking again, I think that a simpler line like this would do the job:
self::$paths['plugin'] = dirname(dirname(__FILE__));
(tested on windows and debian, but only with php5.4).
Thanks for this promising framework!
August 2, 2012 at 10:17 am #147Daniel MénardMember
In PikList::render(), you’re testing for an absolute path by checking if the first char is ‘/’ (line 125 in class-piklist.php).
$_file = (substr($view, 0, 1) == '/' ? $view : self::$paths[$_display] . '/parts/' . $view) . (strstr($view, '.php') ? '' : '.php');
It can’t work on windows: an absolute path can be \xxx ou X:\xxx and so on.
I think you need an isAbsolutePath() function like this one which is from symfony: http://svn.symfony-project.com/components/templating/trunk/lib/sfTemplateLoaderFilesystem.php (at the end of file).
The code would become:
$_file = (self::isAbsolutePath($view) ? $view : self::$paths[$_display] . '/parts/' . $view) . (strstr($view, '.php') ? '' : '.php');
With that, it seems that PikList is happy on windows! Didn’t do extensive tests, but I’m able to play with the demos!
Keep on the good work,
August 2, 2012 at 4:25 pm #148
August 3, 2012 at 3:38 pm #151
August 21, 2012 at 10:18 am #160
- You must be logged in to reply to this topic.