标签: octobercms

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
查看次数

OctoberCMS如何使用插件扩展中的字段创建自定义用户注册表单

我正在尝试学习OctoberCMS,我对扩展插件的完整过程感到困惑.我根据截屏视频(https://vimeo.com/108040919)扩展了用户插件.最终,我正在寻找创建一个名为"category"的新领域,该领域将存储用户类别.在新页面上,我有以下表单,我试图用它来仅根据他们的电子邮件地址注册新用户.根据他们注册的页面填充"类别",并且应自动生成密码,以便用户在通过电子邮件激活链接确认其帐户时进行设置.我的插件名为"Profile".

我的plugin.php文件如下所示:

<?php namespace Sser\Profile;

use System\Classes\PluginBase;
use RainLab\User\Models\User as UserModel;
use RainLab\User\Controllers\Users as UsersController;
use Sser\Profile\Models\Profile as ProfileModel;
/**
 * Profile Plugin Information File
 */
class Plugin extends PluginBase
{

    /**
     * Returns information about this plugin.
     *
     * @return array
     */
    public function pluginDetails()
    {
        return [
            'name'        => 'Profile',
            'description' => 'Handles user demographic information',
            'author'      => '',
            'icon'        => 'icon-leaf'
        ];
    }

    public function boot()
    {
        UserModel::extend(function($model){
            $model->hasOne['profile'] = ['Sser\Profile\Models\Profile'];
        });
        // $user->profile->zip

        UserModel::deleting(function($user) …
Run Code Online (Sandbox Code Playgroud)

php user-registration laravel octobercms

15
推荐指数
2
解决办法
6685
查看次数

关于Z-Ray的10月CMS反射异常

当我在带有Z-Ray的服务器上加载我的十月安装时,我收到此错误:

//用作解析器,以更精细地分辨这些对象.

if ($concrete instanceof Closure)
{
    return $concrete($this, $parameters);
}

$reflector = new ReflectionClass($concrete);

// If the type is not instantiable, the developer is attempting to resolve
// an abstract type such as an Interface of Abstract Class and there is
// no binding registered for the abstractions so we need to bail out.
if ( ! $reflector->isInstantiable())
{
Run Code Online (Sandbox Code Playgroud)

错误来自这一行: $reflector = new ReflectionClass($concrete);

作为一个ReflectionException.

我不知道它为什么这样做,但在XAMPP上,这不存在.

网址:使用Z-Ray不使用Z-Ray.相同的文件,复制/粘贴.

谢谢

php zend-server laravel octobercms

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

October CMS - sorting records - example of the partial for the toolbar icons?

I'm excited that the October CMS recently added back-end functionality for sorting records in the list view. But I'm having some trouble getting it to work. The documentation is here. I've followed the direction like so:

In my controller, I implemented the ReorderController:

<?PHP namespace BTruchan\Team\Controllers;

use Backend;
use BackendMenu;
use BackendAuth;
use Backend\Classes\Controller;
use System\Classes\SettingsManager;

class Members extends \Backend\Classes\Controller 
{
    public $implement = [
        'Backend.Behaviors.FormController',
        'Backend.Behaviors.ListController',
        'Backend.Behaviors.ReorderController'
    ];

    public $formConfig = 'config_form.yaml';
    public $listConfig = 'config_list.yaml';
    public …
Run Code Online (Sandbox Code Playgroud)

sorting octobercms

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

十月CMS - 如何正确路由

我一直在审查10月CMS路由的文档(https://octobercms.com/docs/plugin/registration#routing-initialization),但我认为我遗漏了一些东西.我有一个名为'deals'的页面,它提供了一些基本信息以及一个插件(称为'deals')组件.该页面通常出现在网址上:

http://www.example.com/deals
Run Code Online (Sandbox Code Playgroud)

但是,我想创建一个路由,以便有人访问该网址时:

http://www.example.com/deals2
Run Code Online (Sandbox Code Playgroud)

它会自动将它们路由回去

http://www.example.com/deals
Run Code Online (Sandbox Code Playgroud)

我知道我应该在我的插件目录中创建一个routes.php文件.但是,当我尝试使用时

Route::get('/deals2', function()
{
        return View::make('deals');
});
Run Code Online (Sandbox Code Playgroud)

它抱怨它无法找到"交易"视图.我究竟做错了什么?

此外,我如何路由它以便我的主页

http://www.example.com
Run Code Online (Sandbox Code Playgroud)

会路由到

http://www.example.com/deals
Run Code Online (Sandbox Code Playgroud)

php routing laravel octobercms

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

PHP 运行 artisan 命令时出现弃用问题

每当我运行 artisan 命令时,我都会遇到这个问题。

我正在使用 Valet 和 PHP 8.1。我尝试过更改 PHP 版本,但仍然遇到此问题。

当我跑步时:

jakefeeley@Jakes-MBP marketing % php artisan plugin:install vojtasvoboda.twigextensions
Run Code Online (Sandbox Code Playgroud)

返回:

PHP Deprecated:  Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/jakefeeley/Sites/certhub/marketing/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1231

Deprecated: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/jakefeeley/Sites/certhub/marketing/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1231 …
Run Code Online (Sandbox Code Playgroud)

php composer-php octobercms

11
推荐指数
5
解决办法
9万
查看次数

我如何在OctoberCMS获得基本网址?

我想在后端渲染列表中显示图像.为此,如何获得显示图像的路径.我们尝试过base_path()方法.

但它给了我完整的路径,如"opt/lampp/htdocs/ashish /",但我想得到http:// localhost/ashish

octobercms

10
推荐指数
3
解决办法
9286
查看次数

更新用户组OctoberCMS rainlab用户插件

如何更新更改用户的组?根本找不到它.花了几个小时.

$user = new User;
$user->group = 'new';
$user->save();
Run Code Online (Sandbox Code Playgroud)

用户与使用Group的belongsToMany有关.

不工作.谢谢.

php plugins usergroups laravel octobercms

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

如何检查今天是否在Twig的两个日期之间?

我想检查今天的日期是否在数据库的两个日期之间.这是我的代码.

{% if today < room.price_start_date and today > room.price_end_date %}
<a href="{{'/'|app}}/book/{{room.id}}"><button type="button" class="btn btn-default btn-xs">Book this room</button></a>
{% else %}
<a href="{{'/'|app}}/contact"><button type="button" class="btn btn-default btn-xs">Book this room</button></a>
{% endif %}
Run Code Online (Sandbox Code Playgroud)

today变量会从这段代码的价值:

$todayDate = date('Y-m-d');
$this['today'] = date('Y-m-d', strtotime($todayDate));
Run Code Online (Sandbox Code Playgroud)

price_start_dateprice_end_date我从数据库中获取他们和他们的列的类型Date

任何想法如何检查是否today是之间room.price_start_dateroom.price_end_date在嫩枝?

symfony twig octobercms

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

OctoberCMS - 如何使可折叠列表默认仅在非移动设备上处于活动状态

我有一个OctoberCMS网站,我试图在可折叠列表中隐藏侧边栏,以便在移动设备上查看时,列表项将被折叠.当不在移动设备上时,我正在寻找它,如下例所示:

http://codepen.io/anon/pen/GoqPJj

代码如下:

<div class="container">
    <div class="row">
        <div class="col s12 m6">
            <ul class="collapsible" data-collapsible="accordion">
                <li>
                    <div class="collapsible-header active"><i class="material-icons">filter_drama</i>First</div>
                    <div class="collapsible-body">
                        <p>Lorem ipsum dolor sit amet.</p>
                    </div>
                </li>
            </ul>
        </div>
        <div class="col s12 m6">
            This is the main page content. Here is some more content, and here is some even more content. It never seems to end as I add random text. Just one more sentence to make it a bit more complete.
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

有谁知道我如何编辑上面的例子来产生预期的结果?

css jquery octobercms

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