i have a php questions which hopefully will result in a plugin. for your understanding, i am planning to switch from a wordpress site to kirby for my local sports club.
how could i implement this table? my idea was to use a php function like ```
file_get_contents() or something like this: https://simplehtmldom.sourceforge.io/
unfortunately my php knowledge is not this good. I only want the DOM nodes of the .
Anyone a smarter or better idea or am i on the right direction?
So, I tried the library from @jimbobrjames and @pixelijn and was able to test with some simple selectors to get the title tag for expamle. So thanks again for those tips.
But my main intention to implement the table is still not working. I suspect it has something to do with the fact that the tables content is generated by the filter above the table.
So if try I scrape the hole page I dont get the tables content.
Maybe you two or someone else any more ideas to solve this?
That’s right, but each filter results in a different URL. So of course you have to know in advance which table you want to get and use the corresponding URL parameters, for example:
yeah right, thanks. So this url here:
“https://www.hvw-online.org/spielbetrieb/ergebnissetabellen#/league?ogId=3&pId=91&wId=2020-09-28&lId=58956”
is the table which I need and so I know the url in advance. Thats fine. But still this is not working. If I use the selectors of the php library above I cant render the table.
Another idea I’ve found is:
the table is generated by a JSON file which is the following: https://spo.handball4all.de/service/if_g_json.php?ca=0&cl=45906&cmd=ps&do=2019-09-23&og=3&p=83
But thats the next problem. I have no experience with JSON. When I format the content here for example: http://json2table.com/
I now know that I only need the part “score” of the JSON (which is the table).
@texnixe
I added a text field to enter the url in the panel and in the template there is a check if the field is empty and if not than it get rendered. it works just fine.
but I’m stuck at how to check if the field is filled out wrong, for example if someone pasted the wrong url or something like that.
I get the following error: TypeError thrown with message "array_keys(): Argument #1 ($array) must be of type array, null given"
TypeError thrown with message "array_keys(): Argument #1 ($array) must be of type array, null given"
Stacktrace:
#10 TypeError in /Users/timobetz/websites/hsg2b/site/templates/mannschaft.php:91
#9 array_keys in /Users/timobetz/websites/hsg2b/site/templates/mannschaft.php:91
#8 include in /Users/timobetz/websites/hsg2b/kirby/src/Toolkit/F.php:402
#7 Kirby\Toolkit\F:loadIsolated in /Users/timobetz/websites/hsg2b/kirby/src/Toolkit/F.php:379
#6 Kirby\Toolkit\F:load in /Users/timobetz/websites/hsg2b/kirby/src/Toolkit/Tpl.php:35
#5 Kirby\Toolkit\Tpl:load in /Users/timobetz/websites/hsg2b/kirby/src/Cms/Template.php:167
#4 Kirby\Cms\Template:render in /Users/timobetz/websites/hsg2b/kirby/src/Cms/Page.php:1181
#3 Kirby\Cms\Page:render in /Users/timobetz/websites/hsg2b/kirby/src/Cms/App.php:687
#2 Kirby\Cms\App:io in /Users/timobetz/websites/hsg2b/kirby/src/Cms/App.php:1040
#1 Kirby\Cms\App:render in /Users/timobetz/websites/hsg2b/index.php:5
#0 require in /Users/timobetz/.composer/vendor/laravel/valet/server.php:219
But this time it’s another error. this happens when the textfield input has the word “test” in it.
The first error was with the letters “sd” in the textfield.