Jump to content

Tour dates


lucas
 Share

Recommended Posts

Hi guys,

I'm Lucas. I was wondering if you guys could give me a little hand with ProcessWire.

How can I setup a "tour dates" page for a band website and make it editable in the panel so the band members can easily add/edit dates?

Thank you in advance!

Warm regards,

Lucas

Link to comment
Share on other sites

Edit: welcome! :)

First off, create a template tourdates and a template tourdate. Setup appropriate family construction in the template under "family" so that the tourdate template is only addable under the tourdates template.

Then you create a datetime field called tour_date_start. Add the field to the tourdate template. Setup a page called /tours/ with the tourdates template. Make sure you setup the field correcty under the details tab.

Create an couple of pages (basicly dates) under /tours/.

Create a file called tourdates.php and loop the content as following:

foreach ($page->children as $tourdate) {
echo $tourdate->title; // this is the title
echo $tourdate->tour_date_start; // this is your date
}

If you want to show them at another page, i.e. the homepage you can do the following:

$getTourDates = $pages->get("/tours/")->children(); // Get the parent and loop through these use the above example.

If you want to sort them by date turn on autojoin at the field page in the admin - it's under advanced. Then you can sort them by tour_date_start like:

$getTourDates = $pages->get("/tours/")->children(sort=tour_date_start); // Get the parent and loop through these sorted use the above example.
  • Like 2
Link to comment
Share on other sites

Great answer Arjen. One correction though: autojoin is not required to sort by date.

And welcome Lucas!

Hmmm, I always assumed that to sort any field (except title) it has to be autojoined. Thanks for the info!

Link to comment
Share on other sites

@ryan: On autojoin being a requirement for sorting you said:

This used to be the case but isn't anymore.

I guess the help text in the advanced section of field edit should be corrected then? Currently it's misleading.

If checked, the data for this field will be loaded with every instance of the page, regardless of whether it's used at the time. If unchecked, the data will be loaded on-demand, and only when the field is specifically accessed. Enabling autojoin also allows the field to be used as a key for sorting pages.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By AndZyk
      The Architekturforum Freiburg sees itself as a regional platform for information and exchange about architecture, urban planning, landscape architecture and building culture. On the website you can register for events, view presentations or become a member.
      The website uses UIkit as framework and Workbox for the PWA.
      architekturforum-freiburg.de
       
      Features:
      Dynamic primary color Structured data  
      Dynamic primary color

      The events are grouped in programs and every program can have its own color. For this I used the awesome module Color. I defined a fixed color palette, so that no ugly colors could be selected and I worked for the first time with CSS variables. With CSS variables you are more flexible than with f.e. SCSS variables and can change the primary color for the whole website on the fly. This is used on the detail page of events with a different primary color.
       
      Structured data
      It was important for me to provide the correct structured data for the events. Since the pandemic they have been enhanced for online, offline and mixed events.
       
      Modules used:
      Repeater Matrix Form Builder Functional Fields Map Marker ProCache Upgrades TOTP two-factor authentication Tracy Debugger Color Sitemap Email Obfuscation (EMO)  
      Regards, Andreas
    • By MarkE
      This post is related to 
      but is a different way of tackling the problem.
      The idea is to use the JqueryUI.module in the front end to present a restricted access admin page in a modal (class pw-modal). However the JqueryUI module doesn't seem to work properly in the front end (I have it working in the back end OK). I'm guessing that this is because the front end page has not loaded all the .js that is needed (that would normally be loaded in the back end). My _main.php loads the following from the core at the moment:
      'wire/modules/AdminTheme/AdminThemeUikit/uikit/dist/js/uikit.min.js' 'wire/modules/AdminTheme/AdminThemeUikit/uikit/dist/js/uikit-icons.min.js' 'wire/modules/Jquery/JqueryCore/JqueryCore.js' 'wire/modules/Jquery/JqueryUI/JqueryUI.js' Any ideas what else I need, or have I got hold of the wrong end of the stick?
    • By AndZyk
      This is a website for the musical area of the protestant town church Pforzheim, Germany. Our agency designconcepts developed a website that provides informations about the choirs, ensembles and orchestras as well as dates for their rehearsals, services and concerts.
      The website was build with help of the framework UIkit.
      www.musik.stadtkirche-pforzheim.de
       
      Features:
      Events Download dates  
      Events

      The events for rehearsals, services and concerts were created in Microsoft Excel and then imported as pages from CSV. For better organization, events are cross-referenced with choirs, ensembles and orchestras. Services and concerts are displayed in a events list, but rehearsals are only displayed on the page of the choir, ensemble or orchestra, to make the events list more compact.
       
      Download dates

      It is possible to download every event date as ICS file, which will be generated on clicking the download button. You can then add this event easily to your calendar app and stay up-to-date.
       
      Modules used:
      Email Obfuscation (EMO) Front-End Page Editor Import Pages from CSV Markup Sitemap XML ProCache Tracy Debugger Upgrades Wire Mail SMTP  
      Regards, Andreas
       
    • By SwimToWin
      Hi, I am in the process of creating a local news site, based on ProcessWire.
      Among other things, the site will be presenting local events, and I have a question specifically about recurring events.
      Events (recurring or not) shall be shown in *one* list, like in this example:
      10.01.2019 19:30 - Some event (Page #1235) 11.01.2019 17:15 - Another event (Page #1237) 12.01.2019 16:00 - The Final Event (Page #1239) When I have recurring events, I would like to keep these on the same page (using a Repeater field) as shown here:
      10.01.2019 19:00 - A Star is Born film, showing in Cinema ABC (Page #1234 holds all occurrences) 10.01.2019 19:30 - Some event (Page #1235) 11.01.2019 19:30 - A Star is Born film, showing in Cinema ABC (Page #1234 holds all occurrences) 11.01.2019 17:15 - Another event (Page #1237) 12.01.2019 20:00 - A Star is Born film, showing in Cinema ABC (Page #1234 holds all occurrences) 12.01.2019 16:00 - The Final Event (Page #1239) The editing interface will use these fields:
      id title date_start - a datetime field (use for one-time events) time_start - a text field dates - Repeat field with these sub-fields: date_start - a datetime field (use for recurring events) time_start - a text field Listing events by date_start is simple when the site only has run-once events (using the 'date_start' field). But when repeated events enter the picture, it is necesssary to generate all occurrences for each repeated event ('dates.date_start') - and join these with the list of run-once events ('date_start'). I am unsure if that is possible?
      PS: I am aware that Ryan created an Events fieldtype module, unfortunately the site needs more detail about each event than this module offers so it is easier to create a site-specific set of Event fields.
    • By BrendonKoz
      I began writing this module from scratch, basing it off simple examples of modules, trying to learn the necessary methods required to create a fieldtype. I was WAY off, but learned a lot. Eventually I moved towards examining the FieldtypeEvents example from Ryan and, in many areas, copy/pasting and then adjusting the code (and then trying to determine what it all was doing) method by method, file by file (from his example to my module).
      I've gotten to the point where I was ready to test the code - I haven't fully fleshed out my visual interface, nor integrated any of the 3rd party API tools this will (can) take advantage of. I also haven't implemented any JS or CSS for the interface. Right now I'm just trying to get it to save and then display any of the data that has been entered into the form fields of a template from the admin. When I save the page, the field is reset to defaults and no feedback message (for the field) is shown at the top of the page upon reload. When using Tracy Debugger from within the processInput method (immediately attempting to debug the $input variable), Tracy caught no data to be shown.
      If anyone has some time to take a quick look and see what I might've done wrong I'd be super grateful. I've had no forward progress in about 3 days (and like many others was unable to get Xdebug breakpoints working in PHPStorm). 😞
      https://github.com/BrendonKoz/FieldtypeBooks
×
×
  • Create New...