Page 1 of 1

Json/XML: List items and have a detail pages

Posted: Mon Nov 19, 2018 1:02 pm
by HarmO
Hi,
I'm currently making a website where i have sync with an external JSON or XML file.

i have done this before for video's (like here), but now, there are multiple elements that complicate things.

A: pagination:
The json/xml file will list up to 250 items. We can't all put them on 1 page.

B: detail page
Now the customer wants a detail page for each item in the xml/json file with an url like http://www.example.com/video/video-alias

I'm thinkin for point B i need to make a detail page that loads a scipt. and with a htaccess rewrite i'll have to rewrite all links for "video/*" to use the detail page and give the video alias as a variable.

Then i just need to find out how i can do the pagination on the list.
any thoughts or experiences?

Re: Json/XML: List items and have a detail pages

Posted: Mon Nov 19, 2018 2:15 pm
by calguy1000
a: write a simple module that has summary and detail actions.
b: your module can register one or more routes to handle your pretty URLs
c: your actions can read the json/xml data on the server side instead of client side
d: your actions can use templates to render your summary and detail views.

The only difference between this module and any other module is that instead of retrieving data from the mysql database you are retrieving it from a json/xml or other source.

Re: Json/XML: List items and have a detail pages

Posted: Sat Dec 01, 2018 3:50 pm
by velden
You might consider using LISE as the module and write your own procedure (e.g. UDT) to sync the xml with LISE items. This task then could be run as a pseudo cron job or perhaps you can use real cron to request a 'hidden' page including the UDT.

Pagination can also be done using e.g. jQuery I presume but might be less efficient (client side)

https://stackoverflow.com/questions/250 ... -json-data

Re: Json/XML: List items and have a detail pages

Posted: Wed Dec 26, 2018 12:38 pm
by HarmO
In both cases there is development work involved.
I think the creation of a basic module would be the most logical to do.