标签: octobercms-plugins

OctoberCMS Ajax在前端排序

我正在寻找使用ajax排序前端列表的最佳实践.

所以我有一个循环遍历所有项目的组件.然后是带有复选框的侧边栏,使用Ajax进行过滤.每个复选框都是一个类别,并通过检查该过滤器进行过滤.

在我的组件default.htm我有

{% set items = __SELF__.items %}

<div class="col-md-12" id="results">
{% for item in items %}

<ul>
    <li>{{ item.title }} - {{ item.description }}</li>
</ul>


{% endfor %}   
</div>
Run Code Online (Sandbox Code Playgroud)

和一个按钮,直到我让它切换到复选框.

<button class="btn btn-default"
data-request="onHandleForm"
data-request-update="#results">
Go
Run Code Online (Sandbox Code Playgroud)

并在我的组件插件文件中

// Fetches everything
public function onRun() {

    $order = items::orderBy('id', 'asc');
    $this->items = $order->get();

}

function onHandleForm()
{

    // Fetch all of the items where category is 2 for test purposes
    $order = items::orderBy('id', 'desc')->where('category','2');
    $filter = $order->get();

    $this->page['items'] = $filter; …
Run Code Online (Sandbox Code Playgroud)

php ajax laravel octobercms octobercms-plugins

21
推荐指数
1
解决办法
1266
查看次数

使用带有静态页面插件的前端编辑器

我真的很新ocms,我已经安装了静态页面,它的工作非常好.我想使用其中一个插件编辑首页(在上下文编辑中)的字段,例如:https://octobercms.com/plugin/netsti-editor我已经拖到我的布局页面,但我可以' t在首页编辑此内容.这是我如何使用静态页面插件的示例:

<img src="{mediafinder name="logo" label="Logo" tab="General" mode="image"}{/mediafinder}" />

{repeater name="side_logos" tab="General" prompt="Add another content section"} {text name="my_title" label="My Title"}{/text} {/repeater}
Run Code Online (Sandbox Code Playgroud)

谢谢

php octobercms octobercms-plugins

8
推荐指数
1
解决办法
442
查看次数

在播种或迁移表时,如何向控制台提供输出?

我有一个10月份的插件,我正在创建必要的表格并根据文档播种它们.

我希望在这样做时提供控制台输出,这样我就可以调试我正在设置和捕捉任何可能性的过程.

如何在运行时将信息输出到控制台php artisan october:up

use Db;
use Seeder;

class SeedGeoStateTable extends Seeder
{
    public function run()
     {
     foreach(array_merge(glob(__DIR__.'/seed/geo_state/*.txt'), glob(__DIR__.'/seed/geo_state/*.json')) as $file) {
           $this->insert($file);     
           gc_collect_cycles();
        }
     }

     public function insert($file) {
         // output to console which file i'm seeding here
         $json = json_decode(file_get_contents($file),true);
         foreach($json as $entry) {
             Db::table("geo_state")->insert($entry);
         }
     }
 }
Run Code Online (Sandbox Code Playgroud)

laravel octobercms octobercms-plugins

3
推荐指数
2
解决办法
1708
查看次数

OctoberCMS 401,402,403,503,400错误代码处理

我只需要问是octobercms只能设置两种类型的错误???

  1. 404 [通过使用/ 404 url​​创建页面]

  2. 500 [通过/错误网址创建页面]

我们怎样才能设置400,401,402,403,503,400等??????

octobercms octobercms-plugins

3
推荐指数
1
解决办法
483
查看次数

Does not contain a definition for 'file_src' October CMS

I am currently working at October CMS plugin development, I have a problem with file upload. I put the fileupload type to file_src. When I go to to resource it shows an error like this :

在此处输入图片说明

model/resource
    fields:
        name:
            label: Name
            type: text
            required: true
        file_src:
            label: Upload
            type: fileupload
        grade_id:
            label: Grade
            type: dropdown
            emptyOption: Select
            showSearch: true
        subject_id:
            label: Subject
            type: dropdown
            emptyOption: Select
            showSearch: true
        type_id:
            label: Type
            type: dropdown
            emptyOption: Select
            showSearch: true
Run Code Online (Sandbox Code Playgroud)

How can …

octobercms-plugins

1
推荐指数
1
解决办法
2702
查看次数

使用OctoberCMS RainLab Blog获取不同类别的组合帖子

我在10月CMS使用Rain Lab Post.我使用blogPost组件没有问题,并从单个类别发布.例如,这是显示类别中最后5个帖子的部分内容

[blogPosts]
pageNumber = "{{ :page }}"
categoryFilter = "{{ slug }}"
postsPerPage = 5
noPostsMessage = "No news in this category"
sortOrder = "published_at desc"
categoryPage = 404
postPage = "singlePost"
==
<li> <a href="#">{{category.name}}</a>
    <ul class="drop-down full-width col-5 hover-expand">
        <li class="validation">
            <h2 class="mm-title">{{category.name}}</h2>
        </li>
        {% for post in posts %}
        <li>
            {% for image in post.featured_images|slice(0,1) %}
                <a href="{{ post.url }}"><img src="{{ image.path }}" alt=""></a>
            {% endfor %}
            <h3><a href="{{ post.url }}">{{post.title}}</a></h3>
        </li>
        {% endfor %} …
Run Code Online (Sandbox Code Playgroud)

laravel octobercms octobercms-plugins

0
推荐指数
1
解决办法
1188
查看次数

octoberCMS | 在布局之间共享代码

在此输入图像描述

在我的默认布局上我有很多AJAX handlers,但对于我的项目,我需要创建具有相同布局但具有不同变量的静态页面(客户端的字段)...

据我了解,我需要创建不同的布局,以扩展部分default layout...

但是有一些方法可以在布局之间共享代码以防止重复?

或者,有一些方法可以在布局上创建不同的变量到不同的静态页面?

防爆.变种 码:

{variable name="tagline" label="Tagline" tab="Header" type="text"}{/variable}
{variable name="banner" label="Banner" tab="Header" type="mediafinder" mode="image"}{/variable}
Run Code Online (Sandbox Code Playgroud)

octobercms octobercms-plugins octobercms-backend

0
推荐指数
1
解决办法
308
查看次数