Jump to content

Event calendar, returning events and dublicate entries


Recommended Posts


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.


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.

Link to comment
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?

Link to comment
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
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

  • Create New...