Jump to content

apeisa

Moderators
  • Posts

    4,632
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by apeisa

  1. There is artist id also from last.fm, but I am only querying events (and it only gives artist name, id:s only for events). So that would require another request from last.fm api.
  2. My first idea was this: if ($headlinerNameUrl == '') { $headlinerNameUrl = $wire->sanitizer->pageName(urlencode($headlinerName), true); } And it gives us nice url: e3-82-ae-e3-83-ab-e3-82-ac-e3-83-a1-e3-83-83-e3-82-b7-e3-83-a5 I'll live with that now, since it really doesn't matter in this point. There probably could be something much nicer for this one, but this is "rock solid"
  3. Hah, I got one more problem. Though I fully understand why (but I don't know best way to handle it yet...). I have artist called: ギルガメッシュ So after sanitizer it goes very nice: (this space intentionally left empty) And saving currently gives error: Uncaught exception 'WireException' with message 'Can't save page 0: /artisti/0/: It has an empty 'name' field'
  4. You bet right, it works like a dream. Thank you (again) very much! You will be first person to play with our app when we get it ready. It is gonna be supersweet (mobile html5 app)!
  5. I commented $gig->save() on this one and tested rest of the script. Similar situation also fails on artist called: Super8 & Tab. There is also ampersand, so it is probably the reason. It get's manipulated in some point - probably on db save. This is the code that fails when $supporter = "Super8 & Tab" $supporterNameUrl = $wire->sanitizer->pageName($supporter); $support = $wire->pages->get("template=artist, name=$supporterNameUrl"); if (!$support->id) { $support = new Page(); $support->template = 'artist'; $support->parent = $artist_parent; $support->title = $supporter; $support->name = $supporterNameUrl; $support->save(); }
  6. Here is the problematic part of the code: $gigName = $event['title'] . '-' . $event['id']; $gigNameUrl = $wire->sanitizer->pageName($gigName); $gig = $wire->pages->get("template=gig, name=$gigNameUrl"); if ($gig->id) { echo $gig->title . ": gig is already in database, we only update \n"; } else { $gig = new Page(); $gig->template = 'gig'; $gig->parent = $gig_parent; } ... update values ... $gig->name = $gigNameUrl; $gig->save() It works on other events, but for some reason not for this one... Somehow if($gig->id) returns false, but then I set the exact same value ($gigNameUrl) as name and still duplicate...
  7. It is there, but shouldn't this do update in this case? I try to look if the page is already there, if not, then create new page, else update info & save.
  8. Original title is: PROJECT DECAY (NOR) w/ VIISIKKO & FLESHPRESS-1751059 It must be / or & doing bad things here?
  9. Thanks. I have something that my wife calls "ällöjuoma" -> "ugly drink" to support me I changed all to use name. It seems to work well mostly, but it gives me this error in one event. Only difference I can think of is that this name is rather long.. Uncaught exception 'WireDatabaseException' with message 'Duplicate entry 'project-decay-nor-w-viisikko-fleshpress-1751059-6984' for key 'name_parent_id'' in /srv/www/keikalle.com/public_html/wire/core/Database.php:72 Stack trace: #0 /srv/www/keikalle.com/public_html/wire/core/Pages.php(355): Database->query('INSERT INTO pag...') #1 [internal function]: Pages->___save(Object(Page)) #2 /srv/www/keikalle.com/public_html/wire/core/Wire.php(241): call_user_func_array(Array, Array) #3 /srv/www/keikalle.com/public_html/wire/core/Wire.php(203): Wire->runHooks('save', Array) #4 [internal function]: Wire->__call('save', Array) #5 /srv/www/keikalle.com/public_html/wire/core/Page.php(733): Pages->save(Object(Page)) #6 /srv/www/keikalle.com/cron/query_lastfm.sh(172): Page->save() #7 /srv/www/keikalle.com/cron/query_lastfm.sh(6): get_data(1, Object(ProcessWire)) #8 {main} thrown (line 72 of /srv/www/keikalle.com/public_html/wire/core/Database.php) This error message was shown because you are logged in as a Superuser. Here is some of my code: $gigName = $event['title'] . '-' . $event['id']; $gigNameUrl = $wire->sanitizer->pageName($gigName); $gig = $wire->pages->get("template=gig, name=$gigNameUrl"); if ($gig->id) { echo $gig->title . ": gig is already in database, we only update \n"; } else { $gig = new Page(); $gig->template = 'gig'; $gig->parent = $gig_parent; } $gig->title = $event['title']; // We dont use $gigName here because we don't want last.fm id to title $gig->datetime = $event['startDate']; $gig->venue = $venue; $gig->lastfmid = $event['id']; $gig->headliner = $head; foreach($supporter_pages as $supporter) { $gig->supporters->add($supporter); } unset($supporter_pages); $gig->name = $gigNameUrl; // Here we want to use gigNameUrl since there is also last.fm id (there are same names for different gigs) $gig->save();
  10. Thanks Ryan. I will change my selectors to name, I think it is cleaner in many ways. I don't know if it's good idea to code while being ill (common cold). I mean my script is a monster
  11. It works now. I am creating cron script that get's gig information from last.fm api. Problem was that I checked if I already have current support artist in database, if not, create new one. Also add new page to $supporter_pages array so I can later add it to related gig. This last part (adding to array) was only done when creating new pages, not if I already had it in database. if (count($wire->pages->find('template=artist, title="'.$supporter.'"'))) { $support = $wire->pages->find('template=artist, title="'.$supporter.'"'); $supporter_pages[] = $support; // <-- THIS WAS MISSING } else { $support = new Page(); .... Those selectors aren't probably best ones (title), I think it should be better to use $get and url? Is get faster?
  12. Thanks Ryan. No error msg so tt must be an error on my shell script.
  13. I have page field called "supporters" and it allows multiple pages. How I add multiple pages through API? Usually this is done like this: $gig->supporters = $page; This of course doesn't work with multiple pages. I tried this (found from current docs, used in images): $gig->supporters->add($page); But it doesn't work.
  14. Yep, I had that bug for a few moment, but I fixed it yesterday. There is also changes that fixes that original bug, so I suggest that you do following: Uninstall the module Remove (not required) the unnecessary adminbar pages from your admin Replace your module with latest files Install
  15. That would be perfect! I think installation profiles would be very cool thing for showcasing also. It would be nice to show ready & easy to install packages for ie. portfolio sites, product catalogs, blogs etc... I don't know how easy it is to export "ensemble", but Symphony has something similar: http://symphony-cms.com/download/ensembles/
  16. Heh, I made this and got redirect to 404. I thought it was somehow because of AdminBar.. but it wasn't. Spend few minutes itching my head and disabling all redirects on AdminBar.module... Thanks for the tips Ryan. Now AdminBar works with any admin url, latest files are on GitHub.
  17. Thanks for trying AdminBar and sorry for problems. Error is probably that I have hardcoded the /processwire/ site as admin site. If you have renamed your admin (so that url is not /processwire/), then it will fail like that. You can make quick fix by editing two lines (chance them to have your admin page url): https://github.com/apeisa/AdminBar/blob/master/AdminBar.module#L275 https://github.com/apeisa/AdminBar/blob/master/AdminBar.module#L308 I'll take a look how I could remove that hardcoding later today (I tried that earlier, but didn't work - Ryan, any clues? Probably some silly typo I had there...).
  18. I merged Adam's changes to adminbar. Also took cleaning further: I removed other options than modal and also cleaned js & css even more. It should work in IE now (I have only IE9 on my home computer and it works on that now. I am pretty confident that it works ok in other IE:s too - but no promises here ). Reasoning for taking options out: I think shortcuts will be the actual view that everyone uses: editing & creating will be done there. "Main" view will be for looking more information: who edited and when etc (hope to make that better later). And I think admin link should always take to admin front. Also: I think this as real 1.0 release. I'll fix all the bugs that people may a rise, but any new features will be added with care. Of course all the optimizing to code and UI are most welcome (from Adam or anyone who is interested in contributing).
  19. I actually like convention over configuration. When system is flexible like pw is, then it actually helps everyone that there is some common rules that cannot be changed. I am not sure how I feel about this one. Nice to know that there is ability to remove slashes or add .html to pages, but I am pretty sure that I never have to use these settings. Too many options = confusion. And have to agree with Ryan about SEO. Using time and energy for details like this won't be good tactic on the long run. Keep your markup and urls clean & coherent, concentrate on your content (there you might wanna analyze how people search for the content like yours and make sure to mention those phrases - as a natural part of your writing) and get the word out of your content (to get incoming links). You'll be fine.
  20. Adam: I feel your pain. We all have our love affair with ie...
  21. Thanks for the fix. And sure you can tweet the screencast.
  22. Thanks Adam. And no reason for stress because of this, early days and most important thing is to learn module dev. If someone has plans to use this on client site then please us know and we'll fix the "browser".
  23. Well.. there is small bug. After deleting a page we get this error: Call to a member function isAjax() on a non-object (line 62 of C:\apache\htdocs\pw\wire\core\admin.php) This error message was shown because you are logged in as a Superuser. This must be because of modal somehow? Deleting pages sends them to thrash (so it works), but we still get that error. I could just disable delete-tab on modal, but I think that is a nice feature. Any clues on this one Ryan?
  24. Ok, new stable(?) version waiting for you on GitHub. Check screencast. Sitemap Collapsing animation disabled on first load Not for IE (yet)
  25. I created this functionality and noticed that $page->numChildren gives num of all children (hidden also). Is there some selector that I can use to count only visible children?
×
×
  • Create New...