Jump to content
thomasklaiber

Event calendar, returning events and dublicate entries

Recommended Posts

Hello,

I'm new to processwire and currently working on my first (real) site.

Now I'm searching for a good soluton for an event calendar (just a date-based event list).

For now I've created everything (pages, templates, fields) well and it works theoretically.

BUT

In this case every Event is called "Training" but with different content and different dates.

Now Processwire prevents dublicate entries in the backend with an error - what is okay because not every event can have the path "/events/training/".

My first solution would be addingt the date to the name like /events/training-2013-06-23/ .. BUT I would always have to change this manually, when the date of an event is changed AND this wouldn't be automatic.

So I need a really simple solution for this problem .. is it possible to add the date to the name automatically when the page is saved? Something like this would be great.

Share this post


Link to post
Share on other sites

Thanks adrian - I forgot I'd even written that, but I need to do something very similar tomorrow so I'm glad you linked to it :D

Share this post


Link to post
Share on other sites

Well I got another problem over here. The example code works perfectly like I wanted it.

$page->name = $this->sanitizer->pageName($page->title, true)."-".date("d-m-Y", $page->getUnformatted(date));

But the sanitizer doesnt work as exspected. It doesnt convert special characters (like ä ö ü) right in this case. For normal pages it works correctly (I added them to the character replacement list) ... do I have to change something if I use the function in a module?

Share this post


Link to post
Share on other sites

Found the solution myself, I can't just set the second parameter of pageName to true, I have to set it "Sanitizer::translate".

Correct code that works: ^-^

 $page->name = $this->sanitizer->pageName($page->title, Sanitizer::translate)."-".date("d-m-Y", $page->getUnformatted(date));
 
  • Like 3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By VeiJari
      Hello forum! 
      Our customer wants to choose only 15 minute intervals in the inputfield Datetime. So the dropdown values would be: 0, 15, 30 and 45.
      Is there an easy way to achieve this?
      Any help is appreciated 🙂
    • By neophron
      Hi,
      I'm looking for a calendar solution. It should be like this: http://www.graalmueritz.net/plan-aurum.php
      The important part is, that the calendar should show 4 different stages:
      1. free
      2. arrival
      3. departure
      4. occupied
      and the actual date.
      This is for a german website. The client wants to manage the calendar be themself.
      I need detailed offers/estimations in €.
       
      thank you, Nikolai
       

    • 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...