-
Posts
273 -
Joined
-
Last visited
-
Days Won
2
Everything posted by virtualgadjo
-
Hi Vincent, very honoured that my little translations may have any interest ? actually, i don't really know how to do what you're talking about but i'll have a look at it just a little detail, you may have seen that i keep a different repo for each pw master release because i've conviced a few french friend to use pw and depending of the version updating the files may lose some older texts actually as i keep translating release by release i've even considered making a different repo by dev release or creating a new repo with all the translations in zips named after the release this explains why the zips with the fact it's also the easiest way to update a language translation, uploading a zip that pw will unzip server side and boum everything is up to date ? just tell me what would be the best way for you to use my repos (one called last master release with the json files? and keeping the others for my friends using older releases for example) have a nice day chris
-
Hi @Robin S apparently i'll need some more knowledge from you, running into a new little issue i have a template to generate a block, let's call it a push there is again an image depending of the type of push and i call it this way (the way you teached me ? ) $image = $page->getFormatted('square_fr'); if i put an image in the field, everything goes fine if ever i save the page forgetting to fill this field, impossible to add it afterwards and save again, the field stays desesparatly empty and doesn't save my image, no matter the type of condition i try before getting this image if i remove the runtime field from the template, i can put an image and save it again it works; i'm sure i've missed something but honesty i can't find out what, i looks like the runtime field has also an impact on the whole admin page and prevents the image field from working once the page is saved with an empty field any idea would be very welcome ? have a nice day
-
Hi @Robin S and wow, thanks a lot for your answer and this greeat explanation! funny enough, i've written a lot of modules for customers using this $page->of() function to allow validation of values submitted with a front end form to create pw pages but never had to deal with displaying images in the back end, thanks to you i won't be surprised when it happens ? and thanks for the snippet too, cleaner and more pw like than my concatenation ? one more day i will go to bed a little less dumb ?? have a nice day
-
Hi, great module, just a little funny thing i've just ran into i use it to render in the admin a square component made with pages that may contain an image or have a background-image the image field is named squareimg and is set as a single image field, not an array // if i use echo $page->squareimg->url; // the usual pw way, it returns /site/assets/files/xxxx/ echo $page->squareimg; // returns the name of the image i've got to write echo $page->squareimg->url . $page->squareimg // to get my full image path just in case it may help ? have a nice day
-
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
-
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 ?
-
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 ?
-
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
-
my pleasure ? have a nice day
-
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
-
How to customize/modify the HTML generated by PW?
virtualgadjo replied to Lumi's topic in Getting Started
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 -
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
-
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 ?
-
@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
-
@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
-
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
-
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
-
"choose parent" not showing for non superusers
virtualgadjo replied to torf's topic in General Support
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 -
"choose parent" not showing for non superusers
virtualgadjo replied to torf's topic in General Support
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 -
How to customize/modify the HTML generated by PW?
virtualgadjo replied to Lumi's topic in Getting Started
hi, just my two cents ? like @Gideon So says, the created on field in pw is called "created" (you can see this having a look at the bdd tables) something i often do when i need a peculiar sorting for a repeater is using this famous hook in the site ready.php file $this->addHookAfter('FieldtypeRepeater::wakeupValue', function($event) { $field = $event->arguments('field'); if($field->name !== 'your_repeater_name') return; // in order to sort only a specific repeater $pa = $event->return; $pa->sort("sorting_field"); // the field you want the repeater to be sorted by $event->return = $pa; }); this way, the repeater is also sorted the way you want in the admin in case it may help have a nice day -
hi, even it's a funny idea as - you'll be multiplying duplicate contents between this latest-article and... the latest article - the content of this latest-article will change quite often it's quite easy to achive, just use $pages->find with template and sort by -date (with your own field naming convention) to get the id of your latest article on top of the code and then use $pages->get(xxxx)->content and so on to display the latest article content/images/... in the page hope it helps have a nice day
-
Hi all, as promised, i'm back ? here is a full translation for the last master release 3.0.200 https://github.com/virtualgadjo/pw30200-lang-fr yes i know, that was fast but, actually that's because i kept translating all "minor" releases from the last master one and i haven't seen any new sentence from the 3.0.199 in case it could be useful to anybody... have a nice day
-
Hi, of course if ($page->content3 != '') // this only checks if the field has content but assumes it exists supposes that there is a field named content3 in the page, if it's possible that not then an explicit if (isset($page->content3) && $page->content3 != '') //verbose version ? that's one of the reason why when using markup regions for a website that have very different pages i often use the probably common sections in the _main.php file and a mainwrapper... wrapping the various fields that are more page specific in the page templates this allows my _main.php to have a little less logics and be a little more readable ? have a nice day
-
@millipedia oh yes you're right, there are so many options, replace, append, optional that i often forget to quote all of them (and even sometimes to use... too much of a php by myself guy ? ) have a nice day