This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Tschallacka
Tschallacka

I have the following very basic plugin for october cms and I can't figure out how to make the options editable or make sure that the plugin gets saved with the page. The moment I save the page, close it and reload it the banner header is gone.

I've looked at other plugins and examples and I can't discern really what i'm doing wrong..

Plugin.php

<?php namespace MDibbets\BannerHeader;

use System\Classes\PluginBase;

class Plugin extends PluginBase
{

    public function pluginDetails()
    {
        return [
            'name'        => 'Banner Header',
            'description' => 'Provides content management for the banner header module.',
            'author'      => 'Michael Dibbets',
            'icon'        => 'icon-sun-o'
        ];
    }

    public function registerComponents()
    {
        return [
           '\MDibbets\BannerHeader\Components\BannerHeader' => 'bannerheader'
        ];
    }
}

components/bannerheader.php

<?php 
namespace MDibbets\BannerHeader\Components;

use App;
use Event;
use Backend;
use Cms\Classes\ComponentBase;
use System\Classes\ApplicationException;

class BannerHeader extends ComponentBase
{
    public function componentDetails()
    {
        return [
            'name'        => 'Banner Header',
            'description' => 'Places a nice big banner header on the page with the below settings.'
        ];
    }

    public function defineProperties()
    {
        return [
            'maintitle' => [
                'title'             => 'Main Title',
                'type'              => 'string',
                'default'           => 'Welcome'
            ],
            'subtitle' => [
                'title'             => 'Sub Title',
                'type'              => 'string',
                'default'           => 'you are'
            ],
            'content' => [
                    'title'             => 'The Content',
                    'type'              => 'string',
                    'default'           => 'xxxxxxxxxx'
            ]
        ];
    }
    public function info() {
        $ret = new stdClass();
        $ret->title = $this->property('title');
        $ret->subtitle = $this->property('subtitle');
        $ret->content = $this->property('content');
        return $ret;
    }
    public function onRun() {
        $this->page['bannerheader'] = $this->info();
    }
   //...

}

?>

I followed every step in the weather app tutorial, and logic kinda dictates this should work right? yet I get in javascript console Uncaught Error: Error parsing the Inspector field configuration. SyntaxError: Unexpected end of input when I double click the banner box to open the options..

So clearly something is wrong, but this cryptic message doesn't point me in a direction where I can solve it.

Does anyone know how I can trace this back to a fault? or point me to the proper documentation? Other plugins work fine and save fine.

It's probaly something stupid and small. I just can't figure it out what the stupid small thing is.(sometimes I hate learning new stuff heh)

FelixINX
FelixINX

See my comment on Stack Overflow.

michael8985 said:

I followed every step in the weather app tutorial, and logic kinda dictates this should work right? yet I get in javascript console Uncaught Error: Error parsing the Inspector field configuration. SyntaxError: Unexpected end of input when I double click the banner box to open the options..

SyntaxError. Missing } or something like this!

Last updated

Tschallacka
Tschallacka

Allright.. namespaces. right.. forgot about that...

the solution is in $ret = new \stdClass();

such a small error, and as I thought, something stupid.

pratyushpundir6424
pratyushpundir6424

Hey, just wanted to know. Are you using stdClass just for your query here or for real as well? If yes, why not use an October model?

Tschallacka
Tschallacka

stdClass() is a native object which is fast and optimised. And i'm familiar with the native php objects. October has a shitty documentation that crossreferences to pieces of documentation that totally does not help figuring out how something works.

Sorry, but i'll stick to what I know. I'm wasting enough time as it is trying to figure out this basically documentation less piece of cms. Because 75% of the documentation so far has been useless in what I want to do with it.

pratyushpundir6424
pratyushpundir6424

Yeah, I agree with the issue around documentation. It exists but it could be a lot better. That certainly leaves room for some contribution. But otherwise, I'm quite digging October. It's just painful to look for some trivial thing about it sometimes.

Tschallacka
Tschallacka

I potentially like octobercms. Its just the person who wrote the documentation made an absolute mess of it.

Its written from the perspective that you know what does what... and it skips the basic explanations so you can understand relations if you come from a platform like wordpress, joomla, codeigniter or just plain laravel...

So far i've had to fix up a lot of things already to get it working on IIS and MS sql server

https://github.com/octobercms/install/issues/69

I can't deal with the windows git... and at work im working with windows :S so this is my way of contributing :P

pratyushpundir6424
pratyushpundir6424

That github thread is pretty intense :-) I have no idea about a windows system so can't really help. I would've imagined it to be way more easier than this!!

1-8 of 8

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.