Jump to content

Seeking coding help for coronavirus project


CliffG
 Share

Recommended Posts

I have built a number of basic PW sites over the years. Now I've taken on a pro-bono project for a coronavirus info site that goes beyond my meager PHP skills and knowledge of the API. I'm trying to replicate the functionality of this site so the originator doesn't have to do much work manually. Generating the content in the main column is no problem. I know there are several ways to set up the content in the second column that would be trivial to a more experienced PW programmer. It's a list of dates that, when clicked, presents all the posts that appeared on that date. I can generate the list of dates easily enough, but getting them to display the posts has so far eluded me. My latest idea is to use a dropdown for people to select a date. That's done, but my attempts to get ahold of the selector value that Formbuilder generates is not working for me. Would anyone have time to help out? Many thanks. —Cliff

Link to comment
Share on other sites

Can you show the structure of your data in PW? E.g. where and how is “April 10” stored?

I gotta say, I do not like that site. Why does the navigation disappear when I choose a date?! Why does resetting the navigation require a full page reload when everything is still on the page, just hidden?!

As I understand it, it’s a collection of links in which each link has a url, a description, a date and a category. Initially all links are displayed, grouped by category, sorted by date (desc). Each link’s date is stored as a class on its list item in the form “d2020-03-31”. The sidebar is just all dates and if you click one it hides everything that doesn’t have the corresponding class using Javascript.

The reset could just be:

document.querySelectorAll('h3, li, .nav').forEach(li => {li.style.display = null});

(or something extremely similar)

If I were going to replicate this frontend I would probably put the dates into data attributes instead of classes. And I’d make a fallback for people without javascript where the sidebar links to a urlSegment and the list is filtered on the server unless JS hijacks the click events. I might also think about ways not to load everything every time, although there are pros and cons. The bandwidth is negligible, but users might be intimidated by the long page and browsers might struggle to keep up, but on the other hand I love a site that is complete and searchable as soon as it’s done loading…

  • Like 1
Link to comment
Share on other sites

Jan, thank you very much for your quick reply. I'm not using any of the code of the original website and I have free reign to redesign and recode however I find most efficient. At this point my dev site is only on my computer, so I can't point you to it or give you access. I can't go into more detail now because of work obligations, but I'm very grateful for your insights and your help.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...