nlybe / elgg-news
管理员、新闻人员和群组所有者发布的新闻和公告
5.24.4
2024-05-10 10:03 UTC
Requires
- composer/installers: >=1.0.8
Conflicts
- elgg/elgg: <5.0
README
管理员、群组所有者或新闻人员发布新闻和公告的 Elgg 插件。
功能
此插件为管理员提供以下选项
- 发布新闻条目
- 将其他 Elgg 实体作为新闻条目添加
- 可定制的新闻列表视图
- 选择更多可以发布新闻/公告的用户
- 允许群组所有者仅在群组内发布新闻/公告
- 在设置中更改默认新闻图标
- 允许或不允许工作人员设置/取消设置新闻为特色
- 在侧边栏显示特色新闻
例如,"将其他 Elgg 实体作为新闻条目添加"的功能,如果有用户发布的博客文章,管理员可以将此文章添加为新闻。因此,它将在新闻列表中显示,但如果用户点击此项目,将重定向到原始博客文章。同样的操作可以应用于任何帖子,如页面、书签、视频等。
管理员还可以允许群组所有者在群组内部发布新的/公告。
概述权限,以下选项可用
谁可以发布网站新闻
- 管理员
- 新闻人员(如果设置中启用)
谁可以设置/取消设置网站新闻为特色
- 管理员
- 新闻人员(如果设置中启用)
谁可以发布群组新闻(如果设置中启用)
- 管理员
- 群组所有者/管理员
谁可以设置/取消设置群组新闻为特色(如果设置中启用)
- 管理员
- 群组所有者/管理员
如何使用可定制的新闻列表视图
如果需要为新闻列表使用不同的视图,例如在自定义首页上,可以使用以下代码
echo elgg_view('elgg-news/custom_list_view', [ 'entities' => $entities, // list of news entities, previously retrieved 'read_more' => true, // set true if want to add a "Read more" link for each news item 'item_class' => '', // set a custom class on news items, so it could be customized through CSS 'photo_size' => 'custom', // set the size of the news photo, see more details below 'photo_cover' => false, // set true if want to use the news as cover image, otherwise it will be displayed inline with title and intro 'photo_class' => '', // set a custom class on news photo ]);
您可以在 elgg-news/views/default/resources/elgg-news/custom_list_view.php 中查看如何使用此视图的示例。此示例视图将在 http://www.YOURCOMMUNITYURL.com/news/custom_list 可用。
特别关于照片大小,您可以使用以下任何预定义照片大小
elgg_set_config('elggnews_photo_sizes', [ 'topbar' => ['w' => 16, 'h' => 16, 'square' => true, 'upscale' => false], 'tiny' => ['w' => 25, 'h' => 25, 'square' => true, 'upscale' => false], 'small' => ['w' => 40, 'h' => 40, 'square' => true, 'upscale' => false], 'medium' => ['w' => 100, 'h' => 100, 'square' => true, 'upscale' => false], 'large' => ['w' => 200, 'h' => 200, 'square' => true, 'upscale' => false], 'master' => ['w' => 2048, 'h' => 2048, 'square' => false, 'upscale' => false], ]);
或者,您可以在插件设置中设置自定义照片大小(宽度和高度),因此对于每个新闻条目上的照片上传,它也将保存为该大小。
如何更改默认图标
网站管理员可以在插件设置中选择用于默认新闻图标的图标。
如果需要添加自定义图标,只需将其上传到 mod/elgg-news/graphics/icons 文件夹中即可。所有文件上传都将可在插件设置中选择。