Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/08/2016 in all areas

  1. If you want to avoid converting the selector to SQL you can let ProcessWire do it for you as teppo has shown in this post: $selectors = new Selectors("template=blog-post, limit=1000000"); $pagefinder = new PageFinder(); $sql = $pagefinder->getQuery($selectors->getArray(), array())->getQuery(); Then you can modify that or wrap your own select around it: select sum(data) as sum_amount from field_amount where pages_id in ($sql)
    7 points
  2. #7 of 50: http://dailycodex.com/top-content-management-systems/ http://www.queness.com/post/14579/6-lightweight-flexible-php-cms/page/1 http://preludi.fi/blog/processwire-julkaisujarjestelma-6-syyta-valintaan
    5 points
  3. HELLO! Just in case anyone's interested I've just started this podcast http://www.machine-ethics.net/ I sent less than a day building the site so be kind. I'm looking to improve it and make it available as a site profile as it has an rss feed that itunes can pick up and use which may be useful for anyone else creating podcasts. cheers
    4 points
  4. Well spotted Willy! Cintia, before translating from portuguese to english, make sure you don't have mistakes on the portuguese words because it messes up the translation even more than usually. For instance, you missed the R in "Brasileia" and the G on "seuinte", and there are more. edit: Duh, you won't understand this probably , here you go: Cintia, antes de traduzires para inglês verifica que não tens erros no português. Isso vai tornar a tradução ainda mais caótica do que já fica normalmente. Por exemplo, falta o R em "Brasileia" e o G em "seuinte", e há mais assim.
    4 points
  5. Nice one Jan Romero - I hadn't seen the use of the Selectors class and PageFinder like that. Putting it all together: $selectors = new Selectors("template=basic-page"); $pagefinder = new PageFinder(); $sql = $pagefinder->getQuery($selectors->getArray(), array("returnVerbose" => false))->getQuery(); $result = $database->query("SELECT SUM(data) AS sum_amount FROM field_amount WHERE pages_id IN ($sql)"); $sum = $result->fetch(PDO::FETCH_COLUMN); echo $sum; Note that I had an SQL error regarding "SQL_CALC_FOUND_ROWS" when I included a limit in the selector. If I removed the SQL_CALC_FOUND_ROWS then it complained of not allowing limit in IN. Remove the limit from the selector and things work just fine. Also, note that you need to specify "returnVerbose" => false - otherwise you get a php NOTICE: https://github.com/ryancramerdesign/ProcessWire/issues/1734
    4 points
  6. 3 points
  7. Ok, the latest version now correctly modifies the editor path to the file in the errors panel, as well as dump() and barDump(). Thanks again @szabesz for helping so much to figure this out - sorry we got so sidetracked along the way
    3 points
  8. If you didn't have so many pages I would say go for something like this where you populate the pageids from your selector in the IN clause. SELECT SUM(data) AS sum FROM `field_amount` WHERE pages_id IN ( 1234, 2412, 1234 ) But with 1 million page ids in your "IN", that's not going to work What about this: SELECT SUM(data) AS sum FROM `field_amount` INNER JOIN `pages` ON `field_amount`.`pages_id` = `pages`.`id` WHERE `pages`.`templates_id` = 29 The problem with this is that you need to reproduce your initial pages selector - in my example I am just limiting to a template. Do you think you could make this work? What is your actual selector?
    3 points
  9. I can't test it right now but I also clicked on the link in the error panel.
    2 points
  10. Woot - Dreamhost are offering free 1-click installation of Let's Encrypt certs (ok, almost 1-click.) I've tried it out on a few domains and it works really well for the most part. I've had an install fail on one domain but they are working to fix the problem. Update: Looks like the failure was a user error - I deleted the certificate when installing PW
    2 points
  11. Hey, steady on, tiger, let's give it a try. I just installed the module on a fresh 2.7.2 install (Basic profile) and followed the instructions in the repo and everything installed beautifully. I also created rough root, forum and topic pages, just for testing. The first thing puzzling me is that I also added a new PW role 'member', expecting to give that role 'create topic' and suchlike privileges, but, to me, the config options in the backend aren't coming up where I'd expect them (at subforum level), but at topic level. And there's no sign of my 'member' role being offered the chance to do anything. Is there something I have done wrong? I would like to spend some time giving whatever help I can to help make this work.
    2 points
  12. i dunno.twig butt i try answer neway for.theis port echo $twig->render('promocoes/index.twig.html', array( 'promocoes' => $promocoes, )); where $promocoes comes.from ? can u.show code for thats ? try remove.this {% if promocoes %} and {% endif %} try removes "key," from {% for key, promocao in promocoes %} alsos look.u have unclose span tag <span> Nº {{promocao.getnumero}} </span <--need close! -=-=-edito-=-=- nm. > <!-- found.it
    2 points
  13. You know that a new sanctuary is just being built for you somewhere in Austria
    2 points
  14. I don't think any changed wording will completely solve the problem of people leaving out vital details, but the line in question could be easily ammended to include the PHP keyword: Easy-to-use, jQuery-style API for PHP
    2 points
  15. "jQuery-Based API" - that's where the comparison to jQuery bears potential for misunderstanding. A few people seem to skip the word "inspired" and make PW accidentally JavaScript-based. As a developer reading that list, not knowing PW, I would be rather alienated. Just thinking out loud - could we as the community find a one line pitch for ProcessWire's API that evenly matches without causing misunderstandings like these? "PW comes with an easily approachable and powerful API"? I know, neither short nor "sexy". But precise /edit: When pitching PW to my customers (or potential ones) I compare it to "modelling clay" - a thing/tool that can be shaped in any desired form. Just ignore the shortcoming of this comparison, the connotation of "toy"
    2 points
  16. This could look like this in a template $arrayData = array( "success" => 1, "products" => Array( Array( "id" => 1, "type" => 6, "name" => "product1", "title" => "Product1", ), Array( "id" => 2, "type" => 5, "name" => "product2", "title" => "Product2", ) ) ); class MyData extends WireData {} $someData = new WireArray(); foreach($arrayData['products'] as $prod){ $p = new MyData(); foreach($prod as $key => $val) $p->$key = $val; $someData->add($p); } $someData->sort("-type"); foreach($someData as $r) echo "$r->title<br/>"; $result = $someData->find("title=Product1"); foreach($result as $r) echo "$r->title<br/>";
    2 points
  17. Hi everyone, Thanks to a request from @Ralf, this module now also works on the front-end. If you have setup your own login form and profile editing forms you can enable this for the front-end and specify a URL to redirect to for the user to change their password.
    2 points
  18. MediaLibrary Update: MediaLibrary can now be found in the official module list. Out of necessity, I've started to implement a simple media library module. The basic mechanism is that it adds a MediaLibrary template with file and image fields. Pages of this type can be added anywhere in the page tree. The link and image pickers in CKEditor are extended to allow quick selection of library pages from dropdowns. In the link picker this happens in the MediaLibrary tab, where you can also see a preview of the selected image. In the image picker, simply select a library from the dropdown at the top, everything else is handled by standard functionality. I've put the code onto github. This module is compatible with ProcessWire 3. Steps to usage: Download the module's zip from github (switch to the pw3 branche beforehand if you want to test on PW 3.x) and unpack it into site/modules Click "Modules" -> "Refresh" in the admin Click "Install" for MediaLibrary For testing, create a page with the MediaLibrary template under home (give it an expressive title like 'Global Media') and add some images and files Edit a differnt page with a CKEditor field and add a link and an image to see the MediaLibrary features in action (see the screencap for details) Optionally, go into the module settings for MediaLibrary Note: this module is far from being as elaborate as Kongondo's Media Manager (and doesn't plan to be). If you need a feature-rich solution for integrated media management, give it a look. Feel free to change the settings for MediaFiles and MediaImages fields, just keep the type as multiple. There are some not-so-pretty hacks for creating and inserting the correct markup, which could probably be changed to use standard input fields, though I'm a bit at a loss right now how to get it to work. I've also still got to take a look at error handling before I can call it fit for production. All feedback and pointers are appreciated (that's also why I post this in the development section). Edit 09.03.2016 / version 0.0.4: there's now also a "Media" admin page with a shortcut to quickly add a new library. Edit 01.05.2016: Version 0.0.8: - The module now supports nested media libraries (all descendants of eligible media libraries are also selectable in link/image picker). - There's a MediaLibrary::getPageMediaLibraries method you can hook after to modify the array of available libraries. - You can switch between (default) select dropdowns or radio boxes in the module configuration of MediaLIbrary to choose libraries. Edit 10.10.2018: Version 0.1.3: - Dropped compatibility for ProcessWire legacy versions by adding namespaces - Allow deletion of libraries from the Media overview admin page - Added an option to hide media libraries from the page tree (optionally also for superusers)
    1 point
  19. Same here with Dreamhost. I was a skeptic at first, however I'm starting to like the whole process. I've converted quite a few domains over to Let's Encrypt and plan to convert all others when possible.
    1 point
  20. That's okay. Happy to help Your Tracy Debugger module is a godsend!
    1 point
  21. Hello guys! I Brasileia not know if I can express myself cool, but it's seuinte . I'm doing a project with php / twig and then I climbed p ftp some thing not working, kind . I'm going through my p twig.html an array of objects with the description of my registered any product in the db . Hence produto.getdescicao mosrar use for this data. It turns out that for some products the description is displayed and no golds and do not have the same poblema priate squeegee the local system
    1 point
  22. I see Thanks a lot!
    1 point
  23. Great - thanks for confirming that the paths are correct for dump() and barDump() The class not found error will be because of the template being the ProcessWire namespace. If you are doing that, then you'll need prepend a "\" to your calls, eg: \Tracy\Debugger::dump('Test \Tracy\Debugger::dump'); \TD::dump('Test \TD::dump'); and then they'll work fine.
    1 point
  24. Oh, I see - I have been running in StrictMode, so haven't been noticing that - there is another location that I need to add that hack to change the path. I'll get that fix committed shortly. @tpr - is this the case for you also? Do the links from dump() and barDump() calls get converted properly?
    1 point
  25. Ooops, yeah, I am clicking on the link in the error panel:
    1 point
  26. Thanks! I am wondering what links are actually showing the compiled file? Can you show a screenshot of the link you are trying to click on? Here are some examples showing it working as expected: Link from a dump() Link from a barDump() I am starting to think you are talking about other links, but I am not sure what!
    1 point
  27. @matjazp: I tested with php 5.6, 5.5 and 5.4 and did not make a difference. $loc is always 0. I put $loc = 7; on line 100 and I still get the compiled file. But this time: Before the Tracy hack str_replace $file is: .../site/assets/cache/FileCompiler/site/modules/TracyDebugger/ProcesswireInfoPanel.inc after modifying the string we get: .../site/modules/TracyDebugger/ProcesswireInfoPanel.inc The above is 7 times, and we have "VariablesPanel.inc" 2 times at the end. So "/site/assets/cache/FileCompiler" is removed as expected, but how is this path related to the my template file? Do not bother explaining it though, I was just wondering a bit
    1 point
  28. Is $loc always 0 ? If so, then that's the problem. I get it 0 sometimes - when the first result of findLocation() is a module file. But when it's a template file, $loc returns 7 At least from this: [0] => .../site/assets/cache/FileCompiler/site/modules/TracyDebugger/ProcesswireInfoPanel.inc I can see that the path in $file is matching something that the next line can remove the "/site/assets/cache/FileCompiler" component to make it the path to the original file. Can you please clarify that $loc is always 0? What if you force it to 7 on line 100? Thanks again for your help with this!
    1 point
  29. $loc is 0 self::findLocation() : Array ( [0] => .../site/assets/cache/FileCompiler/site/modules/TracyDebugger/ProcesswireInfoPanel.inc [1] => 162 [2] => Dumper::toHtml(\ProcessWire\wire('page'), array(Dumper::COLLAPSE => false)) ) EDIT: and similar values, since toHtml() gets called a lot of times...
    1 point
  30. list() populates the $file variable from the result of findLocation(), or NULL if $loc returns false. I am not sure what's going on, but if your edit links are to the compiled file, then it would suggest that $file is being populated. Could you maybe check the value of $loc and self::findLocation() before that list() call please?
    1 point
  31. $file contains an empty string, but even before this line: list($file, $line, $code) = $loc ? self::findLocation() : NULL; I cannot seem to find any occurrence of $file before this line, so I suppose that is why it is empty in the first place.
    1 point
  32. Hi arjen, I'll dig those up again. Not sure why I would have put an expiration on the pastes.
    1 point
  33. Hey all Since the topic of backups comes along every so often I decided to write a module to encapsulate some code I use for backups on Linux installs. It's not quite ready yet as I want a fallback option for Windows as well as an option for Linux that will work on shared hosting where you usually cant run system commands, but it is 80% complete for stage 1 and Linux backups work nicely. The general idea is that you set the number of days to store backups (I standardised it to 1 day, 3 days, 1 week, 2 weeks, 1 month, 3 months, 6 months and 1 year rather than having it as an integer field because I think these fit the most common scenarios and I wanted to have a dropdown in my module config too It defaults to 1 week, but depending on the size of the site and how much space you have you might want to increase or decrease the retention period. The idea is that you are given a URL with a unique hash (generated at install) which you then pass off to a cron job or Windows Scheduler and this generates the backups. It will be expanded on once I've got the backups working across different environments but the initial plan is to release a version that simply backs up the site and database, then a version that has a page where you can download backups from as well as an option to FTP/sync them to another server. I don't want to tackle restores though as this would be difficult - you are logged into the admin whilst running the restore so I think the first thing it would do when it has restored the database is log you out, plus I don't want to make assumptions about replacing a user's /site/ folder so I think restores require some manual intervention to be honest. An alternative would be to do this anyway but rename your /site/ folder and take another database copy before restoring, but I'm getting into the realms of trying to be too clever then and anticipate what people are trying to do and ProcessWire is all about not making assumptions Fortunately I have access to a site with several gigs if uploaded files as well as a reasonably large database so I should be able to monitor how well it handles that on Linux and Windows, but smaller sites shouldn't take more than a minute to backup, often a matter of seconds. I shall keep you posted.
    1 point
  34. Hey guys, I am not sure what is going on. To make this work I have made a small tweak to the Tracy core (hopefully only temporary as I have asked them about a way to publicly modify the filepath) - you can see it here: https://github.com/adrianbj/TracyDebugger/blob/master/tracy/src/Tracy/Dumper.php#L111 Would you mind taking a look at that and debugging why it might not be working - just find out what $file contains before and after that str_replace I can imagine on Windows I probably need to replace all the "/" with DIRECTORY_SEPARATOR but it sounds like @szabesz is on a Mac so what I have should work? Thanks to both of you for helping out with this.
    1 point
  35. $sum=0; $start=0; $limit=1000; do{ $mypages=wire('pages')->find("start=$start, limit=$limit, $myselector"); print "processng pages.frm $start<BR>"; foreach ($mypages as $mypage) $sum += $mypage->amount; wire('pages')->uncacheAll(); $start+=$limit; }while($mypages->count());
    1 point
  36. I got the same issue as szabesz on Win, though I haven't checked it with the newest version.
    1 point
  37. Hello adrian, Thank you very much again for the new feature! I have just found the time to test out this protocol handler thingy, and with the following configuration string it seems to work well with PhpStorm Mac: phpstorm://open?file=%file&line=%line However, it does open the compiled file in cache instead of the original ones. Do you have any ideas why?
    1 point
  38. jQuery-inspired is in my opinion the best short description of our API. "An easily approachable and powerful API" is way too generic, especially since the jQuery connection is actually an important point. ProcessWire's API is modeled after jQuery, after all, the general idea being that "if you know jQuery, you'll learn ProcessWire development in no time". On a related note, personally I prefer to discuss it as the "developer API", not just API. On a couple of occasions I've had to specifically explain that ProcessWire doesn't actually expose a public API automatically. The Finnish translation ("rajapinta" vs. "kehittäjärajapinta") seems to be even more prone for misunderstandings
    1 point
  39. You can now click on the text of any entry in the PW and Tracy log panels to open the file in your code editor to the line number of the clicked entry. Of course for this to work, you need to have properly configured your editor protocol handler. Not really worthy of a screenshot, but still a very handy shortcut that I hope you'll find useful for when you have an log entry that has been truncated because it's too long for the built-in viewer.
    1 point
  40. Nice one bernhard - I totally missed the line in the OP noting that PW was being bootstrapped
    1 point
  41. outputformatting is always off when bootstrapping pw so your file-fields will always return arrays no matter what the setting in the admin is ps: yeah - the once in a lifetime moment when adrian has already posted a reply and i added (little) additional value with my answer. i will print that post and hang it up in my living room
    1 point
  42. worked like a charm just installed it on several of my domains as one of my certs ran out and it is so easy: https://devblog.plesk.com/2015/12/lets-encrypt-plesk/ there's also an option to secure your plesk panel now (think this was not there from the beginning?!)
    1 point
  43. Related to this: https://github.com/ryancramerdesign/ProcessWire/issues/1728 ?
    1 point
  44. a nullpage will return 0 for the id, not NULL, so the correct way to check is just like i wrote if($item->id) { // this is a page } or if(!$item->id) { // this is a nullpage } see here: https://processwire.com/api/types/nullpage/ @tooth-paste can you show us your current code? that would make it easier. in your case it would be something like if($items->count() > 0) { // we found x children, so show the arrow }
    1 point
  45. NOt an easy one, but maybe easier for you now: https://processwire.com/talk/topic/6096-imagick-resizer-need-to-be-tested-2/#entry59711
    1 point
  46. A very honest write up by our very own André (@onjegolders) http://milktop.co.uk/articles/picking-the-right-cms-for-the-job I already told him about the built-in frontend editing on 3.0 and the Pro Drafts live editing
    1 point
  47. None that I'm aware of. Of course you can always use PageFinder for this, but it's going to look a bit hacky: $selectors = new Selectors("template=blog-post, limit=5, sort=name"); $pagefinder = new PageFinder(); $options = array('returnVerbose' => true); $sql = $pagefinder->getQuery($selectors->getArray(), $options)->getQuery(); // .. and so on, depending on what exactly you're looking for
    1 point
  48. Here is a quick screenshot of an admin page we use to manage the initial hiring process of new employees. The module hooks into FromBuilder and pulls in entries that are associated with the page. So all the information on the left is from a FormBuilder entry, the sidebar is a little more typical and just made up of the fields assigned to the template. I'll post more about that later. We don't allow users to edit the comments, because they are part of the document trail, but they have a chance to review them in a modal before the actual submit happens. The "notify of comment" pulls in a list of people with particular roles. I'll post the code a little later, I need to put out a small fire first.
    1 point
  49. Keep it coming with the suggestions - there's a way to go yet before I'll add some of them but they're all welcome and will be considered once the basics are in place. Step 1 is definitely to see if I can get backups working in multiple environments, so attached is version 0.0.1. Consider it Alpha and use it at your own risk, but I can't see why it would harm your installation. Just giving you the obligatory "you have been warned" speech To install: Unzip the file, stick the folder in your /modules directory, install the module, set the retention period and read the instructions below the retention drop-down in the module config to manually run a backup for now Backups are stored in /site/modules/ScheduleBackups/backups in /site and /db folders respectively so you can monitor those There is currently no "backup succeeded" message or anything like that printed when it's done - just wait for the browser to stop loading the page for now, or for the zip/tar file to stop growing Some things to note: It does an OS check. This is because Windows can't run system() commands as they're a Linux thing, and if it finds you're running Windows it uses the ZipArchive class built into PHP to backup the site and simple mysqli queries to backup the database If it doesn't detect you're on Windows and can run system() commands then it does that which, from my past experience, is far quicker (plus it makes for nifty one-liner backup commands ). It does some detection to see if safe mode is on and whether it can run system commands before backing up, so if safe mode is on or it can't run those commands then it falls back to using the functions mentioned in point 1. During installation, a unique hash is created and saved - this is because when we set it to run via a cron job/scheduled task we need a way of creating a backup without a logged-in superuser in attendance. The backup uses a URL that I doubt you would have as a page on your site (/runbackup) as well as this hash so it is extremely unlikely anyone will try and bring your server down by spamming that URL. Further checks will be added in later versions so it can't run more than once a day anyway or something like that. Also, if anyone who is a better programmer than me wants to contribute then please feel free. Some of what I've written is likely amateurish in places. Kudos to David Walsh for his excellent mySQL backup script and this excellent function on StackOverflow about recursively zipping folders that saved me from re-inventing the wheel in those two areas. ScheduleBackups.zip
    1 point
×
×
  • Create New...