-
Posts
420 -
Joined
-
Last visited
Everything posted by BFD Calendar
-
I click on the field, then type the numbers I want and hit return. Same for text, type the first few letters and the field moves to what I want, hit return.... On a MacBook Pro.
-
I'm using three fields to calculate the date of an event, bfd_day, bfd_month and bfd_year. All are 'integer' fields. When 'bfd_year' is less than 100 the date turns into the 2000s. Cicero, died in 43bc suddenly died in 2043bc.... Would it make a difference if 'bfd_year' is a text or float field? And if so, will I keep all my data if I change the field from integer to text? Here's what I use to calculate the date: $day = $page->bfd_day->title; $month = $page->bfd_month->title; $year = $page->bfd_year; $fulldate = new DateTime("$year-$month-$day"); echo "{$fulldate->format("l jS \of F Y")}"; if(trim($page->bfd_date_bc->title)=='bc') { echo "bc"; }; $thisyear = date("Y"); if(trim($page->bfd_date_bc->title)=='bc') { echo $thisyear + $page->bfd_year . " years ago"; } else { echo $thisyear - $page->bfd_year . " years ago"; }; The 'years ago' calculation works fine, it says Cicero died 2056 years ago today.
-
$features = $pages->find("parent=/events/, bfd_month.name=$month, bfd_day.name=$day, sort=bfd_day, sort=bfd_year, sort=name"); $markers = new PageArray(); foreach($features as $feature) { $markers->add($feature->bfd_events_places_id_list); } if ($markers && $feature->bfd_day) { $map = $modules->get('MarkupGoogleMap'); $options = array('width' => '100%', 'height' => '500px', 'zoom' => '4'); echo $map->render($markers, 'MapMarker', $options); } else { echo ""; }; When there are two identical markers (two events happening on the same day in the same place in above example), the map is not rendered.
-
There appears to be a small bug with an AsmSelect input field. I have a list with numbers 01 to 31 as a 'day' field. Instead of scrolling down to numbers > 19 I type the number and hit return. Works fine with any number except '22'. Typing '22' results in '21' getting entered. To enter '22' I need to type '222'. A Catch 22 or an Easter egg?
-
To pick this up again, I'm using twitterfeed.com to get a feed from a Blogger page and then send it to Twitter and several Facebook pages. I also get the feed with mailchimp.com and send it out as a daily mail to subscribers. All automatically as soon as a new post is added to Blogger. The posts at Blogger are scheduled to publish every day between 1.00 and 2.00 am to make sure everybody wakes up with suggestions for some celebrations of the day. I'm hoping to do this from ProcessWire from 1 January 2014 onwards, if possible also send the feed to Blogger as well.
-
Huh, less is more I guess. Anyway, it works. Thank you! One more (additional) question: how do I keep the 'class' 'on' for months when events are shown? $class = $child === $page ? " class='on'" : ''; Keeps the parent 'on' but it should keep the parent of parent 'on' as well to have a better idea of the navigation. ps @ gebeer -> http://www.birthfactdeathcalendar.net/bfd_processwire/the-eyes/1-january-2000-bangkok-thailand/
-
When I'm on '/events/months/january/january-02/' $page->parent->name=january I added a bit of code on the page to make it visible: <?php echo "<br><br>page name = {$page->name} / parent name = {$page->parent->name}<br>"; if ($page->parent->name==months) { echo "parent=/months/<br>"; } elseif ($page->parent->name==january) { echo "parent=/january/"; } else { echo "nope"; }; ?>
-
In the same line of thought.... I have a menu with months and a submenu with days for every month. The idea is to click on a month's name, then a day's number and see a list of pages that have a matching 'month' and 'day' field. 'months' is a parent with 12 children (january, february,....), every month is a parent with 29, 30 or 31 children (january_01, january_02,....). When I'm on the 'months' page I see the '12-months' menu, when I click on a month I see the 'days menu'. But when I click on a day, the 'days menu' disappears. While the list of items for that month and day shows up correct. In the code below, where is my 'days menu' disappearing? <!-- NAVIGATION FOR MONTHS --> <div> <ul id='topnavmonths'> <?php $monthpage = $pages->get("/events/months/"); $children = $monthpage->children; foreach($children as $child) { $class = $child === $page ? " class='on'" : ''; echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>"; }; ?> </ul> </div> <br> <!-- NAVIGATION FOR DAYS --> <div> <ul id='topnavmonths'> <?php if ($page->parent->name==months) { $daypage = $pages->get("/events/months/$page->name/"); } else { $daypage = $pages->get("/events/months/$page->parent->name/"); }; $children = $daypage->children; foreach($children as $child) { $class = $child === $page ? " class='on'" : ''; echo "<li><a$class href='{$child->url}'>{$child->bfd_day->title}</a></li>"; }; ?> </ul> </div> For a (not) working example: http://www.birthfactdeathcalendar.net/bfd_processwire/events/
-
YES! Thank you very much. I would never have thought of anything like this. Any idea where/how I can pimp by low/moderate php skills to handle such situations?
-
When passing $features there is no map at all.... The MapMarker field is called into 'events' by a matching id, 'bfd_events_places_id_list' is the page id of a 'place' page. A 'place' page can be used for more than one event. When the id matches the fields from the 'place' page (name, street, city, state, country, MapMarker) are shown on the 'event' page, with the correct map. echo "{$placepage->MapMarker}"; shows the individual 'MapMarker' data in the foreach list but I can't find how to enter it in the $map->render(), except that it only shows the last marker.
-
Trying to get multiple markers on a map. All found MapMarker entries show up in the list, but only the last one from the list shows up on the map. How do I get them all to show up on the map? $features = $pages->find("parent=/events/, bfd_day.name=$todayday, bfd_month.name=$todaymonth, sort=bfd_year"); foreach($features as $feature) { $placepage = $feature->bfd_events_places_id_list; echo "{$placepage->MapMarker}"; }; $map = $modules->get('MarkupGoogleMap'); $options = array('width' => '100%', 'height' => '400px'); echo $map->render($placepage, 'MapMarker', $options);
-
Using a variable from one template on another
BFD Calendar replied to BFD Calendar's topic in API & Templates
Morning has broken - 'if( ) { }' followed by 'else { }' did the trick. -
Using a variable from one template on another
BFD Calendar replied to BFD Calendar's topic in API & Templates
Still wrestling with this.... $features = $pages->find("parent=/events/, bfd_day.name=$todayday, bfd_month.name=$todaymonth, sort=bfd_year"); foreach($features as $feature) { $namepage = $feature->bfd_events_people_id_list; if($namepage->bfd_people_occupation->title) { $occupation = ucfirst($namepage->bfd_people_occupation->title); }; if($namepage->bfd_people_original) { $originally = ", originally " . $namepage->bfd_people_original; }; if($namepage->bfd_people_alias) { $alias = " aka " . $namepage->bfd_people_alias; }; echo "{$occupation}<b><a href='{$namepage->url}'> {$namepage->bfd_people_name}</a>{$originally}{$alias}</b>"; results in: occupation1 name1 originally1 (= ok because there is no alias) occupation2 name2 originally1 alias2 (= not ok because it repeats originally1 while there is no originally) occupation2 name3 originally1 alias2 (= not ok because it repeats originally1 while there is no originally and it repeats alias2 while there is no alias) What am I doing wrong? -
Impressive site for an impressive offer of courses and events at the art center.
-
Thank you. Some group permissions were not writable. Strange because I've been uploading pictures and creating lots of pages that will hold pictures in the near future. It all started with adding one module, if I remember right it might have been 'AutoUpgrade'. It kept showing a message that there was a new version of ProcessWire while there wasn't. Anyway, with 'ModuleManager' I presume the FTP errors will no longer occur.
-
Using a variable from one template on another
BFD Calendar replied to BFD Calendar's topic in API & Templates
That works fine. This is the variable on 'bfd_events_births': $namepage = $pages->get("template=bfd_people, id=$page->bfd_events_people_id_list"); $occupation = ucfirst($namepage->bfd_people_occupation->title); if($namepage->bfd_people_original) { $originally = ", originally " . $namepage->bfd_people_original; }; if($namepage->bfd_people_alias) { $alias = " aka " . $namepage->bfd_people_alias; }; $page->namecalc = array('<b><a href=', $namepage->url, '>', $occupation, ' ', $namepage->bfd_people_name_first, ' ', $namepage->bfd_people_name_last, $originally, $alias, '</a></b> is born '); foreach($page->namecalc as $f) { echo "$f"; }; This is more complicated. The variable should show up in a list on the home page. That list gets information from any child page/template from parent '/events/'. So, what should I understand from '345'? And can I assume that 'namecalc' is the varname in my example? And in general where can one find/learn more about this, preferably in plain language? -
I have an 'events_births' template that has a date field and then calls a name and place from a 'people' and 'places' page. Both 'name' and 'place' require some calculation from their respective pages, some people have original names or aliases, some places have a name and street address, while others haven't. They are calculated in '$namecalc' and '$placecalc'. Now I want to use the '$namecalc' and '$placecalc' show up in a list of events. I manage to list the date field, but find no way for the other information. Secondly I'd like the '$placecalc' items show up on a map.... My code on the 'events_births' template: // NAME FROM PEOPLE PAGE $namepage = $pages->get("template=bfd_people, id=$page->bfd_events_people_id_list"); $occupation = ucfirst($namepage->bfd_people_occupation->title); if($namepage->bfd_people_original) { $originally = ", originally " . $namepage->bfd_people_original; }; if($namepage->bfd_people_alias) { $alias = " aka " . $namepage->bfd_people_alias; }; $namecalc = "<b><a href='{$namepage->url}'>{$occupation} {$namepage->bfd_people_name_first} {$namepage->bfd_people_name_middle} {$namepage->bfd_people_name_last}{$originally}{$alias} </a></b> is born "; echo $namecalc; // LOCATION FROM PLACES PAGE $placepage = $pages->get("template=bfd_places, id=$page->bfd_events_places_id_list"); if($placepage->bfd_places_name) { $name = $placepage->bfd_places_name . ", "; }; if($placepage->bfd_places_street) { $street = $placepage->bfd_places_street . ", "; }; if($placepage->bfd_places_district) { $district = $placepage->bfd_places_district . ", "; }; if($placepage->bfd_places_state) { $state = $placepage->bfd_places_state->title . ", "; }; $placecalc = "in <b><a href='{$placepage->url}'>{$name}{$street}{$district}{$placepage->bfd_places_city->title}, {$placepage->bfd_places_state->title}{$placepage->bfd_places_country->title}</a></b>."; echo $placecalc; On the list page: echo "<span class='nobelbold_32px'>" . date("j") . " " . date ("F") . "</span><br><br>"; $todayday = date("d"); $todaymonth = date("m"); $features = $pages->find("parent=/events/, bfd_day.name=$todayday, bfd_month.name=$todaymonth, sort=bfd_year"); foreach($features as $feature) $name = $feature->get("$nameresult"); echo "<li><span class='nobelbold_24px_grey'><a href='{$feature->url}'>{$feature->bfd_year}</a> {$feature->bfd_case->title} {$name}</span></li>"; $mapitems = $pages->find("parent=/events/, bfd_day.name=$todayday, bfd_month.name=$todaymonth, MapMarker=' ', sort=bfd_year"); $map = $modules->get('MarkupGoogleMap'); echo "<br>{$map->render($mapitems, 'MapMarker', array('height' => '400px', 'zoom' => '2', 'lat' => '50.923813', 'lng' => '4.431493'))}"; Needless to say that my PHP knowledge is limited compared to most here.... thanks anyway.
-
There are two files 'Modules.23ca944d3100b563ecd52f1f9374d4c3.cache' and 'Modules.93208021ee90fbcf7e364f5ed7d1b95d.cache'. The first one has a list of 110 module names, the second one a list of 6. Removing them results in 'The server encountered an internal error or misconfiguration and was unable to complete your request'. Any chance of editing the cache files in a text editor and solve the problem? Or delete them all and re-install, starting with the Modules Manager perhaps.... Edit. I manually edited 'Modules.93208021ee90fbcf7e364f5ed7d1b95d.cache' with the missing module names, and they are all back! Yay.
-
If you set your map to satellite view these 'points of interest' don't show up. Well, only parks and some official buildings do but no business stuff. When zooming in, street names are all visible and people can even switch to street view to actually see the place you're 'marking'.
-
The markers now fit the map better, no more two Alaskas showing. Still, only the height option works with the solution above. When generating three maps on the same page, the first and third are exactly the same apart from height. In the second zoom and coordinates work but no markers. <?php $map = $modules->get('MarkupGoogleMap'); $places = $pages->find("template=bfd_places, MapMarker!='', sort=title"); echo $map->render($places, 'MapMarker', array('height' => '400px')); ?> <hr> <?php echo $map->render(new PageArray($pages->find("template=bfd_places")), 'MapMarker', array('height' => '400px', 'zoom' => '5', 'lat' => '50.923813', 'lng' => '4.431493')); ?> <hr> <?php $places = $pages->find("template=bfd_places"); $options = array('width' => '100%', 'height' => '300px', 'zoom' => '5', 'lat' => '50.923813', 'lng' => '4.431493'); echo $map->render($places, 'MapMarker', $options); ?> See result here: http://www.birthfactdeathcalendar.net/bfd_processwire/places/ Entering an address or coordinates in the MapMarker address field doesn't keep the info yet upon publishing the page either. It still needs to be entered twice. Once in a while, when fiddling with zoom or moving the marker on the map before publishing the page it keeps the input properly. Using the new version and will try out the new icon and hover options soon. Thank you for that.
-
Thank you. Truly I didn't look for an answer because there was no real problem. And since it didn't look like a real problem I thought it was a kind of 'easter egg' hidden by some smart programmer
-
Contrary to what I read in other posts, there were no changes on my server. I left off work last night and logged in this morning with this error. Apart from losing an unpublished page everything works fine now. And pardon me for not knowing all of ProcessWire's history and quirks while finally discovering something 'funny' between the mass of cryptic errors and solutions I'm usually confronted with.
-
This request was aborted because it appears to be forged.