fabianschenk86 / firby-app

GNU General Public License v3.0
6 stars 0 forks source link

Select with Query #1

Open chrhuff opened 8 years ago

chrhuff commented 8 years ago

Hi,

Blueprints using type: select and options: query, such as:

  galerie:
    label: Galerie
    width: 1/2
    type: select
    options: query
    query:
      fetch: pages
      page: galerie
      template: gallery
      text: '{{template}}: {{title}}'
      value: '{{uri}}'

Don't work in the firby-app:

firby-select-query

fabianschenk86 commented 8 years ago

Thank you for your hint. Now, I have added the dynamic option in the firby.php file.

chrhuff commented 8 years ago

Installed the update, now pages with selects throw an error in the app.

fabianschenk86 commented 8 years ago

Weird, it works for me. Then please try the following: Open your website and call the API like this "www.yourwebsite.de?firby-username=yourusername&firby-password=yourpasswort&firby-type=currentpage&firby-uri=siteuriwithselect" If an error message is displayed please send me the error message or a screenshot to fabianschenk86@googlemail.com

chrhuff commented 8 years ago

I get (actual paths sanitized)

Notice: Undefined index: tinyurl.enabled in /home/www/kirby/core/page.php on line 197
(repeated quite a few times)
Warning: Cannot modify header information - headers already sent by (output started at /home/www/kirby/core/page.php:197) in /home/www/kirby/toolkit/lib/cookie.php on line 164

followed by the JSON output.

[Update] I solved this myself by turning off debug mode.

Regular query selects look fine. However, I do actually have one of those in a structure, like this:

  calendars:
    label: Spiele und Ereignisse
    type: structure
    modalsize: medium
    entry: >
      {{url}} 
    fields:
      show:
        label: Zeige...
        type: checkboxes
        options:
          matches: Im Ergebnisdienst
          events: Auf dem Kalender
      url:
        label: Kalender
        type: select
        options: query
        width: 1
        query:
          fetch: pages
          template: calendar
          text: '{{title}} ({{uri}})'
          value: '{{uri}}'
        help: Referenz auf einen Kalender

That still renders as q u e r y like above.

fabianschenk86 commented 8 years ago

I'm not sure but I think there is no error in the script. Because you write that the JSON displayed after the Warning. The server says: "Notice: Undefined index: tinyurl.enabled in /home/www/kirby/core/page.php on line 197" and just want indicate that "tinyurl.enabled" is undefined. Kirby could fix this with isset () in the home/www/kirby/core/page.php. But this is not a error just an indication. Because this notice is displayed before the JSON, there is the second warning that the header has already been sent. My guess without notice there is no warning too. Therefore, Now I have removed all notice message in the firby.php file and hope it works now. If this fails, maybe it is still possible to define tinyurl.enabled in the config.php file with c :: set ('tinyurl.enabled', true); or c :: set ('tinyurl.enabled', false);

chrhuff commented 8 years ago

The Notice: Undefined index message is fixed by Panel rev. 1c13e6952ab1f8e4a64b75542cd8ad59d5df536f, which solves https://github.com/getkirby/panel/issues/832

I will try and report back. Still, this issue is not solved completely, as query-enabled selects in structures don't work.