Viewing 1 reply thread
  • Author
    Posts
    • #1282
      Marcus
      Member

      I don’t know if anyone else has had this problem, but I thought I’d post a solution.

      It’s not pretty but it works.

      In class-piklist-theme.php it checks to see if there is a theme with a folder of piklist inside it.
      If so, it creates a class variable:
      self::$paths['theme']

      In class-piklist.php it checks for that theme variable, and if it finds it, sets up the files to be loaded for any (file/fields/meta-boxes) stored in that path.

      The problem is, the $_part variable (the actual file) (which sits on line 165 and 168 of class-piklist.php) that piklist will append to the self::$paths[‘theme’] variable has a path thats all screwed up. (including adding a double ‘/piklist’ path to the beginning)

      This is probably because my localhost site is kept on dropbox and I use a symbolic link to the dropbox folder. (checking the paths throughout piklist showed that there were often two folder paths to a file. The hardlink (c:\html\blahblabh) and the symlink (c:/html/dropbox)

      So to fix this problem, and I hope this helps someone else, even if its only Kevin, <grin> I did the following:
      On line 175 of class-piklist.php I changed it from:

            if (isset(self::$paths['theme']))
            {
              if (file_exists(self::$paths['theme'] . $_part))
              {
                $_file = self::$paths['theme'] . $_part;
              }
            }
      

      to:

            if (isset(self::$paths['theme']))
            {
              $together = (stristr($_part, ':\\') || stristr($_part, ':/') )?$_part:str_replace('/piklist','',self::$paths['theme']) . $_part;
              if (file_exists($together))
              {
                $_file = $together;
              }
            }
      

      This allows me to keep all my piklist meta-boxes (and other piklist files) in my themes directory while still using dropbox and symlinks.

      Marcus

    • #1284
      Marcus
      Member

      Whoops.
      Forgot to add something to the replace:

      str_replace('/piklist','',self::$paths['theme'])

      Should read:

      str_replace('/piklist','/',self::$paths['theme'])

      Missed the ‘/’ from the str_replace

      Marcus

Viewing 1 reply thread
  • You must be logged in to reply to this topic.