Front end Widget

  • Thank you for attention , but i miss again paths:

    Follow instructions of hellowidget exmple here (is more simple)
    ------------------------------------------------------------

    #Define widget positions -- For me is clear
    /packages/pagekit/theme-hello/index.php

    i can add positions, ok

    ------------------------------------------------------------

    #Render Widgets
    /packages/pagekit/theme-hello/views/template.php

    clear, understand

    -------------------------------------------------------------

    #Register a new widget type

    "you can make use of the widgets property in your index.php file"

    here i begin to lost myself, i checked many index.php files but i cannot understand where put exactly


    'widgets' => [

    'widgets/hellowidget.php'

    ],


    /app/system/modules/hellowidget ?
    -------------------------------------------------------------

    #Define a new widget type

    If i didn't understand wrong i have to

    copy hellowidget.php in /public_html/app/system/modules/widget

    create folder

    /app/system/modules/widget/hellowidget/js/

    to copy inside widget.js

    and

    create folder /app/system/modules/view

    and copy inside widget.php


    surely not because i cannot make it works :whistling:

  • Hi,


    I think there are some things mixed up.


    /packages/pagekit/theme-hello/index.php and /packages/pagekit/theme-hello/views/template.php are belonging to a theme.


    The part


    Quote

    'widgets' => [

    'widgets/hellowidget.php'

    ],


    belongs to the index.php of a widget. A widget is not bundled with a theme, a theme just defines where to render the widgets ( = Widget positions).


    If you create a new widget, which, for example, shows an RSS feed, you would probably do something like


    Quote

    'widgets' => [

    'widgets/rssfeedwidget.php'

    ],


    And place the rssfeedwidget.php in the widget-folder of your extension ( = your widget).


    Using the example I used above:


    Widget-starting-point: https://github.com/Bixie/pagek…sts/blob/master/index.php

    Widget-definition: https://github.com/Bixie/pagek…posts/tree/master/widgets

  • No. You create a package which is istalled to /packages/...


    There is a really good Tutorial (with videos) in the docs, which shows how to create an own extension. A widget is an extension, too, so you can use your learnings to create your own widget.