Jump to content

teppo

PW-Moderators
  • Posts

    3,208
  • Joined

  • Last visited

  • Days Won

    107

Everything posted by teppo

  1. Thanks, Ryan. Let me know how it handles once you do test it, would be interesting to know. My tests so far have been very limited in scope, so I'm fully expecting a pile of issues (and most likely a few things I've completely missed).. though of course the opposite would be cool too You've given me something new to consider there, will definitely take IftRunner and PageAction part into consideration.
  2. Sorry for the delayed answer, Pierre-Luc! Been busy with other stuff and this totally slipped my mind. What you've described there wasn't really possible without direct SQL queries until just a few moments ago. I've just pushed to GitHub an update to VersionControl.module (0.10.0) that adds new $page->versionControlRevisions() method. This isn't properly tested yet, but something like this should work: // current value of field 'headline' echo "Headline for current revision: {$page->headline}<br />"; // value of field 'headline' in previous revision $revisions = array_keys($page->versionControlRevisions(2)); $page->snapshot(null, $revisions[1]); echo "Headline for previous revision: {$page->headline}<br />"; // return Page to it's original (current) state $page->snapshot(); echo "Back to current revision: {$page->headline}<br />"; Since snapshot() returns Page object to given revision or point in time ($page->snapshot($time, $revision)) you'll want to make sure it's back to it's original state in case you're going to make changes and save the page -- otherwise the revision you fetched with snapshot will be returned from history once you save the page. $page->versionControlRevisions() returns an array of revisions for current page and can optionally take one param, $limit, to fetch only that many revisions if more exist. It's return value is in the form of array([revision] => [timestamp]), i.e. array(4 => '2014-01-01 02:00:00', 3 => '2014-01-01 01:00:00') etc. so in order to get just the revision IDs out of that I'm using array_keys() in the example above. You could probably also do something like this, if you want to make sure that Page doesn't get accidentally returned from history (this'll consume more memory, though): $revisions = array_keys($page->versionControlRevisions(2)); $page->previousVersion = clone $page; $page->previousVersion->snapshot(null, $revisions[1]); echo "Headline for previous revision: {$page->previousVersion->headline}<br />"; Not sure if you're still working on this, but this kind of feature felt useful so I'm glad you brought it up..
  3. This is a beta release, so some extra caution is recommended. So far the module has been successfully tested on at least ProcessWire 2.7.2 and 3.0.18, but at least in theory it should work for 2.4/2.5 versions of ProcessWire too. GitHub repo: https://github.com/teppokoivula/ProcessLinkChecker (see README.md for more techy details, settings etc.) What you see is ... This is a module that adds back-end tools for tracking down broken links and unnecessary redirects. That's pretty much all there is to these views right now; I'm still contemplating whether it should also provide a link text section (for SEO purposes etc.) and/or other features. The magic behind the scenes The admin tool (Process module) is about half of Link Checker; the other half is a PHP class called Link Crawler. This is a tool for collecting links from a ProcessWire site, analysing them and storing the outcome to custom database tables. Link Crawler is intended to be triggered via a cron task, but there's also a GUI tool for running the checker. This is a slow process and can result in issues, but for smaller sites and debugging purposes the GUI method works just fine. Just be patient; the data will be there once you wait long enough Now what? For the time being I'd appreciate any comments about the way this is heading and/or whether it's useful to you at all. What would you add to make it more useful for your own use cases? I'm going to continue working on this for sure (it's been a really fun project), but wouldn't mind being pushed to the correct direction early on. This module is already in active use on two relatively big sites I manage. Lately I haven't had any issues with the module, but please consider this a beta release nevertheless; it hasn't been widely tested, and that alone is a reason to avoid calling it "stable" quite yet. Screenshots Dashboard: List of broken links: List of redirects: Check now tool/tab:
  4. @Matthew: no one still seems to have a clear idea, so I guess we can only assume that something big (that they've got no control over) broke down. Network failure or something like that, perhaps? Happens to the best of us, but admittedly they could've explained things in a bit more detail. I was trying to write something here when the downtime started. Kept tabs on it for the first hour or so in hopes it'd be fixed soon, but well..
  5. RT @processwire: New module: Field Generator by @plauclair – generate random strings for any field – http://t.co/BVWwz6tWZK

  6. For your first scenario I can't quite see what the big benefit of session would be, though that depends on the structure of your page and the way you build this thing in the first place. Some possible solutions I'd consider: If the edit view opened in modal box is an external page (not part of this page or put together on the fly) then you'll have to somehow let it know what it is that you want to edit.. and in that case I'd rather provide it with page ID and field ID (or name) as GET params. If the edit view is generated and filled out on the fly (and submitted by AJAX, I'd assume) you can just grab the content from page using JS without the need to store anything in session variables. In your second scenario I'd also consider using GET params (specify comment ID to quote from) or storing either the comment ID or even the whole quoted text (unless you really need to support storing *a lot* of data) in JS cookie. This is an example of situation where you probably don't need to make sure that quoted text is somehow protected (in most cases user can edit it upon posting anyway), so storing that data in session provides very little extra value. -- Considering sessions vs. other methods of storing run-time data in general: Biggest reason I tend to avoid sessions is that as the amount of data stored in session grows in size, so do the memory requirements (and, in extreme cases, also the disk space requirements) of your site. At least some PHP versions load whole session data to memory when session is started, so you can imagine what having tens of kilobytes, hundreds of kilobytes or even megabytes of data (a worst case scenario, but still) does on a site with a lot of simultaneous users. With sessions you'll also want to make sure that you're cleaning stored session files properly (which, by the way, isn't always as trivial as it may sound) and preferably clearing stored values run-time too, especially if you're storing a lot of content. GET params, on the other hand, don't consume any extra memory.. and storing stuff in JS cookies only consumes client resources. As for why one would prefer to use sessions, biggest benefits are that a) session variables make it possible to "hide" the mechanism behind this all from the user and b) session data is much harder (practically impossible, unless you've made it possible yourself) to tamper with (it's easy to try out different values for GET params or alter data stored in JS cookies). Ease of use is a very real benefit too, of course. Storing data in session variables is often the least painful route. Tradeoffs, tradeoffs.. but then again, isn't that what web / software development is always about?
  7. RT @cmscritic: The #CMS Awards Are Fast Approaching..Nominate Your Favorite Today #cmsawards http://t.co/PdBUYuGZxW

  8. Sounds a bit like "collection" might be a Page type field. If that's the case, try something like $page->collection->title (if it's set to contain one Page) or $page->collection->first()->title (if it's set to contain multiple Pages).
  9. @tobaco: have you tried setting publish_until to current date -- or any other date between now and publish_from? That should do the trick and is, at least in my opinion, preferable to altering existing values (those could be useful for audit purposes etc.)
  10. RT @Moz: "In 2004, good SEO made you remarkable on the web. In 2014, good SEO is a result of being remarkable on the web.” - @randfish

  11. RT @chrisduncan81: Just in case you were wondering how #java relates to #javascript http://t.co/TRMvEYfxHc

  12. @LostKobrakai: right, the polling frequency was explained on the site after all -- 15 minutes "or even faster". I guess I didn't read the site carefully enough.. and the details being so scarce could be a result of each channel being so different from others. Might have to take another look One thing that's still unclear to me is whether using the service costs anything and if there are any kind of limitations etc. to it's use? Also, is it possible to add things like new channels, or are these provided by the developers themselves and/or their official partners? Just noticed that they've got specific channel for WordPress, but couldn't find a channel that would allow me to do something less specific via web, i.e. trigger an action on a ProcessWire site based on email. I might be misunderstanding something here, though, so perhaps I don't even need a channel for that?
  13. You're right. Each field requires a table of it's own. "Templates = tables" is figurative speech -- that's just roughly how they function from the developers point of view. The main point here is that each template is a collection of fields and in this way resembles table in database. Each page is connected to one template, and thus that template defines what data this particular page can store, and that's also why some people prefer to think that "pages = rows". Does this make any more sense to you? One noteworthy difference from database concept is that each field can belong to multiple templates. This is done so that fields with identical configurations (such as "body" field with same tools) can be used in many templates without having to add and configure new field for each template. As a side note, most developers using ProcessWire never dive into the real database structure. You don't have to do that to work effectively with ProcessWire. Don't get stuck at those things since that's something that the system handles for you (and, in fact, it's never recommended to perform direct SQL operations on existing tables).
  14. Great thing about Pushover for my use case is that you can configure critical alerts to disregard things like phone being on silent mode.. and, of course, those can also trigger an alarm-sound that's sure to wake you up in no time. That combined with it being real-time (push, not pull) and a common hub (account) that all messages can go through (making it possible for one email or API request to trigger notifications on multiple devices simultaneously) make it pretty awesome It would seem that IFTTT might supports something similar, but from different point of view: receiving an email (or text message or any other supported trigger) can trigger an event, which are apparently provided as applications of sorts. Interestingly one of those events is Pushover, so I'm guessing that "Pushover-like" functionality probably isn't built-in in IFTTT. @Diogo (or anyone else with experience using this), am I getting this right? IFTTT website is so incomprehensible ("marketing-oriented" might be the correct word here -- a teaser with "join now" buttons everywhere) that I couldn't be really sure about anything. Being more than a bit stubborn, I refuse to install an app just to see what it does (or, better yet, "join" something that doesn't even explain what the heck it really is that I'm joining..)
  15. As a quick heads-up I've just updated the module (twice, as it turned out that Joss' problem was related to certain regexp not expecting .co.uk TLDs..) and it should now work with the new Google Maps URL format. The problem is that this new format is more difficult to work with than earlier one, so I'm doing some ugly tricks (such as relying on old maps URLs) to keep things working. This is not a good solution in the long term, which is why an extensive rewrite of this module is going to be required soon, unless there's some solution I just haven't thought about yet. I've added a new checkbox to module config, titled "use coordinates". If this is checked, new maps URLs will be embedded based on coordinates, which is accurate but also replaces place name with those same coordinates. If it's not checked, location name will be used instead, which is far less accurate and for Finnish place names, for an example, practically didn't work at all. Like @Hani pointed out above, old Maps URLs still work -- which is a very good thing, since at least it means that old content should (for the time being) remain intact
  16. RT @DMTintner: wise words from a young steve jobs https://t.co/gDHpSv7rZ8

  17. Not really. Identifier in can be any valid label. This, for an example, is entirely valid: <?php echo <<<TEPPO Hello world. TEPPO;
  18. Try http://processwire.com/about/sites/categories/blog/.
  19. RT @stevefaulkner: Intro to and srcset, explaining the problems they solve and how to use them. http://t.co/JN02RXVXUZ #HTML5.1 @…

  20. RT @adrocknaphobia: Opportunity is recursive. It leads to more opportunity.

  21. teppo

    Hanna Code

    Is this still a problem? Does anything else work, i.e. is this the only place that's broken on this site? Sounds like your database wasn't reachable at this point, but I'd imagine that causing issues elsewhere too. Unless, perhaps, it's somehow related to PHP's mysqli extension on that server (just about all core features have already been migrated to PDO instead). Only weird thing I can spot in your code right away is that you've got $image = ... commented out, yet on the next line you try to use $image->url, which obviously won't be available here. I'm assuming that this was just something you did for testing and forgot there. When you're saying that only output is the product description, it's coming from this Hanna Code snippet, right? Are you seeing empty <h3></h3> tags and then <p></p> tags with product description inside them and nothing else, or..? I'm not really sure what you're referring to when you say that all other content from the "body" disappears; <body> element of your page, $page->body, or something entirely different? If you view the source of the page, is there anything weird there -- or in your log files, either in site/assets/logs/errors.txt or Apache logs?
×
×
  • Create New...