
celfred
Members-
Posts
199 -
Joined
-
Last visited
Everything posted by celfred
-
Hello, I've tested some selectors on my site and I'm having a little question here. My 'page tree' look like this : /guests /guests/admin/ /guests/admin/Laurence /guests/admin/Le p'tit /guests/admin/Élodie As you can see, I have names with special characters. I'm trying to retrieve the pages for an autocomplete field on the front-end. So far so good, it worked ok, until I notices I had no result for 'l', that's when I added the 'Laurence' page and it worked. So I thought the problem was due to the apostrophe... Anyway, I used the new 'Selector test' module (thanks to the creator!) and noticed something : parent=/guests/41,title*=l >> returns 1 page found : Laurence (Why not 'Le p'tit' ?) parent=/guests/41,title^=l >> returns 1 page found : Laurence parent=/guests/41,title%=l >> returns 3 pages found : Laurence, Le p'tit, Élodie (no apostrophe problem?) And : parent=/guests/41,title$=ie >> returns 1 page found : Élodie parent=/guests/41,title$=die >> returns 0 pages found ? Why not 'Élodie'? So I don't really know what to think... Am I doing something wrong here? Thanks if anyone has time to give me a clue ;-)
-
Module: Testrun selectors + find() from admin (ProcessSelectorTest)
celfred replied to nik's topic in Modules/Plugins
What an excellent idea! Thanks a lot! I think it's a msut have for beginners like me. I was often confronted to this kind of doubt : are my 'find' parameters correct or do I have problem somewhere else in my code? I guess now I'll be able to get rid of those doubts regarding the find parameters. Great! -
Well THANK YOU very much ! I've made quite a lot of different tries on that problem but wa sunable to solve it by myself and now I go a little step further. That's very nice of you to take the time to provide such detailled explanations in your answers. I still have a long way to go to better understand those 'pages' issues... But what makes it incredible is how your explanations often make it so simple and clear. That's when I feel like improving a lot in a few seconds and when Processwire becomes something incredibly powerful... And good thing also about the selectorValue() sanitizer... I've missed that one, although I had problems with commas in another field of my site ;-) Well... I can then go on with my coding. Thanks again!
-
Hello, I'm back again with my beginner issues... This time, I'd like to update a field found in a repeater across multiple pages. My code : $found = $pages->find("parent=/invitations/$user->name, guests.guest_name=".$form['oldname']); foreach ($found as $f) { foreach ($f->guests as $g) { if ($g->guest_name == $form['oldname']) { $f->of(false); $out .= '/01:'.$g->guest_name; // THIS IS TO CHECK IF IT WORKS $g->guest_name = $form['name']; $out .= '/02:'.$g->guest_name; // CHANGE APPARENTLY OCCURRED $f->save(); // BUT NEVER SAVES??? } } } Let me try to explain a little : the name of a 'guest' is modified on the front-end. I want to adjust all 'invitations' under the '$user->name' branch (that's how I organized my pages, maybe it's not the best solution...) where the 'oldname' was found (in a 'guests' repeater having 'guest_name' text fields). So I look for the pages and I try to loop each page to check which field has the 'oldname' and when I find it, I change it to the 'newname' ($form['name']) and try to save this change... I have tried many things, but this never worked ! Although I did the same stuff to delete a field (If I remove the guest) and it worked! I just don't understand, so if someone could give me a hand, I'd greatly appreciate... Thanks!
-
Deleting a field in a page if the value is found
celfred replied to celfred's topic in Getting Started
Thanks a lot for this nice answer! I don't really understand this... I think maybe my problem comes from the fact that my repeater only has 1 text filed (guest_name). Actually, my pages record the names of 'guests' and when a user deletes a guest, I'm trying to 'delete' (or remove?) the same name in every page belonging to the logged in user where the name is found... Since I had multiple names in each page, I decided on using a repeater. Maybe that was not a good idea ? Exactly! But I still don't undertand the difference with delete (for the moment). I've tried what you suggest : - Code 01 & Code 02 work fine! And I understand how they work. Thanks for reminding me that the repeater acts as a 'Page' and a pagearray. I think that's the part I wasn't aware of during my tests and that your answer helped me 'tidying up' what I've read so far. - Code 03 : I haven't really tried since I have more than 1 pages containing the 'guest_name' value. During my tests, I understood that 'get' limited the search to 1 page whereas 'find' returned a pagearray. Anyway, thanks again for the answer. I'm happy the code works. Still, I'd like to understand better why my previous code (with the 'delete' version, and no 'save()') ended up working (from what I've tested so far... Maybe there would be other issues raised in a different context) and how different it is from your 'remove and save' solutions. -
Deleting a field in a page if the value is found
celfred replied to celfred's topic in Getting Started
Well... I guess I found something by myself : This seems to work as expected : $name = $pages->get($id)->title; $found = $pages->find('created_users_id='.$user->id.',guests.guest_name='.$name); foreach ($found as $f) { foreach ($f->guests as $g) { if ($g->guest_name == $name) { $g->delete('guest_name'); } } } I re-read (re-re-re-re-read, actually ;-)) the documentations and from what I understood, 'remove' was not to be used for fields. I used 'delete' instead and it looks ok. Regarding my nested 'foreach', although I feel like there would be a really better way to do this, it seems to do the work... -
Hello, I am struggling again with my lack of understanding of PHP developement (I guess)... I would just like to get rid of a field (part of a repeater) in my page if I find a particular value. My code is the following : $name = $pages->get($id)->title; // THIS IS THE VALUE I SEARCH FOR $found = $pages->find('guests.guest_name='.$name); // THESE ARE THE PAGES CONTAINING THE VALUE foreach ($found as $f) { // LOOP THROUGH THE PAGES foreach ($f->guests as $g) { // LOOP THROUGH THE REPEATER TO GET RID ONLY OF THE FIELD CONTAINING THE NAME I AM LOOKING FOR if ($g->guest_name == $name) { // IF I FIND THE NAME IN THE FIELD $f->remove(guests.guest_name); // GET RID OF THE FIELD. THIS IS THE LINE I REALLY DON'T UNDERSTAND : REMOVE? DELETE? HOW TO USE IT...? } } } I've tried to show my way of seeing things here, since I'm not sure I'm thinking well about my issue. Feel free to put me on the right tracks ;-) And as always, thanks in advance for your help.
-
Test if repeater has value and tick checkbox if found
celfred replied to celfred's topic in General Support
Well... What can I say except THANK YOU both for that. I sometimes feel ashamed of not finding the answers by myself. Honestly, I spend a lot of time searching for them... Don't think I come and ask for help as a 'shortcut' ;-) Anyway, I wasn't that good on that one, but I've just learned so much thanks to both of you. Thanks! -
Hi there, I've been struggling for a couple of hours with something I guess one of you will find an answer rather quickly... Let me explain : I'm creating a list of checkboxes according to the number of 'guests' pages belonging to the logged in user. In my page, I'd like some of the checkboxes checked by default IF the logged in user has already recorded them as checked (and this state is saved in a repeater field named 'guests', having 'guest_name' as text input. My code is the following : // If user has guests, list them for easy multiple selection $guests = $pages->find("parent=/guests/, created_users_id=".$user->id); $sel = 0; if ( $guests->count() > 0 ) { $sel = 1; foreach ($guests as $guest) { foreach ($page->guests as $g) { // THIS IS A TEST TO SEE IF I CAN REACH THE REPEATER $out .= $g->guest_name; // IT WORKS AS EXPECTED } //$found = $page->matches("guests.guest_name=".$guest->title); // THIS DOESN'T WORK. WHY? if ( $found) { $checked = 'checked'; } else { $checked = ''; } $out .= '<label for="cb'.$guest->id.'"><input type="checkbox" name="friends[]" value="'. $guest->title .'" id="cb'.$guest->id.'" '. $checked .' />'.$guest->title.'</label>'; } } I've tried many different things : $page->is(), $pages->find(), tried to use has(), but I was incapable of making this work... I have a feeling the answer shouldn't be that hard, but as I said, I've been looking for it for a couple of hours now and I wish someone could give me a hand (again...) on that one. I hope I was clear enough in explaining the issue. Thanks in advance.
-
Sorry about that... I am also discovering 'git' and I thought 'git fetch' was getting the last version. In fact, I used 'git pull' and now I have 2.2.9 and... Everything works as expected! Thanks a lot!
-
Well... I am on 2.2.3 version (I guess up to date), and my code $selected = $page->children()->find("createdUser=$user, sort=-date"); // HERE'S THE DATE PROBLEM //if ($page->children()->find("createdUser=$user")->count() > 0) { if ($selected.length > 0) { $out .= '<ul id="list-invit">'; foreach ($selected as $invit) { $out .= '<li data-id="'. $invit->id .'">'; $out .= 'Invitation le '; $out .= $invit->date .'<br />'; $out .= 'Liste des invités : '; $out .= '<a href="#" class="guest">'. $invit->title .'</a>'; $out .= '<a href="#" class="mod_invit">Modifier</a>'; $out .= '<a href="../ajax/delete_invit.php" class="del_invit">Supprimer</a>'; $out .= ''; $out .= ''; $out .= '</li>'; //} } $out .= '</ul>'; doesn't work as expected (from me...) I try to get the list of pages from the logged in user and sort them along the date Datetime field. My 'date' field is formated 'Sunday, 5 November, 2012', and it seems to me that the sort order stays based upon the days alphabetical order. In other words, Wednesdays display first (because of the W) and then I get Thursdays, then Fridays... (except I'm trying to sort chronologically although I want to display the day's names). Do I do anything wrong? Thanks for the help ;-) (I hope I was clear enought in what I wrote...)
-
Getting really confused: how to create forms for my own database
celfred replied to Morgawr's topic in General Support
Well.... I'm not proud of myself on that one... Thanks a lot, Soma! -
Getting really confused: how to create forms for my own database
celfred replied to Morgawr's topic in General Support
These are great indications, Ryan. As always, very clear and so helpful. Thank you! While on those 'confusing' issues with forms, how about InputfieldPassword. If I use it, I get 2 fields : 1 for password and 1 for confirmation. Would it be possible to limit it to the first field only? If not, how can we integrate such a password field in a form created via the API? To understand these issues more clearly, I keep trying to find information on the Forum and to look at the code in wire/modules/Inputfield/ and try and analyze it. Is there another place we could find information about this? Thanks. -
Thanks for your reply. I have now managed to get the datePicker working. I am still struggling with the style since even though I put the link to the stylesheet, it doesn't seem to work... Anyway, I'll look closer later... Looks like I have to link to several stylesheets... (I told you I'm no professional developper...) Just a quick note : you wrote : wire/core/Inputfield/InputfieldDatetime/InputfieldDatetime.js . I found the file in wire/modules/Inputfield... Anyway. Thanks again.
-
Thanks a lot for these indications. It helps me a lot, even though I'm a little stuck on one thing : my form is OK, but I'm trying to use a datepicker in one field... is this possible? Here's where I am : I changed this part of Soma's code // you get the idea $field = $modules->get("InputfieldPassword"); $field->label = "Passwort"; $field->attr("id+name","pass"); $field->required = 1; $form->append($field); with // you get the idea $field = $modules->get("InputfieldDatetime"); $field->label = "Date"; $field->attr("id+name","date"); $field->required = 1; $form->append($field); And tried to play around with $field->datepicker = 1; ...But I have to admit I don't really understand what I'm doing and I just know this doesn't work... I've spent quite a few hours on that (don't laugh ;-)) and if one of you can give me a hint, I'd greatly appreciate! Thanks !
-
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
celfred replied to ryan's topic in Modules/Plugins
Thank you for the answer ! At least, now I understand a little better. -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
celfred replied to ryan's topic in Modules/Plugins
@teppo, Thank you for your help ! It works better now although I had tried doing this, but on the second link and it never worked. Actually, this second link still doesn't work. I've changed it with another equivalent video (for my purpose), and the new link works... I can't tell what the problem is... If I copy and paste this link, the video is available... If someone is interested in understanding the issue, here are my 3 Youtube links (preceded by https://www.youtube.com/ [to avoid the max number of media error I get posting in the Forum]): watch?v=8-NeizIkHBY watch?v=Imum21-hdNg watch?v=dsO__o4Ezjw Number 1 and number 3 : Video embed without any problem since I followed teppo's advice (in their own paragraph's tags). Number 2 : no embed... Just a regular text... Thanks again ! Again, if you want to see the original article : http://flenglish.tux...s/the-alphabet/ -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
celfred replied to ryan's topic in Modules/Plugins
Hi all, I'm trying to use the Embed video module, but it doesn't work for me... I followed the documentation, but it failed and I keep wondering what I am doing wrong. Here's my work : Module upload in 'site/modules/' > Check new module > installation Setup > Fields > body > Details > Textformatters > Video embed In my page body field, I have 2 Youtube links, but they stay as links (no embed...). If you want to have a look at the page, here it is : http://flenglish.tux...s/the-alphabet/ Thanks for your concern ;-) (And sorry not to be able to find the answer myself...) -
Hello to all, I keep testing ProcessWire on my 'amateur' side (compared to what you all do) and I'm really impressed by the work. And this blog profile sounds excellent to me. I can't wait to see the distribution version! I was trying to build a personal site from scratches, but I do have to admit that it is difficult for non-professional programmers to think of everything and profiles like this one is a great help for us (at least, for me...). So thanks in advance ! My post doesn't help for anything... but I just wanted to let you know that I am interested and... happy to use PW ;-)
-
Hello, When I see such a great detailed answer and no simple 'thank you'... I just feel like saying 'thanks' to Ryan ;-) Celfred.
-
solved Installation problem... Only homepage and then 404 error...
celfred replied to celfred's topic in General Support
Thank you. I'll dig PW now that it works ;-) Celfred. -
Hello to all of you, I'm new to Processwire and I've been trying desperately for a few hours to just... install it on my localhost (Ubuntu 12.04, Apache 2.2.22). You'll soon find out that I am not a professionel web developper, but still... this is driving me crazy and I'd love to get some help. To describe my problem briefly : installation goes fine, no problem. I set everything as asked during the process (writable directories and so on). Then I go to 'View my site' : just fine. And as soon as I hit ANY link on the Basic homepage, I get that 404 error quite a few talked about in other posts... So far, I've tested : - nonsens string in my .htaccess : throws a 500 error (sound good, no?) - re-read everything in my Apache setting (again I'm no professional and couldn't find anything wrong...) - checked the mod_rewrite in my phpinfo... Looks good. I'll put it underneath for those interested to help. - tried to uncomment the rewriteBase rule in the .htaccess. Nothing worked (actually, and that's CRAZY to me, it worked once on a reload (I DID see the ABOUT page simply putting for the nth time RewriteBase /mysubdir/, but it worked ONCE (can you believe this?) and never again. - tried restarting my Apache server many times... no change.... I can't think of anything else to do, so please, if someone can help, I'd greatly appreciate... Thanks in advance for your help and time. My phpinfo is attached.phpinfo.php.html Celfred. EDIT : Oh I'm SO sorry and ashamed... (Did I tell you I was no professional?) I had just one last idea before going to bed... trying one last change on my rewriteBase line and... It worked ! It's cool, but I can't believe it took me hours to find this out. Actually my server is installation is in private/processwire/ subfolder and I simply forgot the 'private' part in the path... I guess you can ignore my post now... Have a good night...