Jump to content

horst

PW-Moderators
  • Posts

    4,077
  • Joined

  • Last visited

  • Days Won

    87

Everything posted by horst

  1. @Soma: Boah! works great and on a 'per field basis'! absolute great!
  2. Hi Thomas, welcome. Sorry, I'm a bit short with time. Assuming with 'should be rejected' you mean on upload of images, I think [best way | one way] [w|c]ould be to write a simple and small module that must hook somewhere into Uploadprocess of images and check with PHP's getimagesize() the dimensions. And if not suite the minimums, delete the file and throw a message to the user. Unfortunately I actually don't know which Hook would be the best for that. So, if you are not familiar with PW-modules (as of you are new to PW), you may wait until one of the forum pro's come along here, - or later todays afternoon I can spent some time on looking to that, because I will need an upload module for myself in the near future.
  3. Hi Alan, I have tried it here and it works! Does you try it online or local? Maybe one/some needed folder isn't availbale or not writeable. Any entry in errors.log? Turn on debug?
  4. was looking into DB: pages.name is VARCHAR with length 128 Thank's Soma!
  5. I have sanitized with: $artist = 'Sabine Meyer/Academy Of St Martin-In-The-Fields/Kenneth Sillito'; $title = preg_replace('/[^a-zA-Z0-9 _-]/', '', $artist); It break ?? = drop the rest or = wrap into lines ?? EDIT: Ah, you have edited your post when I was allready answering!
  6. This is exactly what I've tried after I run into the unwanted duplicate titles. But I got errors that looks much like the first ones with other files and (I think I was to confused) that I have not look close enough to it and have discarded it. It will have to do something with that I run the same function for 4 different pagetypes, whereas three of them have to be unique but the 4'th could have duplicate titles (Tracks with same title but on different Albums). I think that has generated the Errors I haven't looked to, and not when trying to get a page of artist. So, now, besides all the facts about DB and Selectors, I have learned something new, too: Also if it looks weird, keep a cool head Great that it is solved!
  7. Hhmm ?? (böhmische Dörfer ??) I have tried %= and it works, ^= work's too. But I do not understand why I have to do it this way ? (wait, go looking into DB, okay I'll be back:) DB says Datatype of field is TEXT, hmm. %= looks for text somewhere in the field ^= matches if fieldtext begins with it, so $= should match too, but doesn't !?? (why not?) And at least, I cannot really understand why it not matches with the simple = as of data='complete title string with spaces-and-dashes' will work. ---------------------- Ah, - and many thanks for testing Soma, - and for finding a solution!
  8. Hi Soma, it's not a stupid question at all, but it isn't the thema here. If you look to the very first post of this thread I describe that I have used the query $p = wire('pages')->get("template=$template,title=".wire('sanitizer')->selectorValue($title)); to get an allready existing page. Because the query returns a NullPage, I want to create a new one (assuming that there is no one stored in the DB, because the query doesn't returns one). Then, when trying to save() the new created page it crashes with an Error. It currently runs with creating multiple pages of the same (title) artist is just to avoid the unhandled errors! That's not the behave I want. But what is just weird is that the Selector-query doesn't return the page not any, even if there are more than one!
  9. No, there isn't anything hidden or unpublished. As I've said before I have run this with ~ 5000 files and there are some (~30) where it behaves like this. I also have set up a new fresh DB with my SiteProfile of the MP3-DB and imported only 6 files whereas 3 of them are from that album. Same strange behave as before! Here is the install.sql () from the fresh DB including the 6 imported tracks. If someone want to check it he can change the install.sql from SiteProfile against this one. --------------------------------------------- EDIT: I have on another PW-Install (BasicProfile) created a single page just with the title "Sabine MeyerAcademy Of St Martin-In-The-FieldsKenneth Sillito" and on another page I have ran that code: (Template: basic-page.php) <?php if('Child Page 4'===$page->title) { echo "<p>"; $title = 'Sabine MeyerAcademy Of St Martin-In-The-FieldsKenneth Sillito'; $p = wire('pages')->get("title=".wire('sanitizer')->selectorValue($title)); echo $p->id; echo "<br />"; $p = wire('pages')->get("title=$title"); echo $p->id; echo "<br />"; // a direct query $q = "SELECT pages_id FROM field_title WHERE data='$title'"; $r = wire('db')->query($q); if($row = $r->fetch_row()) { echo $row[0]; echo "<br />"; } echo "</p>"; } Would be nice if someone could test this, too. (it drives me crazy)
  10. I have ran this code: <?php // three selector queries $title = 'Sabine MeyerAcademy Of St Martin-In-The-FieldsKenneth Sillito'; $template = 'artist'; $p = wire('pages')->get("template=$template,title=".wire('sanitizer')->selectorValue($title)); echo $p->id; echo "\n\n"; $p = wire('pages')->get("title=".wire('sanitizer')->selectorValue($title)); echo $p->id; echo "\n\n"; $p = wire('pages')->get("title=$title"); echo $p->id; echo "\n\n"; // and one direct query $q = "SELECT pages_id FROM pw5.field_title WHERE data='$title'"; $r = wire('db')->query($q); if($row = $r->fetch_row()) { echo $row[0]; } the output of all 3 selector queries is 0 the output of the direct query is 40813 (the id of the page) So, any ideas?
  11. Hi, here are the first SiteProfile: There is currently some weird behave with the importer. So if you will run into something similar, it is only a intermediate state to create duplicate artists ;-) Also the importer part has to be more justified when it comes to duplicate Tracknames but from different Artists/Albums. - All of it is in a very basic an early state! But if you like to play with it you are welcome. If you do some tweaks (regardless of frontend, backend, module-code) please share it here.
  12. Ah, ok, here a screenshot from explorer: (there are some chars in it, that I wouldn't put there, but that shouldn't affect anything because all strings will be sanitized before they go to the getPage-function)
  13. Hi Apeisa, there is no tracklist as children for albums, I have 4 independent branches (GENRES, ARTISTS, ALBUMS, TRACKS) which contain each of them only children of one type (genre, artist, album, track). The parent of an artist-page is ARTISTS. (And an artist-page has no children!) And when the error occures first, there is only one track (the first one) of that album saved. Hope you understand what I try to say?.?
  14. Hi Wanze, I have checked it, all Titles are exactly the same. It ends up with 6 entries of the same Artist-Title, (but with upcounted name-fileds, -1 -2 -3 -4 -5). That is not what I want. And I really do not understand why it behaves that way. Seems not logical to me. $p = wire('pages')->get("template=$template,title=".wire('sanitizer')->selectorValue($title)); This should get the page, or not?
  15. Yeah! That does it! I think no, here are a screenshot of pages:
  16. Hhm, I stuck with something really confusing. I add pages with API when importing data from ID3-tags of mp3 files. I have an album from amazon with large entries for some ID3-fields: // for the Interpret / Artist it has: Sabine Meyer/Academy Of St Martin-In-The-Fields/Kenneth Sillito $artist = 'Sabine Meyer/Academy Of St Martin-In-The-Fields/Kenneth Sillito'; $title = preg_replace('/[^a-zA-Z0-9 _-]/', '', $artist); // the $title now contains 'Sabine MeyerAcademy Of St Martin-In-The-FieldsKenneth Sillito' I can save the first song which also includes to save the artist with the above $title. This is successful. NOW, when I try to import the second track from that album, it has the same artist (of course). I try to get an existing page with following code: public function getPage($template,$title) { $p = wire('pages')->get("template=$template,title=".wire('sanitizer')->selectorValue($title)); if(0==$p->id) { // create the page $p = new Page(); $p->template = $template; $p->title = $title; $p->name = wire('sanitizer')->name($title); $p->parent = wire('pages')->get('template='.strtoupper($template).'S'); $p->save(); $this->dbModified = true; } return $p; } With the first line of code I should get the allready existing Page, but it returns a NullPage, and when executing the create-page-code afterwards, it crashes when trying to save() the page. The Error is: SO, what is wrong? I have copied the title from the input-field of the artists-page and it is exactly stored as it was sanitized and so, it should match!? Or do I something wrong? (e.g. the above code works well with around 3.000 other files, but not with this ones )
  17. So, - that thing with the Titles (sanitizing but leave spaces, etc) seams to be solved. Also basic stream support is added. The output to the frontend is only a simple menu and information about current page. It's made for coders You may have a look to output (it's a bit like var_dump) and the code in the 2 Templatefiles. That's intended as starting point for your own Frontend creation. There is an own caching mechanism with the LocalAudioFiles-module. It caches the menus and the DB-infos. It refreshes them when DB gets modified or you may permanently disable caching in the modules page. Here are the latest screencast: https://youtu.be/qeT5s013GUE and here without audio for the german audience https://youtu.be/MefyBCDDXrs I want upload the first site profile, but have got an error when importing (Can't save page 0: /genre//: It has empty 'name' field). So I first want to fix that and upload siteprofile after that. (Maybe tomorrow evening)
  18. thank you for the info. I will try it out.
  19. Hi teppo, thanks for the help and the useful link. I have tried with the explanation on that site, but I have solved it only 90% with this query: $q = 'SELECT t1.g_id, t1.g_title, t1.g_summary, t1.g_description FROM g2_Item t1 LEFT JOIN g2_CustomFieldMap t2 ON t1.g_id = t2.g_itemId WHERE t2.g_itemId is NULL AND t1.g_canContainChildren=1'; it returns all rows from t1 that have no matching row in t2. But I want to get all that do not have 3 matching rows in t2: sample data of t1: g_id = 1000, g_summary = 'my summary1' , etc. g_id = 2000, g_summary = 'my summary2' , etc. g_id = 3000, g_summary = 'my summary3' , etc. g_id = 4000, g_summary = 'my summary4' , etc. sample data of t2: g_itemId = 1000, g_field = 'custom_fn1', g_value = 'myValue1' g_itemId = 1000, g_field = 'custom_fn2', g_value = 'myValue2' g_itemId = 1000, g_field = 'custom_fn3', g_value = 'myValue3' g_itemId = 2000, g_field = 'custom_fn1', g_value = 'myValue1' g_itemId = 3000, g_field = 'custom_fn1', g_value = 'myValue1' g_itemId = 3000, g_field = 'custom_fn3', g_value = 'myValue3' The wanted select should return the rows for g_id: 2000, 3000, 4000, because only g_id 1000 has all 3 rows in table t2.
  20. Hi, I'm not sure if I can ask this here because it has nothing to do with PW, so - if is unwanted please tell me. I'm actually working on a old site of mine that runs with Gallery2. There I have added 3 userfields to albums and now have to update all data (300 albums). Because it is so very very slow with updating through its own admin interface, I want to write a short interactive update wizzard script but stuck with the mysql-select query. I need to query two tables in a (old) mysql 4 DB. From the first Table I need this: SELECT g_id,g_title,g_summary,g_description FROM g2_Item WHERE g_canContainChildren=1 But I want only get the rows in result where are not set all data in the second table: the second table (g2_CustomFieldMap) has fields: g_itemId,g_field,g_value g_field can contain: 'custom_fn1','custom_fn2','custom_fn3' for each g_itemId (g_itemId is g_id from first Query) Is it possible to call this all together as one query? Any help from mysql-specialists are welcome
  21. Hi Soma, can this be used in the frontend? I want to use DataTables with my MP3-DB in the frontend with AJAX-Pagination and -Sorting.
  22. Hey, is this new? Cool: mods.pw/3y EDIT: uhm, sorry for beeing OT! Just got excited.
  23. Oh, I haven't thought that one could do it with the standard 4S. But apart from technical details, this one is my favourite because of composition and light ;-)
  24. Hi Marty, good work! (site and photos) This one was shot with pure / native iphone 4S ? Or with an additional lens for close-up range?
  25. Maybe it is an option to search for specific camera that supports iOS? google: ipcamera video codecs for ios or is camera allready there?
×
×
  • Create New...