Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


virtualgadjo last won the day on January 17 2021

virtualgadjo had the most liked content!

Recent Profile Visitors

1,289 profile views

virtualgadjo's Achievements

Sr. Member

Sr. Member (5/6)



  1. hi, just to explain what @iank said, first of all your $page->save($number) couldn't work because what is number, where to save it and so on 😊 to do it the way you were going to, you would have to write $number = $page->number != '' ? $page->number: 0; echo $number; $number++; echo '<br />new' . $number; $page->of(false); $page->number = $number; $page->save(); and, as you can see @iank solution is faster and, quite often, when coding the shorter, the better 😊 have a nice day
  2. Hi @pwired well, very often on a website page you will end with let's say, a top page image (or carrousel) image that can be used in the content (text and so on), just for fun add a repeater with blocks linking to another page... pw allows you to build an intuiitive back end interface with - a single-file image field for the top image with a specific description about the format/ratio/min-width - same thing in case of a top carrousel but with an field set to an array in these two cases you can set image crop ratio plugin with the needed ratio - les add in each repeater item a single file image field with a 1:1 ratio beacause your design requires a square of course - why not another array like uimage field for a gallery that will appera on the page only if there are images in ... i let you imagine the other possibilities doing this makes your back end easy to use and understand for customers that stop being afraid of feeding their website, exactly what i love and so do my customers πŸ™‚ with pw the more granular your back end is the happier your users are too πŸ˜€ and of course field being in the most logical order according the the template design, thanks to pw incredible flexibility and variety of chosable fields and options, it makes quite complex designs so easy to edit... have a nice day πŸ™‚
  3. as i said, if images is set to be a single-file field read the full answer you'll see πŸ™‚ and it's something i often use for some fields, say the top page image for example, using the single-file option pw still allows you to fill the image field with as many images you want but (if your field is named images...) $page->images->url will always take the first one, simple way to give a customer a "stock" and a possible choice that can change when you want just ordering the files to put the one you want to see in pole position have a nice reading the full posts day πŸ˜‚
  4. Hi, like @flydev πŸ‘ŠπŸ» says, it depends on how you've set your field options what i can add is that images[0] won't work, first() or ->eq(0) are far better but, even if it seems obvious i'd just like to add something else, if you want to display images you have to use the img tag... (sorry again if it is that ovious) so, something like this will work assuming your field is set to contain an array <?php foreach ($page->images as $img): ?> <img src="<?php echo $img->url; ?>" alt="" /> <?php endforeach; ?> if it is set as a single file field <img src="<?php echo $page->images->url; ?>" alt="" /> will do the trick πŸ™‚ in case it helps have a nice day
  5. Hi, maybe it's because your class isn't really... a class but a full inline style πŸ™‚ have you tried 'class': 'your_class' and then setting the syles in your css? have a nice day
  6. Hi @Lumi you could sure shorten this syntax a bit but honestly, leaving it like this helps me know what i'm playing with, at what moment, and so on, an old habit of creating vars, then assigning them values and finally returning them so, what does the event return, putting what i need inside and the returning it in... what the event returns πŸ˜„ in this simple case, a shortened version could stay readable but as soon as you write a bit more complex things shorter often means harder to read, comment and... debug πŸ™‚ have a nice day
  7. Hi @Pixrael i didn't know this module and it could be a solution actually for a lot of projects i work on as this both way relation between pages occurs very often having me write tricky php things that it could solve "natively" even if pw itself already makes things so simpler and faster! thanks a lot for your help have a nice day
  8. hi @dotnetic wow, this is huge and exactly what i was looking for and it return our beloved pw pages array instead of just ids like my query did, one bad habit less! πŸ™‚ you've just proved one thing, now i need to know the blog by heart too... thank you so much for your help have a nice day P.S. as i love reading articles i agree with πŸ˜„ the first link in your signature has changed, it's now https://dotnetic.de/blog/processwire-the-best-cms the current one throws a 404 πŸ™‚
  9. @Robin S actually, looking at what i've just posted, what i'm looking for would look like a selector that could be deb_inters.items*=$page in an array way but i can't find this kind of selector in the docs list πŸ™‚ have a nice day
  10. @Robin S no i checked, this of course before my test choosing a published speaker assigned to a published debate (both not hidden of course too) but thanks for the info, as you say, this is not intuitive and is probably going to help me for other kind of selections within the debates (which day, days are in a select, main theme, and so on) and i have a lot to come... even less intuitive when printing the deb_inters field this should be searching through print_r($pages->get(1071)->deb_inters); // returns ProcessWire\PageArray Object ( [count] => 2 [items] => Array ( [Page:0] => Array ( [id] => 1076 [name] =>.....), [Page:1] => Array ( [id] => 1156 [name] =>...) // i spare you the full result which is quite a thing and you know that better than me :) thanks again for your help and letting me know something new for me! have a nice day
  11. Hi @Robin S and thanks a lot for taking time to read my silly prose πŸ™‚ unfortunately, this doesn't work, probably becaouse it is a multiple page field type and containing an array even if only one element a foreach later, my query return Array ( [0] => 1071 ) // the page of the debate this guy is assigned to your solution (using $page as well as $page->id) returns ProcessWire\PageArray Object ( [count] => 0 [items] => Array ( ) [selectors] => template=adebate, deb_inters=1076 ) thanks again for your help πŸ™‚ have a nice day
  12. Hi, i confess, i have very baaaad habits and being a db freak doens't help getting rid of them but i try hard, i swear πŸ˜„ so, i'm working on a website with around 60, say, debates there are around 200 speakers in each debate template there is a field (deb_inter) to assign its speakers, more often several than one then, as you can guess, the field is a multiple page reference field, so far, full pw πŸ™‚ now, on each speaker page i need to display the debate(s) he/she is assigned to and if i try something like this $pages->find('template=adebate, deb_inter*=' . $page->id); guess, i get an error saying that *= is not implemented for fieldtypepage, i knew it but i couldn't help trying once more... πŸ™‚ i've searched the docs once more (i think, i'll end knowing them by heart :)), searched the forum too but couldn't find a simple and pw way to do this, well say as simple as this $qi = $database->query("select pages_id from field_deb_inters where data = $page->id"); which does exactly what i'm looking for (even if returning only pages id instead of a pw array), baaad habits, told you πŸ˜‚ but, as i'd like to die a little less dumb every day, i'm wondering, is there a more pw way to do this kind of selection with pw selectors and for any kind of field containing a pw array instead of a string/number thanks in advance for your ideas helping an old guy getting a little less dumb πŸ™‚ have a nice day
  13. Hi, if you have look at the permission list in your pw, click on the one called "page-move", you'll see it's the one you're looking for πŸ™‚ have a nice day
  14. Hi, i think a good solution would be to create a new user role to which you will give this permission then assign this role to the users you want to have it knowing that a user can have several role and will be given all the permissions assigned to this roles hope it will help have a nice day
  • Create New...