Jump to content

joe_ma

Members
  • Posts

    182
  • Joined

  • Last visited

Everything posted by joe_ma

  1. Thanks kongondo for these kind words. I shall test things as you suggest. I hope, I am not hopeless …
  2. Many thanks Macrura. I have already rebuilt the site as suggested by onjegolders. But I think your hint for getting the repeater fields helped me with another problem. Though not quite yet. May I kindly ask you to have a look at that thread as well?
  3. Macrura kindly helped me with another, similar problem with repeater fields. Thanks again. So I tried to simplify the code for the problem with the listing of the daily events. $days = array(); // array for dates $events = $pages->find("template=repeater_time_loc, check_access=0"); //get all the repeaters with event information foreach ($events as $event) { $days[] = $event->getUnformatted("date"); // put event date into the array $vorstellung = $event->getForPage(); // get the parent page of the repeater } $day = array_unique($days); // eliminate duplicate dates asort($day); foreach($day as $key => $d) { // list all the dates $today_events = $events->find("date=$d"); // find the array of events for this date and put into new array $today_events $dat = date('l, d. M Y', $d); echo "<h3>($key) = $dat</h3>"; foreach ($today_events as $doday_ev) { echo "<p><a href='{$vorstellung->url}'>{$vorstellung->title}, {$today_ev->time} Uhr</a></p>"; } } But that still doesn't work correctly. Now I get the list of the dates correctly displayed, but each date lists only one event and this is always the same one (Note the exception for Monday, 28. Apr 2014). (0) = Thursday, 10. Apr 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr (1) = Tuesday, 15. Apr 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr (2) = Wednesday, 23. Apr 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr (3) = Thursday, 24. Apr 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr (4) = Friday, 25. Apr 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr (7) = Saturday, 26. Apr 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr (8) = Sunday, 27. Apr 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr (9) = Monday, 28. Apr 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr ZWISCHEN REBELLION UND RESIGNATION, Uhr (5) = Wednesday, 07. May 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr (6) = Thursday, 15. May 2014 ZWISCHEN REBELLION UND RESIGNATION, Uhr
  4. Hi onjegolders Ah, I haven't been aware, that there is also this possibility. I have always thought, you would have to create all the pages first, in order to use them on pages. As always: PW is far easier than you would think. Thanks onjegolders. You've made my day.
  5. Ah, … not quite. I think the url part is not correlated to the items in the $mw_name array. But I have no clue about how to correlate them. Because I find it easyer to list the performers directly on the event page. Like that, no one gets forgotten. Also, making a list of all the performers first is more work to do … ;-)
  6. Hello I am still struggling with repeaters and cannot find a solution for this one: For a festival site I put up pages for the events (every page contains a single event). For the names of the performers I use a repeater field called "mitwirkend". Now I should like to have a directory, that lists all the performers. Each name should link to the event, where it is listed. My code looks like this: $programm = $pages->find("template=event"); //find all pages with events $mw_name = array(); // array for the names of the performers foreach ($programm as $p) { loop through the pages found $mitwirkende = $p->mitwirkend; //find the repeater fields foreach ($mitwirkende as $mw) { // loop through the repeater $mw_name[] = $mw->mw_name; $intlink = $mw->parent->url; //get the url of the parent page } //end repeater loop } //end page loop asort($mw_name); foreach ($mw_name as $key => $m){ echo "<p><a href='$intlink'>{$m}</a></p>"; } That lists all the names of the performers as expected. But the links are not correct. Every href contains the same link, the one from the last event page it is looping through. How could I associate the correct url to each name? Thanks for help.
  7. Well, nearly there … This is my code: $programm = $pages->find("template=event"); //find all pages with events $days = array(); // array for dates - defined once at the start foreach ($programm as $p) { $events = $p->time_loc; //find the repeater fields foreach ($events as $event) { $days[] = $event->getUnformatted("date"); $event->event_title = $p->title; // add propertiy event_title to the $event object $event->event_url = $p->url; // add propertiy event_url to the $event object } } //close programm loop $day = array_unique($days); // eliminate duplicate dates asort($day); foreach($day as $key => $d) { // list all the dates $dat_events = $events->find("date=$d"); // find the array of events for this date and put into new array $dat_events $dat = date('l, d. M Y', $d); echo "<h3>($key) = $dat</h3>"; foreach ($dat_events as $dat_ev){ //loop through the dayly events and link to them echo "<p><a href='{$dat_ev->event_url}'>{$dat_ev->event_title}, {$dat_ev->time} Uhr</a></p>"; } // close loop for dayly events } //close loop for list of dates That outputs this: (0) = Thursday, 10. Apr 2014 (1) = Tuesday, 15. Apr 2014 (2) = Wednesday, 23. Apr 2014 (3) = Thursday, 24. Apr 2014 (4) = Friday, 25. Apr 2014 (7) = Saturday, 26. Apr 2014 (8) = Sunday, 27. Apr 2014 (9) = Monday, 28. Apr 2014 ZWISCHEN REBELLION UND RESIGNATION, 21:00 Uhr (5) = Wednesday, 07. May 2014 (6) = Thursday, 15. May 2014 So only the events for the last key in the array of $day are listed. Still confused.
  8. Yes, thanks a lot, now I get all the dates right. I hope, I manage to do the rest as required …
  9. Ah, thanks Adrian. This brought me one step further. My code now looks like this (for testing the dates): $programm = $pages->find("template=event"); //find all pages with events foreach ($programm as $p) { $events = $p->time_loc; //find the repeater fields $days = array(); // array for dates foreach ($events as $event) { $days[]= date("l, d. M Y",$event->getUnformatted("date")); //fill the dates array with the dates from the repeater } $day = array_unique($days); // eliminate duplicate dates asort($day); foreach($day as $key => $d) { echo "<p>$key = $d</p>"; } } That outputs this: 0 = Thursday, 10. Apr 2014 1 = Tuesday, 15. Apr 2014 2 = Friday, 25. Apr 2014 1 = Thursday, 24. Apr 2014 0 = Wednesday, 23. Apr 2014 1 = Thursday, 15. May 2014 0 = Wednesday, 07. May 2014 0 = Saturday, 26. Apr 2014 0 = Sunday, 27. Apr 2014 0 = Monday, 28. Apr 2014 0 = Monday, 28. Apr 2014 So, clearly I still haven't got the array_unique right.
  10. Hello Maybe one of you could help with my problem as well? See this thread. Thanks a lot!
  11. Nothing at all. No HTML Markup either. As far as I could find out with testing, this code is finding the pages with the events. I could produce a list of all the pages with events. But I could not find out, how to handle the dates and times of the events correctly. There are events, that can take place on more than one day, or twice or more times at the same day and even on different locations. All this is stored in the repeater field. What I try to achieve is a list like that: Date 1: - event 1, time xx, location yy - event 1, time xy, location yz - event 2, time, location Date 2: -event 1, time, location -event 2, time, location and so on, you get the idea. Oh, silly me. I think I misunderstood your question. The HTML structure is being output, but no lists whatsoever. So I have tried to work slowly from the beginning like this: $programm = $pages->find("template=event"); //find all pages of events that contain the repeater field So far everything is ok, I could output a list of these pages. Next step: $events = $programm->time_loc; //find the repeater fields that include the fields "date" and "location" $days = array(); // find the array of dates for all events foreach ($events as $event) { $days[]= date("l, d. M Y", $event->getUnformatted("date")); } $days = array_unique($days); asort($days); print_r ($days); This outputs Array() So, clearly there must be something wrong already here. But I have still no clue.
  12. Well, back from my holydays. I thought, a little timeout would do some good to my brain. But alas … I am really stuck on this issue and would appreciate any help or hints about the right direction to go. I think I went wrong right at the beginning with the $days array, but I haven't a clue about how.
  13. OK, back in the office. I have tried to modify Joss’s code for my needs. Alas, no success! So here’s my setup: - every event is on its own page as a subpage of /events/ - every event page has a repeater field called "time_loc" with the fields "date" and "location" And here’s my code: $events = $pages->find("parent=/events/"); //find all pages with events $datum = $events->time_loc; //find the repeater field in each page $days = array(); $out =""; // find the array of dates for all events foreach ($datum as $d) { $days[]= $d->date; //add d_datum property $d->d_datum = date("l d F Y", $d->getUnformatted("date")); //add d_time property $d->d_time = date("H:i", $d->getUnformatted("date")); } $days = array_unique($days); asort($days); foreach($days as $key => $day) { // Output the date $out .="<h2>{$day}</h2>"; // find the array of events on this date and put into new array $day_events $day_events = $d->find("d_datum=$days"); $out .= "<ul>"; foreach ($day_events as $day_event){ $out .= "<li>{$day_event->title}<br>{$day_event->d_time} Uhr; {$day_event->time_loc('location')}</li>"; } $out .="</ul>"; } echo $out; That doesn’t output anything.
  14. Thanks everybody for these answers. I'll give it a try. Tomorrow, that is ;-), because I am out of office for the rest of the day.
  15. Hello I am building a site for a festival, the events of which can take place on several dates and/or times and in several locations. Like this: - event 1: 25. 6. 2014, 14:00 h, location 1 25. 6. 2014, 16:00 h, location 2 26. 6. 2014, 14:00 h, location 1 - event 2: 25. 6. 2014, 14:00 h, location 3 26. 6. 2014, 14:00 h, location 2 and so on. So I created a repeater field called "time_loc" with the input fields date (for the date and the time) and location. Now I should like to output a list of events for each date, like this: 25. 6. 2014 - 14:00 h, event 1, location 1 - 14:00 h, event 2, location 3 - 16:00 h, event 1, location 2 26. 6. 2014 - 14:00 h, event 1, location 1 - 14:00 h, event 2, location 2 … But I haven't the faintest about how to sort the date fields from the repeater field, nor how to make the list. Thanks for help.
  16. Oh, as simple as that Thanks Fokke. There is always a surprisingly easy way with PW. Great!
  17. Hello I am working on a multi-language site, where I have news articles that have fields for lead and body. Now, when the lead field of one language is empty, the template takes the text from the default language. I should rather like the template to display nothing at all. My code: foreach ($news as $n) { if ($n->lead) { echo "<p><strong>{$n->lead}</strong></p>";} echo "{$n->body}"; } Obviously the if statement is not looking in the active language only. So how do I tell it to do so?
  18. Thanks, Wanze. I have tried your version. And lo! it works!
  19. I have tried to implement this on a multilanguage site and also got only the one pdf from the main language. Here's what I did: - created a fieldtype "file" for every language (pdf, pdf_fr, pdf_it) - created a template "pdf" with all these fields - created "pdf.php" with the above code - uploaded corresponding pdf-files into these fields - in the body text I linked to the pdf-files (which worked as expected: in all languages I could link to the corresponding files) What happens is, that in all languages you get always the pdf-file from the main language. So I tried to modify the code for the pdf.php like this: if ($page->pdf) { wireSendFile($page->pdf->filename); } elseif ($page->pdf_fr) { wireSendFile($page->pdf_fr->filename); } else { wireSendFile($page->pdf_it->filename); } Still only the one version from the main language. So I tried this: if ($user->language == "default") { if ($page->pdf) { wireSendFile($page->pdf->filename); } } elseif ($user->language == "francais") { if ($page->pdf_fr) { wireSendFile($page->pdf_fr->filename); } } else { if ($page->pdf_it) { wireSendFile($page->pdf_it->filename); } } That produces a blank page when clicking on the link to the file. I don't seem to be capable to get it right.
  20. I also agree with Joss . The way he suggested works fine. Thank you very much!
  21. Hello I am trying to implement some kind of HTML5 audio player. Users should be able to upload their music files that are automatically included in <audio> tags. Here's my approach so far: - for every new audio I use a new page that has only one field of the type "file" named "audio". I limited the uploads to two, as you need mp3 and ogg files for the player to work in most browsers. These pages are all subpages of a hidden page with no template. In the template, where I like to play the audiofiles, I put the following code: <?php $audios = $pages->find("parent=/audiodateien/"); if (count($audios)) { echo "<h2>Einige unserer Musikstücke</h2>"; $out = ''; $out .='<ul>'; foreach ($audios as $audio) { $out .="<li>{$audio->title}<br>"; $out .="<audio controls autobuffer>"; $audiofiles = $audio->audio->filename; foreach ($audiofiles as $audiofile) { $out .="<source src='{$audiofile->url}' />"; $out .="</audio>"; } } $out .='</ul>'; echo $out; } ?> But this produces only a list with the titles and empty <audio> tags. Obviously I didn’t get the part with the audiofiles right. Thanks for help.
  22. As one of the maintainers of the site I can only agree with everyone here. Thanks Soma, it is really something to be proud of. And thanks to ryan as well for this great system. It is really easy to work with. It makes maintaining a multi language site very easy. I know, what I am talking of …
  23. Hmm … I added value="submit". No result either. I replaced the button with the original input-field (<input type="submit" name="submit" value="submit" id="submit">). No result either. Edit: I have just become aware, that I had different names for "zeit" in the $form array and the input field. And I left out the following lines from Soma's original code: <?php if($error) { echo $error_message; // or pull from a PW field } ?> Now I have corrected both mistakes. But still no result. When I completely fill out the form I receive the error message So, there must still be som kind of error. Edit 2: When I skip the $sanitizer->text(), the form is being submitted. Finally. Thank you teppo for your precious help.
  24. Thanks Teppo I made a simple test for mail(). It worked perfectly. So mail() doesn't seem to be the problem. There is also no entry in the error log. And I don't get any feedbacks with debug mode on.
×
×
  • Create New...