Jump to content

teppo

PW-Moderators
  • Posts

    3,208
  • Joined

  • Last visited

  • Days Won

    107

Everything posted by teppo

  1. First one is brilliant. I really like how simple and clean it makes things look. Great job!
  2. RT @yellowled: Erm, @processwire, did you maybe forget to announce something? http://t.co/eAGodIJPND

  3. RT @codepo8: Dungeon Keeper Android's rating system filters out "1-4 star" reviews - http://t.co/XJj0E4MXph *sigh*

  4. Just checking: you've tried creating output (into a variable, such as $out = "my markup goes here") and returning that variable (return $out), not just echoing it out directly.. and it doesn't work? It definitely should, so I'm guessing there's something weird going on. If you could post some sample code that causes issues, I'd be happy to take a closer look. Answer to your non-intended question is that you'll still have to render some inputfield markup there. This is probably easiest to explain with some code. Example below will output "my value" first, then render any inputfields this wrapper contains (in this case just one markup inputfield with value "some markup.") $wrapper = new InputfieldWrapper; $wrapper->attr('value', 'my value'); $inputfield = new InputfieldMarkup; $inputfield->value = "some markup"; $wrapper->add($inputfield); echo $wrapper->render();
  5. @ryan: the issue I was having was (once again) related to API use, in which case access control affecting things makes sense.. and yes, since then I've been running modified core code (include=all) and at least that particular issue seems to be fixed By the way, I only just noticed your post and had already written a slightly more extensive test script to see what exactly happens when I work with repeaters over API without aforementioned fix. I posted it as a public gist here, if you want to take a look: https://gist.github.com/teppokoivula/8889040. Still far from a proper test case and a bit disorganised, but at least it helped me figure out what works and what (possibly) doesn't.. It's very much possible that I'm doing something wrong here and/or should really do even more manually, but so far it seems to me that repeaters could use some extra garbage cleaning here and there -- and perhaps some simplification especially when it comes to creating and/or removing repeater fields. It should also be noted that I couldn't find any "official" documentation either, so the way I'm doing this at the moment is partly copied from core code, some if it came from examples adrian (I think) posted somewhere etc.
  6. I'm not exactly sure what you're thinking "combine" means here, but this field does exactly what the description says; it grabs data from other fields, mashes it all together into one big blob of (JSON) content -- and that's just about it. One very simple (yet sometimes very practical) use case is if you've got, say, 15 different text fields and you need to find pages that contain value "john doe" in any of those. Instead of doing this: $john_does = $pages->find('field1|field2|field3|field4|field5|...|field15%="john doe"'); .. you can create a cache field, select all of those fields to be cached in it, and then do this: $john_does = $pages->find('my_cache_field%="john doe"'); Not only does this look clean, in certain situations it can wildly improve query performance.
  7. Reviving an old topic, as I'm seeing something similar here at the moment. Sadly my current setup is far from clean test case, so I won't be going into too much detail, except that it seems to have something to do with Pages delete() method. Simply put it doesn't find actual repeater items, so they never get deleted. For an example page /processwire/repeaters/for-field-359/for-page-1646/ gets deleted, while one below it at /processwire/repeaters/for-field-359/for-page-1646/1391714225-7472-1/ remains. This is the original code that won't work for me: public function ___delete(Page $page, $recursive = false) { if(!$this->isDeleteable($page)) throw new WireException("This page may not be deleted"); if($page->numChildren) { if(!$recursive) throw new WireException("Can't delete Page $page because it has one or more children."); foreach($page->children("status<" . Page::statusMax) as $child) { If I change that last line to this, repeater items are found and properly deleted: foreach($page->children("include=all") as $child) { I'm probably missing something here, especially since I've no idea why status selector is used here or why it doesn't seem to find the repeater page in question, but at least for me this fixes the problem. Might cause some new ones, though, don't know about that yet..
  8. @Anssi: sounds like an issue with secure connection. Google is using HTTPS for all search results and RFC 2616 clearly states that when going from HTTPS to HTTP referer header should not be preserved: One exception to this is referer meta tag, which Google is actually using to provide some basic referer information for browsers that support this -- namely the domain that a request originated from. There's not much information you can get out of that, though Simple test: open dev tools, switch to net panel (or whatever it's called in your particular flavour of tools), set up filter (if available) to only show documents, enable "sticky" logging ("Preserve Log upon Navigation" in Chrome) and click any Google search results. Only the originating domain should be included with request headers.
  9. @dragan: if you're literally using var_dump(), it should be noted that it doesn't return anything. In order to store it's value in a variable you'd need to use output buffering or some other trick. Another option is to use print_r() with return param set to true. Main difference between var_dump() and print_r() is that var_dump() provides more information about the data types involved, while print_r() only outputs content. Edit: you should also take a look at this comparison between var_dump(), print_r() and var_export().
  10. Should've done this earlier, but I've just pushed to GitHub updated version of the module. This version is set to require "changelog" permissions and create it when the module is installed. Dragan and any others who've already installed the module: I suggest that you get the latest version, add aforementioned permission manually and then apply it to those roles that should be able to access changelog page.
  11. One (definitely not fool-proof but still useful) approach is to rely on those same proxy sites and implement a simple blacklist. Hide My Ass! has a nice list of public proxy site IP's you can use -- and, surprise surprise, even buy as a .txt file. For $25 they even promise to email you updated copy every day "for life". How's that for a business model?
  12. “Failed asserting that true is false.” That sounds about right.

  13. RT @GonzoHacker: Human Resources will now be known as Meat Based Machine Maintenance. Please let your supervisor know if you require servic…

  14. RT @dinet: Help get @processwire packaged by Bitnami. You can vote at http://t.co/jtElRFiiWi

  15. Two days to go and #ProcessWire is leading Bitnami contest. There's still time to vote, though: http://t.co/K3EJf8NaEm

  16. RT @smashingmag: A JavaScript library to make absolutely positioned elements attach to elements in the page, efficiently. http://t.co/Z3Wq1…

    1. MatthewSchenker

      MatthewSchenker

      I'd like to see it! Can you fix the link?

  17. RT @codinghorror: I love phone apps for websites because it is just so much fun to learn two totally different and incompatible UIs for doi…

  18. Once again on a tight schedule here, but first of all, I'd start with making sure what character sets are actually in use. If not UTF-8, you can convert data to it with relative ease, though it needs to be done once for database, then on table-by-table basis for existing tables. This is important to keep in mind, though: (Source of quote: http://dev.mysql.com/doc/refman/5.6/en/alter-table.html.) Hope this helps a bit. I'd be happy to take closer look at this at some point too, now I'll have to run
  19. Slightly unrelated, but is there an actual warning or what? Just checking, 'cause in that case we'd be seeing *a lot* of these
  20. RT @jeansnow: Fun 3-part history of consoles from TIME: http://t.co/sPpILgtIw5

  21. Glad to hear that you found a solution, but in a case like this I'd really suggest taking a look at bootstrap method. It's perfect for tasks like these, where you don't really want or need actual page, just code that can access data and/or features of ProcessWire.
  22. This is one of those situations where it would be awfully helpful to really see what's the full context, pages and fields you've got etc. but based on what you've posted here: That error seems to suggest that your second foreach loop (assuming it's actually on line 5) gets invalid argument, i.e. $bora->user_select_asset isn't something you can iterate with foreach. The main problem here might be the way you're trying to find users; try one of these instead: // this one: $borago = $pages->find("template=user, user_select_asset.count!=0, include=all")->remove($page); // or this one: $borago = $users->find("user_select_asset.count!=0")->remove($page); If that doesn't help, I'd suggest that you add a check before second foreach line, where you output something like var_dump($bora), var_dump($bora->user_select_asset) and/or get_class($bora->user_select_asset) just to check what you're actually dealing with. If echo doesn't work there, try wrapping the command with die() (or writing output to log file, here's one example for implementing that.) Also: make sure that all your variable and template names are properly written; for an example in your first post you mentioned template name "addAsset", while in your code you're trying to find pages with template "addase". Has the name changed or is it misspelled here?
  23. teppo

    Book Recommendations

    PRINT "I LOVE MY COMMODORE" You key in this and press RETURN I LOVE MY COMMODORE The computer prints this READY ▋ Admittedly this is a border case for a book-related thread, but I simply couldn't resist after todays comments in the admin theme thread: anyone remember that user manual C64 shipped with? The one that was part how-to guide for using C64.. but mostly an introductory book for Basic programming? Well, for those who do remember (or don't but would like to) it's available as an HTML version from lemon64.com.. and commodore.ca has even more of that same stuff in PDF format. They really don't make manuals like that anymore (probably for a good reason -- just imagine a modern PC or Mac shipping with C/C++/Objective C manual) but that's also one of the few manuals I remember reading from cover to cover more than once.. and actually enjoying it "Before you can use sprites it's important that you understand a few general things about how computers work.."
  24. I've just pushed to GitHub new version of this module. This update includes some minor improvements, such as storing version data for pages starting from the moment they're added, and as a bigger addition $page->snapshot() feature exactly as described by @SteveB earlier: echo "Page title now: {$page->title}<br />"; $page->snapshot("-1 week"); echo "Page title last week: {$page->title}<br />"; I've been working on and off this for a while now and actually had to write a bunch of PHPUnit tests just to make sure that everything works as expected (too many moving parts to keep track of manually.) There's still some work to do here and especially performance-wise more tests to be made, but at least this shouldn't disrupt how other parts of the module work
  25. That error is caused by the fact that you run this file without involving ProcessWire at all. You can't just run template file "standalone" and expect it to automatically load ProcessWire, you know Solution @horst provided above is most likely what you need here (or external / real cron job instead of this awfully limited scheduler thing you're using now). Then again, if this is the only reason you need that template, i.e. it doesn't need to be web-accessible, you could forget whole template and page thing and simply place a PHP file somewhere your scheduler can access (such as your PW root directory) and in that file bootstrap PW and write any program logic you need. Point your scheduler to that file and you're all set.
×
×
  • Create New...