-
Posts
11,180 -
Joined
-
Last visited
-
Days Won
372
Everything posted by adrian
-
You can do it in one with findRandom(2) and then you won't need to worry about duplicate images: $randogals =$pages->find("images.tags=fav"); $randogal = $randogals->getRandom(); $randomimgarray = $randogal->images->findTag('fav'); foreach($randomimgarray->findRandom(2) as $randomimage){ echo $randomimage->size($thumbWidth, $thumbHeight); }
-
I think you are referring to the tags property? $page->images->first()->tags or $page->images->eq(n)->tags where n is the number of the image in the images field starting with 0
-
It is possible to extend the images field with extra fields: https://processwire.com/talk/topic/417-extending-image-field/?p=3351 but the simplest option for you might be to enable tags and write "fav" or something like that in there. Details tab > Use Tags? Or you could also have one image per page and then you have complete flexibility in adding custom fields for each image.
-
Ok, I just committed another update and I just tested myself with some cyrillic characters and I think everything should be working fine now. I also fixed the blank dropdown issue. Now if there are no edit modes set in the config, the editor is not available at all from the Children tab. Please let me know how it goes for you.
-
Ivan - let me know if my ChildBatchEditor is now working with cyrillic characters. If it is, I can apply the same fix to this.
-
Ivan, I am really not very experienced with non-latin characters, but I just changed page name sanitizer to include: "Sanitizer::translate" which I am hoping will do what you need. Otherwise I will need to revisit things and use the code from the core that dynamically generates the page names on the fly from the titles. I have also added a few new features to this module: There is a new "Add" option so it is possible to bulk add new children regardless of the content and grandchildren of the other sibling pages. Also there is a new config setting for allowing you to override the content protection check when using the overwrite mode - obviously use with extreme caution. Hope all those changes are useful. First post updated with new options and screenshots.
-
Ok, thanks for the explanation - it all makes sense now I don't know what your getTpl() method actually does, but this will also return the template file's full path: echo $page->template->filename; Maybe you are already using this as part of getTpl()?
-
I'm with WillyC - I can't find getTpl() in the source code anywhere. Can you point us to the file/line on github where this method is defined. I am curious!
-
It's not the average Joe/Jane I am worried about - it's the government sysadmins that are too lazy to upgrade their staff! I don't support old IE on most projects, but some I still need to
-
This is depressing: http://www.extremetech.com/computing/183362-windows-xp-rises-from-the-grave-simple-hack-gives-you-five-more-years-of-updates Another 5+ years of IE6-8 When will this madness end?
-
Sorry, forgot to mention that you also need to shuffle if you want random order rather than just random selection. So do this once you have $randWords populated: $randWorks->shuffle();
-
Are you looking for findRandom rather than getRandom? http://cheatsheet.processwire.com/?filter=findrandom
-
A couple of really quick comments. Have you tried saving $player? $player->save(); or $player->save("game"); Also you should use: wire('input')->post->user_id; It's the PW way and apart from looking cleaner it also takes care of any magic quote discrepancies between servers.
-
I don't know if you have any specific requirements for your SKU, but someone came up with something on SO: http://stackoverflow.com/questions/15830222/text-abbreviation-from-a-string-in-php You can also google creation of a GUID (globally unique ID). There is even a built-in php function: http://www.php.net/manual/en/function.com-create-guid.php
-
I am not completely sure what you are after, but does this do what you want: $pages->count("selector")
-
I don't know about the multisite side of things, although I don't imagine there is anything different, but here are the full set up upgrade instructions: https://processwire.com/talk/topic/52-how-do-i-upgrade-processwire-to-the-latest-version/
-
Ivan, Is this just an issue with this module, or does it happen when creating pages in PW in general? I don't know much about this stuff. Just found this post: https://processwire.com/talk/topic/5278-error-in-transliteration/ but before I look into it more, I just want to confirm that it works as expected for you when creating a page normally in PW.
-
I think so - check out this discussion: https://github.com/ryancramerdesign/ProcessWire/issues/496
-
You're right about the sub/grand children issue with that module when in create/overwrite mode, but if you switch to edit mode you can still quickly add new pages in this scenario. But, yes we should take this conversation over here: https://processwire.com/talk/topic/6102-batch-child-editor/ now. I'd be happy to modify the module if you have suggestions for improvements that would help your workflow without compromising the need to protect from accidental data loss.
-
Not sure if there are any instructions posted yet, but if you install the module from the core list, the setup of a new field with this type is well documented. I am sure you'll get the hang of things from playing around for a few minutes. There is some discussion about PageTables from this post onwards: https://processwire.com/talk/topic/6417-processwire-profields-table/?p=62890
-
This module might be useful for you: http://modules.processwire.com/modules/batch-child-editor/ Use the Create/Overwrite mode.
-
Oh right - sorry I misunderstood. Both provide similar functionality, although I haven't actually used Nico's shortcode module, so not completely sure on the differences. I guess my advice would be to experiment with both and see which best provides you the functionality you need.
-
I actually really agree with you on this being enabled during development - I often change page titles at this time and it can become painful to remember to change the names as well.
-
I am at a loss for why it isn't working for you. Not that it matter, but here is a slightly cleaned up version of your code: if (!isset($size)) $size = 200; if (!isset($link)) $link = $page->httpUrl; echo "<img src='http://chart.googleapis.com/chart?chs={$size}x{$size}&cht=qr&chl=$link' />"; You had unnecessary curly braces and extra semi-colons and also since these are square, there is no need to define the width and height separately. If you wanted you could even make it a one liner: echo "<img src='http://chart.googleapis.com/chart?chs=" . (isset($size) ? $size : 200) ."x" . (isset($size) ? $size : 200) ."&cht=qr&chl=" . (isset($link) ? $link : $page->httpUrl) . "' />"; Although you do sacrifice a little readability. One other quick thing - in your google.com example, you are using backslashes instead of forwardslashes - probably just a typo