Jump to content

adrian

PW-Moderators
  • Posts

    11,182
  • Joined

  • Last visited

  • Days Won

    372

Everything posted by adrian

  1. 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.
  2. adrian

    Hanna Code

    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
  3. adrian

    Hanna Code

    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.
  4. 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.
  5. 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!
  6. 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.
  7. 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
  8. 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
  9. 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.
  10. 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
  11. 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.
  12. 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?
  13. 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!
  14. The first thing I notice is the spaces and mixed case in the filenames. This is a bad idea for lots of reasons which is why if you uploaded the docs via a Files field in PW it would have converted them for you. I think what is causing the 404 is PW's htaccess rewrites. It sees: http://ahaa.inthooz.me/assets/form-downloads/ and goes looking for a page with that path. You could potentially move form-downloads into: http://ahaa.inthooz.me/site/assets/form-downloads/ and things should work just fine. But, why not upload them to PW and have files that are part of the system? EDIT: having them all in a files field in PW means you could use this code to provide download links to all and it would automatically work for all new files as they are added: echo "<ul>"; foreach($page->files as $file){ echo "For the {$file->description} form, <a href='{$file->url}'>click here!</a>"; } echo "</ul>"; Although personally I hate "click here" links, but I went with how you had things structured already
  15. Also, a little more? info here: http://processwire.com/api/variables/sanitizer/
  16. Macrura, If you look at the DB table for the PageTable field you'll see how the data column lists the page ids that are included as items in the PageTable. I think you should just have to add rows for each of the pages you want included for editing in the page table. I was actually thinking this morning about this - currently it is possible for someone to add a new child page manually, but these won't appear in the PageTable field for editing. I wonder if there needs to be a way to prevent this as it could get confusing. Another issue for PageTable fields in my mind - if you use the default page as the parent for storing the entry child pages, but you also have regular child pages mixed in, it may become quite confusing for editors. I guess this comes down to the dev being careful about choosing a different parent in cases where there might be confusion. Did that make sense?
  17. The fix was after the 2.4 release so you'll need to either update to dev, or you could make these changes to 2.4: https://github.com/ryancramerdesign/ProcessWire/commit/e2f701fc3db0810395a904a508e862a2da615cc2 Lots of us are running the dev version on production sites, but it's up to you - occasionally issues pop up, but it's not very often.
  18. I am pretty sure this has already been fixed in the dev version. Here is the initial report of the problem: https://processwire.com/talk/topic/5605-delete-image-from-grid-view-not-possible/ And here is the Github issue: https://github.com/ryancramerdesign/ProcessWire/issues/363 It was fixed in early March.
  19. Well, you could use: http://modules.processwire.com/modules/fieldtype-map-marker/ but I wonder if the Google static maps API might be better if it is in the footer of every page: https://developers.google.com/maps/documentation/staticmaps/?csw=1 There is a limit of 25000 hits per day, so if you'll be inside that, it's a decent option. The only catch with the static option is providing a GUI way for users to add markers. There are other options out there too, but let us know if you think either of those will work.
  20. Hi qlex and welcome to PW - hopefully you'll stick around after this client request Here are the instructions for using the RSS module: http://modules.processwire.com/modules/markup-rss/ Also, you may want to consider this enhanced version of the RSS module: http://modules.processwire.com/modules/markup-rssenhanced/ Let us know if you need any specific help getting things to work.
  21. Regarding your enddate not saving, there are a couple of things going on. InputfieldCourses.module: Change: $course->dateend = $dateend; to: $course->dateend = $input->{"{$name}_dateend"}[$cnt]; Course.php Change: } else if($key == 'date') { to: } else if($key == 'date' || $key == 'dateend') { That will get your dateend field saving on creation. However, the one thing I just noticed is that you can't make any changes to the course once it is saved. I haven't investigated this yet, but did you notice that also? EDIT: Also those checkboxes are going to have issues - you need to a checked="checked" in each input based on whether there is a 1 in the database or not, but you'll also need to take care of assigning that "1". Now for why changes are not saving - I am still not sure exactly why and have run out of time, but a quick and dirty fix is to comment out this line in InputfieldCourse.module: if("$courses" != "$this->value" || $numDeleted) { I don't really know why $courses and $this->value are not being set appropriately, but they are both set to "Course" which obviously isn't much use. Hope that all helps a bit.
  22. Don't worry about overcomplicating - I think everyone still does that at times when learning something new. There are so many ways of doing something and it often takes time and reflection to realize the simplest way, especially when the goals of your site or app change as you go along. That code I gave would produce a multi-dimensional array something like this. So for each track id, you'll have available both the title and the lyrics as separate key/value pairs that you can access. Array ( [156] => Array ( [title] => Song Title [lyrics] => This is the way we code, the way we code, the way we code ) )
  23. I don't see how it is possible in grid view, so your editors need to know to switch to list view to enter descriptions using the button at the top right of the images field.
  24. All of the standard PW variables must be converted to wire("variable") when you want to use them inside a function. I think you've probably already had variable scope mentioned to you, but you should read this (http://www.php.net/manual/en/language.variables.scope.php) at some point so you understand why the PW variables can't be used inside a function. I don't understand what you mean about get() or find()
  25. If you can view your site's homepage but get that error on all others, then it is most likely the RewriteBase setting in the .htaccess file. Try uncommenting the first option to start with. If your site is in a subfolder, then create a new option like the second example provided and try that. Should be pretty easy to sort out.
×
×
  • Create New...