外贸易

当前位置:首页 > 后端 > 外贸易

外贸易-3.3调用标签

{{ inject('setting')->config('logoes') }} // logo图 {{ inject('s...
{{ inject('setting')->config('logoes') }}                                               // logo图
{{ inject('setting')->langs('web', 'product-center') }}                                 // 模板语言包
{{ inject('setting')->langs('system', 'liaojie') }}                                     // 系统语言包
<img src="{{ themePath('images/image_1665369563_HOME_04.jpg') }}" />                    // 单图
{{ $cate->description->cname }}    ->description                                        // 对应语言
{{ $value->created_at->format('F d,Y') }}at{{ $value->created_at->format('h:i a') }}    //默认的日期格式化



<!-- 搜索 -->
<form action="{{ url('search') }}" method="GET" class="d-flex">
    <input type="text" name="keyword" placeholder="Search..." required="">
    <button type="submit"><i class="fa fa-search"></i></button>
</form>



<!-- 常用js -->

@if ( $key === 0)
@else
@endif

@for($i = 2; $i <= 12; $i++)
    {{ $i }}<br>
@endfor


 <!-- 外贸导航高亮  -->
 <script>
var pathName = window.location.pathname;
    $('.wmy-menu a').each(function(){
        var curHref = $(this).attr('href');
        // 判断 基本
        if(curHref == pathName || curHref == (pathName+'/')) {
            $(this).parents('li').addClass('cur')
        }
        // 判断 详情
        if(curHref.length > 1 && pathName.indexOf(curHref) !== -1) {
            $(this).parents('li').addClass('cur');
        }
    });
</script>


<!-- 可视化标签 -->
{{ inject('visual')->url('block', 'sycp') }}                    // 说明页
{{ inject('visual')->url('ad', 1) }}                            // 广告图
{{ inject('visual')->url('nav') }}                              // 导航
{{ inject('visual')->url('product-cate') }}                     // 产品分类
{{ inject('visual')->url('news-cate') }}                        // 新闻分类
{{ inject('visual')->url('product') }}                          // 产品
{{ inject('visual')->url('news') }}                             // 新闻



<!-- 友情链接 -->
<!-- link  0 所有,1 文字,2图片 -->
<div>  
    @foreach (inject('list')->link(0) as $key => $value) 
    <li>
        <a href="{{ $value->url }}">                                        // 链接
        <div class="img"><img src=" {{ $value->img }}" alt=""></div>        // 图片
        <h2>{{ $value->title }}</h2>                                        // 名称
        <h3>{!! $value->content !!}</h3>                                    // 备注
        </a>
    </li>
    @endforeach
</div>




<!-- 说明页调用 -->
<div class="bb1bt" {{ inject('visual')->url('block', 'sycp') }}>                     // 可视化

    <img src="{!! inject('block')->block('gywm', 'imgs', 0) !!}" alt="">             // 多图
    <h2> {!! inject('block')->block('sycp', 'title') !!} </h2>                       // 标题
    <h3> {!! inject('block')->block('sycp', 'extend') !!} </h3>                      // 摘要
    <h4> {!! inject('block')->block('sycp', 'content') !!} </h4>                     // 内容

    <script>
        // 返回值
        return [
            'name': '',         // 名称
            'slug': '',         // 别名
            'description': [
                'title': '',    // 标题
                'imgs': '',     // 多图
                'extend': '',   // 摘要
                'content': ''   // 内容
            ],
            'created_at': '',   // 创建时间
            'updated_at': ''    // 更新时间
        ];
    </script>

</div>




<!-- 广告图调用 -->
<div {{ inject('visual')->url('ad', 1) }} data-position-top="80px">             // 可视化

    @foreach (inject('ad')->ad(1) as $key => $value)
        <a href="{{ $value['url'] }}" >                                         // 链接
            <div class="img"><img src="{{ $value->img }}" alt=""></div>         // 图片
            <h2>{{ $value['title'] }}</h2>                                      // 标题
            <h3>{!! $value['summary'] !!}</h3>                                  // 内容    
        </a>
    @endforeach

    //广告图-独立调用

    <img src="{{ inject('ad')->single(4, 1, 'img') }}">                 // 图片
    <h2>{{ inject('ad')->single(4, 1, 'title') }}</h2>                  // 标题
    <h3>{{ inject('ad')->single(4, 1, 'summary') }}</h3>                // 内容
    <h4>{{ inject('ad')->single(4, 1, 'url') }}</h4>                    // 链接

    <script>
    // 返回值
    return [
        'img': '',           // 图片
        'url': '',          // 链接地址
        'title': '',         // 标题
        'summary': '',       // 描述
        'order': ''          // 按升序排列
    ];   
    </script>    

</div>





<!-- 图文调用 -->
<div  {{ inject('visual')->url('photo-group') }}  >                                     //可视化                                      
    @foreach (inject('photoGroup')->list(2) as $key => $value)
    <li>
        <a href="{{ $value->url }}">                                                    // 链接
            <img src="{{ $value->description->present()->images(0) }}" alt="">          // 多图
            <h2>{{ $value->description->title }}</h2>                                   // 主标题
            <h2>{{ $value->description->f_title }}</h2>                                 // 副标题
            <h2>{{ $value->description->text1 }}</h2>                                   // 文字1
            <h2>{{ $value->description->text2 }}</h2>                                   // 文字2
            <h2>{{ $value->description->text3 }}</h2>                                   // 文字3
            <h3>{!! $value->description->summary !!}</h3>                               // 摘要
            <h4>{!! $value->description->content !!}</h4>                               // 内容
            
        </a>
    </li>
    @endforeach

    <script>
        return [
        'pid': '',                  // 分类ID
        'url': '',                 // 链接
        'flag': '',                 // 状态,1 发布,0 不发布
        'orders': '',               // 按升序排列
        'description': [
            'title': '',            // 主标题
            'f_title': '',          // 副标题
            'text1': '',            // 文字1
            'text2': '',            // 文字2
            'text3': '',            // 文字3
            'summary': '',          // 摘要
            'imgs': '',             // 多图
            'content': ''           // 内容
        ],
        'created_at': '',           // 创建时间
        'updated_at': ''            // 更新时间
    ];
    </script>

</div>





<!-- 导航调用 -->

<div  {{ inject('visual')->url('nav') }}>                                               // 可视化
    @foreach (inject('nav')->nav() as $key => $value)    
        <li>
            <a href="{{ $value->linkurl }}">                                            // 链接
                <img src="{{ $value->description->present()->image() }}" alt="">        // 图片
                <h2> {{ $value->description->cname }}</h2>                              // 标题
                <h2> {!! $value->description->summary !!}</h2>                          // 摘要
                <h2> {!! $value->description->content !!}</h2>                          // 详细内容
                <h2> {!! $value->description->seo_title !!}</h2>                        // SEO标题
                <h2> {!! $value->description->seo_keywords !!}</h2>                     // SEO关键词
                <h2> {!! $value->description->seo_description !!}</h2>                  // SEO描述
            </a>
            @if(!$value->children->isEmpty())                                           //判断是否有下拉
                @foreach ($value->children as $val)                                     // 下拉
                <a href="{{ $val->linkurl }}">                                      
                    <img src="{{ $val->description->present()->image() }}">         
                    <h2>{{ $val->description->cname  }}</h2>                        
                </a>
                @endforeach
            @endif
        </li>
    @endforeach 

        

    <!-- 单独调取某一个导航 -->
    <li><a href="{{  inject('nav')->nav()[2] -> linkurl }}">{{  inject('nav')->nav()[2]->children -> cname }}</a></li>

    <!-- 循环单个导航 -->
    @foreach (inject('nav')->nav()[4]->children as $val)
        <a href="{{ $val->linkurl }}">{{ $val->description->cname  }}</a>
    @endforeach






</div>






<!-- 分类调用 -->

@foreach (inject('category')->cate('product') as $value)                // 产品
@foreach (inject('category')->cate('news') as $value)                   // 新闻
@foreach (inject('category')->cate('case') as $value)                   // 案例
@foreach (inject('category')->cate('album') as $value)                  // 相册
@foreach (inject('category')->cate('job') as $value)                    // 招聘
@foreach (inject('category')->cate('video') as $value)                  // 视频
@foreach (inject('category')->cate('download') as $value)               // 下载
@foreach (inject('category')->cate('page') as $value)                   // 概况


<div {{ inject('visual')->url('product-cate') }}  >                                                // 可视化

<!-- 第一种方法 -->
@foreach (inject('category')->cate('product') as $value)
    
    <a href="{{ $value->present()->url }}">                                                             // 链接
        <div class="img"><img src="{{ $value->description->present()->img }}" alt=""></div>             // 图片
        <h2> {{ $value->description->present()->cname }} </h2>                                          // 标题                
        <h3>{!! $value->description->present()->summary !!}</h3>                                        // 摘要             
    </a>

    @foreach (inject('category')->cate('product', $value->id ) as $val)                                 // 子分类调用
    <a  href="{{ $val->present()->url }}">
        <div class="img"><img src="{{ $val->description->present()->img }}" alt=""></div>  
        <h2> {{ $val->description->present()->cname }} </h2>
        <h3>{!! $val->description->present()->summary !!} </h3>
    </a>
    @endforeach

@endforeach


<!-- 第二种方法 -->
    @foreach (inject('category')->cate()->take(6)->all() as $key => $value)                                 // 调用的分类可以限制数量 
        <a href="{{ $value->present()->url }}">                                                             // 链接
            <div class="img"><img src="{{ $value->description->present()->img }}" alt=""></div>             // 图片
            <h2> {{ $value->description->present()->cname }} </h2>                                          // 标题                
            <h3>{!! $value->description->present()->summary !!}</h3>                                        // 摘要             
        </a>
        @if(!$value->children->isEmpty())                                                                   // 判断是否有子分类
            @foreach ($value->children->take(6)->all() as $val)                 
                <a href="{{ $value->present()->url }}">                                                             // 链接
                    <div class="img"><img src="{{ $value->description->present()->img }}" alt=""></div>             // 图片
                    <h2> {{ $value->description->present()->cname }} </h2>                                          // 标题                
                    <h3>{!! $value->description->present()->summary !!}</h3>                                        // 摘要             
                </a>
            @endforeach
        @endif
    @endforeach

</div>






<!-- 列表调用 -->

inject('list')->lists($table = 'product', $pid = 0, $num = 20, $isPage = 1, $attribute = '', $order = 'orders', $sort = 'DESC');

- $table 表名称 `可选`
  - `product` 产品列表
  - `news` 新闻列表
  - `case` 案例列表
  - `album` 相册列表
  - `job` 招聘列表
  - `video` 视频列表
  - `download` 下载列表
  - `page` 概况列表
  
- $pid 分类ID,`0` 表示所有列表 `可选`
- $num 调取数量,如果 `$isPage` 为 `1`,表示分页数量 `可选`
- $isPage `1` 分页,`0` 不分页 `可选`
- $attribute 属性 `可选`
  - `recom` 推荐
  - `top` 置顶
  - `headline` 头条
- $order 按照指定字段排序,默认是 `orders` 字段 `可选`
- $sort `ASC` 降序排列,`DESC` 升序排列 `可选`


// 获取所有推荐的前三条产品
{{ inject('list')->lists('product', 0, 3, 0, 'recom-1') }}

// 获取分类ID为1,以及其所有子分类下的产品,按10条分页,并按照创建时间降序排列
{{ inject('list')->lists('product', 1, 10, 1, '', 'created_at', 'ASC') }}
```


<div {{ inject('visual')->url('product') }}>                                                            // 可视化

    @foreach (inject('list')->lists('product', 0, 3, 0, 'recom-1' ) as $value)          // 产品 , 所有分类 , 3个产品 , 不分页 , 推荐
        <li>
            <a href="{{ $value->present()->url() }}">
                <div class="img"><img src="{{ $value->description->present()->image() }}"></div>        // 图片
                <h2>{{ $value->description->title or '' }}</h2>                                         // 名称
                <h3>{!! $value->description->summary or '' !!}</h3>                                     // 描述                            
                <h4>{!! $value->description->content or '' !!}</h4>                                     // 详细内容
                <h4>{{ $val->created_at->format('Y-m-d') }}</h4>                                        // 时间
                <h4>{!! $value->number !!}</h4>                                                         // 基本信息-编号                                                 
                <h4>{!! $value->price !!}</h4>                                                          // 基本信息-价格  
                <h4>{!! $value->stock !!}</h4>                                                          // 基本信息-库存
                <h4>{!! $value->linkurl !!}</h4>                                                        // 基本信息-外部链接
            </a>
        </li>
    @endforeach


<!-- 新闻调用 -->

@foreach (inject('list')->lists('news', $value->id , 3 , 0 ) as $value)
    <li>
        <a href="{{ $value->present()->url('news') }}">
            <h2>{{ $value->description->title or '' }}</h2>
            <h3>{!! $value->description->summary or '' !!}</h3>
            <h4>{{ $value->created_at->format('Y-m-d') }}</h4>
        </a>
    </li>
@endforeach


<!-- tap切换常用调用 -->

<div class="bb1nr">
    <div class="bb1hd">
        @foreach (inject('category')->cate('product') as $value)
            <li>
                <a href="{{ $value->present()->url }}">                                                             // 链接
                    <h2> {{ $value->description->present()->cname }} </h2>                                          // 标题                
                </a>
            </li>
        @endforeach
    </div>
    <div class="bb1bd">
        @foreach (inject('category')->cate('product') as $value)
            <div class="tt">
                @foreach (inject('list')->lists('product', $value->id , 3 , 0 ) as $val)
                    <li>
                        <a href="{{ $val->present()->url }}">
                            <div class="img"><img src="{{ $val->description->present()->image() }}"></div> 
                            <h2>{{ $val->description->title or '' }}</h2>
                            <h3>{!! $val->description->summary or '' !!}</h3>
                            <h4>{{ $val->created_at->format('Y-m-d') }}</h4>
                        </a>
                    </li>
                @endforeach
            </div>
        @endforeach
    </div>
</div>


<script>
    return [
        'total': '',                         // 总条数
        'per_page': '',                      // 每页显示多少
        'current_page': '',                  // 总共多少页
        'last_page': '',                     // 最后一页是第几页
        'next_page_url': '',                 // 下一页地址
        'prev_page_url': '',                 // 上一页地址
        'data': [
            'id': '',                        // ID
            'slug': '',                      // 别名
            'pid': '',                       // 所属分类ID
            'manufacturer_id': '',           // 品牌ID
            'recom': '',                     // 1为推荐
            'headline': '',                  // 1为置顶
            'top': '',                       // 1为头条
            'hits': '',                      // 浏览量
            'orders': '',                    // 排序
            'linkurl': '',                   // 外部链接
            'flag': '',                      // 状态,1为发布
            'created_at': '',                // 创建时间
            'updated_at': '',                // 更新时间
            'cates': [
                'id': '',                    // 所属分类ID
                'slug': '',                  // 所属分类别名
                'cname': '',                 // 所属分类名称
                'parent_id': '',             // 所属分类父ID
                'linkurl': '',               // 所属分类外部链接
                'flag': '',                  // 所属分类状态,1为发布
                'orders': '',                // 所属分类排序
                'created_at': '',            // 所属分类创建时间
                'slug': ''                   // 所属分类更新时间
            ],
            'description': [
                'id': '',                    // 描述ID
                'lang': '',                  // 语言版本
                'imgs': '',                  // 多图
                'title': '',                 // 名称
                'summary': '',               // 描述
                'content': '',               // 详细内容
                'seo_title': '',             // SEO标题
                'seo_keywords': '',          // SEO关键词
                'seo_description': ''        // SEO描述
            ]
        ]
    ]
</script>







<!-- 详情页属性调用 -->

@if(!$attrs->isEmpty())
    @foreach ($attrs as $key => $value)
        <div class="attr-list-content">
        <span class="attr-title">{{ $value->title }}:</span>
        <span class="attr-text">{{ $value->text }}</span>
        </div>
    @endforeach
@endif



<!-- 详情页下载调用 -->
@if(!$product->downloads->isEmpty())
    <div role="tabpanel" class="tab-pane" id="tab-3">
        <ul class="product-download">
        @foreach ($product->downloads as $key => $value)
            <li>
            <i class="iconfont">{{ config('system.icon')[$value->present()->filetype]['unicode'] }}</i>
            <div class="cont">
                <p>{{ $value->description->title ?? '' }}</p>
                <a href="{{ $value->filepath }}" download="{{ $value->description->title ?? '' }}">[{{ inject('setting')->langs('system', 'click_download') }}]</a>
            </div>
            </li>
        @endforeach
        </ul>
    </div>
@endif



</div>


上一篇:外贸易OSS配置

下一篇:已经是最后一篇

相关内容

文章评论

表情

共 0 条评论,查看全部
  • 这篇文章还没有收到评论,赶紧来抢沙发吧~