【问题标题】:Get Photo of the object in widget - SocialEngine Widget获取小部件中对象的照片 - SocialEngine 小部件
【发布时间】:2018-04-08 15:14:54
【问题描述】:

我是 SocialEngine 的初学者,我想知道是否有任何方法可以在小部件中获取对象的照片。 就像我知道我们可以使用以下代码获取对象的照片。

//在控制器中

$table  = Engine_Api::_()->getDbTable("mytable","module");
$select = $table->select()->where->("table_id", 1);
$fetch  = $table->fetchRow($select);
$this->view->fetch = $fetch;

//在视图中

echo $this->itemPhoto($this->fetch, "thumb.normal"); 

如果有任何图像,上面的行将生成图像,否则将加载默认图像。

但这行代码在小部件中不起作用。 我真的很感谢你的帮助。

【问题讨论】:

    标签: php widget socialengine


    【解决方案1】:

    您需要确保传递给$this->itemPhoto 的第一个参数是User 实例: $this->itemPhoto($user, 'thumb.normal', $user->getTitle())

    似乎在您的情况下 $this->fetch 只是一个Row。您可以使用以下代码创建用户:Engine_Api::_()->getItem('user', $user_id);。希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-20
      • 1970-01-01
      • 2018-02-14
      • 2022-09-22
      • 2011-12-30
      • 1970-01-01
      相关资源
      最近更新 更多