regionhalland / region-halland-plugin-tree-first-level-category
前端插件,用于返回类别的一级
v1.0.0
2020-05-28 09:46 UTC
This package is auto-updated.
Last update: 2024-09-28 19:58:08 UTC
README
如何使用Region Halland的插件"RhTreeFirstLevelCategory"
以下是使用插件"RhTreeFirstLevelCategory"的说明。
使用范围
此插件创建一个数组(),包含所有父类别为0的页面
许可证模型
此插件使用许可证模型GPL-3.0。您可以通过随附的文件了解更多关于此许可证模型的信息
LICENSE (https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhTreeFirstLevelCategory?path=%2FLICENSE&version=GBmaster)
安装和激活
A) Hämta pluginen via Git eller läs in det med Composer
B) Installera Region Hallands plugin i Wordpress plugin folder
C) Aktivera pluginet inifrån Wordpress admin
通过Git获取插件
git clone https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhTreeFirstLevelCategory
通过composer导入插件
这两个部分需要添加到您的composer文件中
Repositories = 插件存储的位置,在本例中为github
"repositories": [
{
"type": "vcs",
"url": "https://regionhalland.visualstudio.com/public.RhWpPlugIns/_git/RhTreeFirstLevelCategory"
},
],
Require = 指定您要使用的插件版本,在本例中为1.0.0
注意!请确保您获取的是最新版本。
"require": {
"regionhalland/region-halland-tree-first-level-category": "1.0.0"
},
通过"Blade"循环"页面"
@php($myMenu = get_region_halland_tree_first_level_category())
@if ($myMenu['antal'] != 0)
@foreach ($myMenu['pages'] as $page)
@if($page['is_active'] == 1)
<div>
<a href="{!! $page['category_url'] !!}">{!! $page['name'] !!}</a>
</div>
@else
<div>
<a href="{!! $page['category_url'] !!}">{!! $page['name'] !!}</a>
</div>
@endif
@endforeach
@endif
数组可能的外观示例
uploads\cache\af77d7ce71929c2334c8080596ee3d744c0da7cd.php:2:
array (size=2)
'antal' => int 6
'pages' =>
array (size=6)
0 =>
array (size=4)
'ID' => string '1' (length=1)
'name' => string 'Kategori 1' (length=10)
'category_url' => string 'http://dev-intra.local/category/kategori-1/' (length=43)
'is_active' => int 0
1 =>
array (size=4)
'ID' => string '3' (length=1)
'name' => string 'Kategori 2' (length=10)
'category_url' => string 'http://dev-intra.local/category/kategori-2/' (length=43)
'is_active' => int 0
2 =>
array (size=4)
'ID' => string '5' (length=1)
'name' => string 'Kategori 3' (length=10)
'category_url' => string 'http://dev-intra.local/category/kategori-3/' (length=43)
'is_active' => int 0
3 =>
array (size=4)
'ID' => string '6' (length=1)
'name' => string 'Kategori 4' (length=10)
'category_url' => string 'http://dev-intra.local/category/kategori-4/' (length=43)
'is_active' => int 0
4 =>
array (size=4)
'ID' => string '7' (length=1)
'name' => string 'Kategori 5' (length=10)
'category_url' => string 'http://dev-intra.local/category/kategori-5/' (length=43)
'is_active' => int 0
5 =>
array (size=4)
'ID' => string '8' (length=1)
'name' => string 'Kategori 6' (length=10)
'category_url' => string 'http://dev-intra.local/category/kategori-6/' (length=4
版本历史
1.0.0
- 第一个版本