-
Posts
10,902 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
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
-
I am not quite sure whether you are having problems with your code working or not. It works perfectly for me if I don't define a link - it defaults to the current page and if I do define it goes to that link. Can you tell us exactly what isn't working and what the link is instead? Effectively they are/do the same thing. I think Ryan got the name and inspiration from WP's Hana code.
-
A PW upgrade overwrites the wire directory, the main index.php and the .htaccess file (although it's rare for these two files to change). A module and it's cache folder (and anything else under site) is untouched. Upgrading to a new version of the Procache module would only overwrite the module files in site/modules/ProCache. The actual cache of pages would be untouched.
-
This should give you an idea of what I mean: On another note, I like being able to only display the Recent Posts when viewing a single post. I don't see much value in having it on the blog home page because the recent posts are there already. As for comments - all those options sound great!
-
Hey kongondo - great improvements. I have another suggestion for a widget for you On the main posts page, I like having a thumbnail of the first image to the left of the summary text. Of course you could use the first image from the images field, but I think it would be more appropriate to use the first image embedded in the post - domdocument or even a regex does the trick nicely. You could maybe even have a "feature image" field which could be used for this purpose, or perhaps enable tags on the images field and have people enter "feature_thumb" or something like that in the tag field for the image they want to use as the thumbnail - this might be the simplest and most flexible approach and will also require no duplication of images.
-
This is very rough, but if it does what you want, I can clean things up. Basically it will regenerate the name of the page if the title changes. It works on page save, so you won't see the updated name until after you save. Of course you need to consider the impact this can have on broken links and search engine indexing of your site. You might want instead to change the module so it only updates the name if it is empty at page save. EDIT: I didn't see Macrura's code above. I also agree with Martijn that in general this isn't a good idea, but one great tool in PW that can help with this is a core module that is disabled by default, but if you turn on the "Page Path History" module, PW will take care of redirecting pages to their new name/url automatically. UPDATE: For those interested in this functionality, check out this module, instead of the attached one: https://processwire.com/talk/topic/7724-page-rename-options/ RegenerateName.zip
-
But the Goods don't even have a TV, let alone a computer and Ryan was probably still in diapers at the time, so no PW
-
Leaflet allows you host your own raster tiles, but I think you can also use svg if you want. Mapnik is a great python script for generating these raster tiles automatically from SHP files and adding colored data points from your database etc. I think so long as you restrict the area and zoom levels that leaflet is allowed to show, you can use this combination quite effectively, but it could definitely get out of hand if you're not careful. I would love to go vector with all my maps, but unfortunately I need to support governments and old versions of IE still, although I think we might be almost out of the woods on that one finally. The other advantage that map tiles has over vector is when you have hundreds/thousands of data points on a map - svg rendering speeds in browsers aren't there yet for these scenarios. Same goes for complex geographical shapes like rivers - raster tiles render so much quicker in this case as well. Back to topic - I think for a map that is appearing on every page of a site I'd still go with something completely static - you could even cache the google static map to avoid any limit restrictions.
-
I could have sworn there was a discussion about this somewhere on the forums already, but I can't find it right now. Here are a couple of external discussions: http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php http://www.codeforest.net/php-myth-busters-using-single-quotes-on-string-is-faster-then-double-quotes A good collection of php comparisons: http://www.phpbench.com/ I seem to see conflicting results for all these optimizations
-
Is this safe to use as a permission setting?
adrian replied to GuruMeditation's topic in General Support
The only difference I can think of is that an admin editor with the rights to edit the page with the checkbox could change this setting on you, whereas permission/role based restrictions require a higher level permission to change, but presumably this shouldn't really be an issue. -
Is this safe to use as a permission setting?
adrian replied to GuruMeditation's topic in General Support
If I understand correctly, it sounds fine. I am assuming you'll have a conditional in the template file for this page that will only render that portion of the page if the checkbox is checked? -
If it's not working from inside site/assets, then I think there must be something else at play. I actually just tested locally and I can even download: http://pwtest.dev/assets/form-downloads/11 AHAA SPRING DISTRICT MEETING FORM.doc just fine, and looking at PW's htaccess there is a rule for ignoring folders when rewriting so it should work and it does - my mistake above. EDIT: I see that: http://ahaa.inthooz.me/assets/img/ahaa-header-logo.png works fine on your site, so can you narrow it down to the form-downloads folder or the mixed case/space ridden filenames? Have you switched servers? Do the cases of the filenames in the links actually match the filenames? ie Windows vs Linux issue? ANOTHER EDIT: It is weird to me that the page you are getting when trying to download is actually the homepage with a 404 header and not the actual 404 page. AND ANOTHER: Notice that: http://ahaa.inthooz.me/site/assets/form-downloads/dd.doc'>http://ahaa.inthooz.me/site/assets/form-downloads/dd.doc gives you a proper 404 page, but: http://ahaa.inthooz.me/site/assets/form-downloads/d d.doc takes you to the homepage with a 404 header. Turns out I get the same thing locally!