我正在寻找使用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) 我真的很新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)
谢谢
我有一个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) 我只需要问是octobercms只能设置两种类型的错误???
404 [通过使用/ 404 url创建页面]
500 [通过/错误网址创建页面]
我们怎样才能设置400,401,402,403,503,400等??????
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 …
我在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) 在我的默认布局上我有很多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)