开发者

Unable to load "sfFacebookConnectHelper.php" helper

开发者 https://www.devze.com 2023-01-28 14:03 出处:网络
im trying to build FB application demo with sfFacebookConnectPlugin by this tutorial and i have trivial problem, but still cannot fix it (iam symfony novice using 1.4).

im trying to build FB application demo with sfFacebookConnectPlugin by this tutorial and i have trivial problem, but still cannot fix it (iam symfony novice using 1.4). I have installed this plugins by terminal commands:

  • sfDoctrineGuardPlugin
  • sfFacebookConnectPlugin

I have them activated in:

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
      if (function_exists('date_default_timezone_set')) {
        date_default_timezone_set(@date_default_timezone_get());
      }
    $this->enablePlugins('sfDoctrinePlugin');
    $this->enablePlugins('sfBehatPlugin');
    $this->enablePlugins('sfDoctrineGuardPlugin');
    $this->enablePlugins('sfFacebookConnectPlugin');
  }
}

But When iam using in my layout:

<?php use_helper('sfFacebookConnect')?>

Im getting this error:

Unable to load "sfFacebookConne开发者_如何学运维ctHelper.php" helper
in: SF_ROOT_DIR/apps/frontend/modules/main/lib/helper,
SF_ROOT_DIR/apps/frontend/lib/helper,
SF_ROOT_DIR/lib/helper,
SF_SYMFONY_LIB_DIR/helper.

While The helper is present in /home/palmic/www/behattest/plugins/lib/helper/sfFacebookConnectHelper.php

How to tell symfony to load it from there?

Thanx!


As a temporary fix (until the developers who wrote the plugin move their helper), you can create your own sfFacebookConnectHelper file in SF_ROOT_DIR/lib/helper that contains the following code:

<?php
require_once dirname(__FILE__) . '/../../plugins/sfFacebookConnectPlugin/lib/sfFacebookConnectHelper.php';

That path might be wrong, so just point it to wherever their helper is.

Then you can still use <?php use_helper('sfFacebookConnect')?> in your code, and when the real helper gets moved to the correct folder, just delete this file.

Also, a small tip. Instead of calling $this->enablePlugins() repeatedly in your ProjectConfiguration file, you can do this:

$this->enablePlugins(array(
  'sfDoctrinePlugin',
  'sfBehatPlugin',
  'sfDoctrineGuardPlugin',
  'sfFacebookConnectPlugin'
));


The problem was in plugin itself, helpers and other lib classes has to be in plugins/<plugin-name>/lib directory so that plugin helpers has to be in:

plugins/<plugin-name>/lib/helper

not in plugins/lib.

0

精彩评论

暂无评论...
验证码 换一张
取 消