Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/24/2017 in all areas

  1. index.php ProcessWire Bootstrap Module Init (Hooks to ProcessWire::init) init.php ProcessWire Core ready Hooks to ProcessWire::ready ready.php Template Rendering prependedTemplateFiles template.php appendedTemplateFiles Hooks to ProcessWire::finished finished.php Shutdown This should be almost complete, but I don't guarantee about anything
    6 points
  2. I posted something like this a few years ago, but that's obviously not up to date with current versions of ProcessWire. Would be interesting to create an updated version and compare these side by side, just to see how far we've come since then
    5 points
  3. Currently the module is functional, I use it on every site and it work quite well, no error since November. At this moment only ProcessWire >3.0.0 is supported but I was planning to release it being compatible with 2.7. What you can do with the module (working features) : You can modify package's settings : name of final filename, ignore some folders, set a maximum number of packages, remove older packages and trigger the backup function with LazyCron or PwCron. Save the package in a local folder Upload package to Dropbox Upload package to GoogleDrive Remove packages from those cloud services (depending on the configuration set) *A package is a ZIP file bundled with a database dump and a full website directory dump (site, wire, etc) I think I will finish the first public version and we'll see what happens as I tested the @arjen's fork of @rot's module and didn't managed to get it working as expected. I also find my module more "simple" to use; I mean you set options, check some checkbox, set a cronjob, click submit and let it run. Also I saw some good features like emailing the logs on failure that could be added easily. I'll look at the module a little closer this afternoon. Thanks for your input guys.
    5 points
  4. Hello everyone, I've been fiddling around a lot lately with docker containers for my local development on a linux machine. Tried many different options, also readily available processwire images and tutorials from the forum. But never got it right. Mainly because of permission issues with docker volumes. That is a tricky part on linux machines whereas on OSX it doesn't seem to be an issue. Then I discovered http://www.wordpressdocker.com/. And the setup with nginx as a proxy that routes requests to separate containers with the actual site install appealed to me. The whole thing sits on top of alpine linux containers which are really lightweight. So I decided to give it a try. And, first time since experimenting with docker, I got a running PW install. Rewriting was not working until I adjusted the nginx config. Now I have a fairly complex PW site running in a container. Everything is working, image upload/editing etc. So I'm really exited, especially since the dev site is now blazing fast compared to my old vagrant virtualbox vm setup. Honestly, I don't really understand everything that is happening behind the scene. But I managed to adjust the original files and build a new image that works with PW and doesn't have all the WP stuff. The nginx config I took from https://github.com/elasticweb/nginx-configs/blob/master/configs/processwire-2.conf Not sure if it covers everything for PW3 as well. I would very much appreciate if someone who is more in the know than me could take a look. All files for building the docker image are here https://github.com/gebeer/alpine-php-processwire A working image here: https://hub.docker.com/r/gebeer/alpine-php-processwire/ Documentation is kind of lacking. I took over quite a lot from the original project. But following the github README and the original documentation should get people started who have a little experience with docker already. If someone needs a more in depth step by step tutorial for setting things up, let me know and I'll put something together.
    3 points
  5. $config->urls->httpRoot https://processwire.com/blog/posts/processwire-2.6.18-updates-pagination-and-seo/#new-http-prefix-available-for-all-config-gt-urls-properties
    3 points
  6. Since website.com/cycle/ would be a toplevel category why not show some kind of summary of the latest entries? This is what PW is great in! $newentries = $pages->find("parent=$page->children, sort=-created");
    3 points
  7. I have been playing around with the code from @Raymond Geerts, getting the pagination working. Thought I would post this for posterity: $limit = 10; $limit_first = 8; $offset = $limit - $limit_first; if ($input->pageNum == 1){ $results = $pages->find("limit=$limit_first"); } else { $start = (($input->pageNum - 1) * $limit) - $offset; $results = $pages->find("start=$start, limit=$limit"); } // output result items echo $results->each("<p>{name}</p>"); // override pagination $results->setLimit($limit)->setTotal($results->getTotal() + $offset)->setStart((($input->pageNum - 1) * $limit)); // output pager echo $results->renderPager();
    3 points
  8. Thanks for the update @flydev - I am definitely very excited to try this - thanks for the hard work!
    3 points
  9. @tpr - Jumplinks 2 will be able to export all of its data, including config, via JSON or a gzipped archive containing JSON data. It will also be able to import from CSV and JSON files generated by other systems. When importing from JSON, a specific format will be required, but the importer will ask for fieldnames where they don't match the destination fieldnames. So If you provide {{"from": "/Somedir/file.ext", "to": "/awesome/path"}}, it will work correctly without asking questions, but if from or to or any other field does not use those names, then the importer will ask what the names are so it can read those instead. ---- @All - Initially, I wanted to have the PHP version requirement match that of Processwire, but I would now like to stick to the PW version recommendation, which is currently 5.5+. This allows me to use slightly newer components. However, 5.5 is at end of life, and only 5.6+ is currently supported. In the interests of users with hosting providers who still offer 5.5 as the newest version, Jumplinks will work for you. That said, using a host that provides unsupported software is not recommended. Many providers are moving over to 7.0 and 7.1, so the Jumplinks PHP version requirement become 5.6 when 7.0 active support comes to an end in 10 months. Then I'll follow that format in the future, meaning that 7.0 will be required when 7.1 active support comes to an end in 1 year and 10 months. It's either that or I run a poll to see what version of PHP folks are using, and then make a decision from there. For those interested: http://php.net/supported-versions.php
    3 points
  10. Yep, you want a Page Reference field on the child pages. For "Label field" select the text field used in your repeater. Use the "Custom PHP option" for "Selectable pages" by creating the following hook in /site/ready.php: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name == 'my_page_reference_field') { $page = $event->arguments('page'); $event->return = $page->parent->podcast_show; } });
    3 points
  11. I am not sure whether this is relevant in your case and it is from a while back but just thought to post to see if it helps:
    2 points
  12. What @Klenkes said. You might want to add a limit=n in that selector though.
    2 points
  13. Did you see this post in your other thread ? If podcast_shows is a multi-page field, it doesn't matter whether you have one or more pages selected in it; it will return a PageArray.
    2 points
  14. Thanks @flydev I think you are right about this. If you need any testing help, please let me know.
    2 points
  15. Welcome to ProcessWire and the forums @swampmusic, You have two options. Media Library is a free module and Media Manager a commercial module (easily handles all sorts of media assets using a centralised approach; full disclaimer; I am the author of this module ). Oh, I think you meant Ryan, not Rory .
    2 points
  16. You or your client must have some deep pockets for font licensing. From the DTL website:
    2 points
  17. Welcome to the forums! I think you're on the right track here. Not sure that you need an end date field in the band description repeater - just the start date (a datetime field that defaults to today's date). In your event template file, for each selected band page you would get the most recent band description that is dated earlier than the event date. Inputfields such as AsmSelect have an option to edit pages in a modal window.
    2 points
  18. Using wire('pages') in a template file shouldn't cause an error (not sure why that's happening), but in template context you would normally access this API variable as $pages. In fact, in your screenshot you are doing that a few lines below on line 36.
    2 points
  19. Last update: June 2024 Current stable version: 1.5.4 Dev version: github dev-branch You can find the module on Github and in the modules directory : https://modules.processwire.com/modules/duplicator/ https://github.com/flydev-fr/Duplicator/archive/master.zip Screenshots / Features Dir and files exclusion CRON job Advanced settings Local and Cloud storage duplicator.mp4
    1 point
  20. Hi all, Recently I launched a module -ImportPagesPrestashop-, and now I was thinking if it is worthy to translate this module in several languages (starting with a translation in dutch, because I'm from the Netherlands). Is it worth to put the effort into the translation or do you guys think ->English is the best and translations are not needed? Thanks in advance, ~Harmen
    1 point
  21. With the latest dev version, you can also now do: $urls->httpRoot
    1 point
  22. In earlier versions of PW, all repeater items in a page would be loaded when opening Page Edit - this could cause problems if there were a lot of repeater items. But in recent versions repeater items may be ajax-loaded, meaning repeaters can now scale up much better than previously. So there's no reason to avoid repeaters. Also see Repeater Matrix, which is more similar to PageTable in that it allows for multiple matrix types (sort of equivalent to templates). You could use RuntimeMarkup in conjunction with a Page Reference field. You would configure a RuntimeMarkup field to get and format the fields from band pages currently selected in the Page Reference field. Note that after changing the Page Reference field you would need to save the page in order to see the RuntimeMarkup field update.
    1 point
  23. Played a bit more with this. The following works for me. I am not sure if it is foolproof and/or if there are better approaches. Please note: From what I can tell, when saving a page, inputs (fields) will be sent in the order they appear in a template. date1 refers to the first date and date2 to the last date. We need to temporarily store the value of date1 in order to later compare it to date2. I stored the value in a session. You could do it differently, e.g. cache it. The code doesn't prevent a save of the 2 date fields. You can do that if you wish. This code is necessarily verbose in places; just to make things clear. public function init() { $this->pages->addHookAfter("InputfieldDatetime::processInput", $this, "hookAfter"); } public function hookAfter(HookEvent $event) { $field = $event->object; if($field->name == 'date1' || $field->name == 'date2') { // @note: from what I can tell, inputs are sent in the order of the fields in the page // ...so, date1 will be hooked into before date2 $date1 = '';// first date $date2 = '';// last date $session = $this->wire('session'); // save date1 to session; we'll retrieve it to compare against date2 if($field->name == 'date1') { $date1 = $field->value; $session->set('date1', $date1); } elseif($field->name == 'date2') { $date2 = $field->value; $date1 = $session->get('date1'); // compare the first and last dates if($date1 >= $date2) $field->error("Last date must be greater than the first date"); //else $this->message("Those dates are fine matey!");// @note: for testing only // delete the temporary session date1 $session->remove('date1'); } } }
    1 point
  24. Try Hooking into the inputfield instead like so. Note, example is from module context. See also notes below: public function init() { $this->pages->addHookAfter("InputfieldDatetime::processInput", $this, "hookAfter"); } public function hookAfter(HookEvent $event) { $field = $event->object; if($field->name == 'recurringdateend'){// @note: just a quick example; you might want to hook into 'date_end' as well $page = $this->wire('modules')->ProcessPageEdit->getPage(); #$this->message($field->name);// @note: testing only #$this->message($page->id);// @note: testing only /* // @note: testing only + FOR INFO $oldDate = $page->get($field->name);// existing DB value $newDate = $field->value;// incoming/NEW data $this->message("old date is: $oldDate");// returns timestamp $this->message("new date is: $newDate");// returns timestamp */ // @note: quick example, not useful to you but a good to know 'how-to' // @note: what you really want I suppose is to compare incoming values (from input) // @see above for that ($oldDate and $newDate) $firstdate = $page->get("date_end");//date field 1 $lastdate = $page->get("recurringdateend");// date field 2 if($firstdate >= $lastdate){ //check if the date of field 1 is higher than the value of field 2 // error here; @note $lastdate is not a field! // error example: $field->error('Some Error'); } } } @Note that in my example we are comparing existing DB values (not very useful). In your case, you want to compare incoming values, right? See the $oldDate and $newDate example. However, you would need to Hook into both 'date_end' and 'recurringdateend' in that case (i.e. run your Hook code if either is the field name). Edit2: See complete answer in next post.
    1 point
  25. Hej! You should just use the translation function in the places which shall be translated. Then people can translate the module by themselves. For example: <?php // from your module $f->description = "The pages you import will be given this parent."; // to $f->description = _("The pages you import will be given this parent."); If you install ProcessWires translation stuff and go to the setup of your language and there to "translate files" area thing - you can select your module and translate those exact phrases which are put into _(" blurb ") Have also a look here: https://processwire.com/api/multi-language-support/ enjoy : )
    1 point
  26. What version of ProcessWire is that? That function is not in any of ProcessWire's files. In addition, FYI, ProcessWire's /wire/core/Database.php extends PHP's mysqli class. Edit: Beaten by lostkobrai. I should have noticed there is no such file in ProcessWire
    1 point
  27. That file mentioned in the error doesn't seem to belong to processwire.
    1 point
  28. Works now, thanks a lot @Mike Rockett for reacting so fast.
    1 point
  29. ...mystery solved . Edit: Your OP stated that you needed the Hook to run when a new page is added. Why not Hook into that instead? i.e. 'Pages::added'
    1 point
  30. Looking at your module code again, I notice this: // @kongondo note: here you are deleting the cache, meaning... $cache->delete("cacheName:" . $page->id); // @kongondo note:...that here we don't have that cache and one will be created afresh $cache->get("cacheName:" . $page->id, $cache::expireNever, function() use($page){ // code you want to cache $content = $page->title . "<br>"; $content .= $page->body; return $content; }); The code inside the Hook is executed because by that point, you have no cache; you have deleted it. So $cache->get() doesn't get the cache and one is created afresh. It seems to me that a Pages::saveReady is happening when you load your pages and that is triggering the cache to be deleted and recreated? But it doesn't make sense since when you reload, your page is reloaded from the cache. Are you sure about that? Have you checked the timestamps? Maybe confirm your workflow. Are pages being created via the API when you visit some page in the frontend?
    1 point
  31. Bumped to 1.5.48: Now using League\Csv for CSV importing. Note that delimeters are no longer automatically detected, and you need to specify your delimeter and enclosure characters separately. Blank lines are now also ignored. @owzim - This might fix your issue as the importer now delegates the start and end times to the same method used for the main jumplink editor. If that works for you, then this will as well. If it doesn't fix the problem, then I'll need to investigate further. On my side, however, all looks good.
    1 point
  32. Hi Doc, Glad you can use it. I get your point and I think you are right with this: Maybe you could redirect directly to the first child page or display the 404 page and redirect to the homepage within 2 or 3 seconds automatically.
    1 point
  33. Show us the code in your /site/ready,php as per Robin's suggestion...Maybe you have a typo there.
    1 point
  34. http://carolineleeming.com/ New website for still life photographer Caroline Leeming. Website build and design by myself - http://www.benbyford.com Using Jquery, alot of AJAX loading of content and the thumbnail grid with http://isotope.metafizzy.co/, slideshow hand coded by me.
    1 point
  35. Bumped to 1.5.47. Important update for anyone needing CSV. Though it doesn't look like anyone has used it since January last year ? Thanks again @owzim!
    1 point
  36. Thanks for spotting that @owzim; looks like an essential line in the importer mysteriously vanished (in this commit that's a year old; only spotted now). More than likely a mistake on my side, but I do remember phpfmt was playing up at some point. Anyways, adding the line back - will bump shortly.
    1 point
  37. @xavier - if you really don't know anything about programming then I have to agree with @Robin S - an AngularJS based site is not the place to start - there is so much more to consider. You need to figure out if your PW selector is getting the pages you want, and then make sure they are being returned as JSON and correctly parsed and outputted via Angular.
    1 point
  38. Check out Runtime Markup: http://modules.processwire.com/modules/fieldtype-runtime-markup/
    1 point
  39. OK....then go with what works .
    1 point
  40. not sure you get the use case for it. here i'm using it for two reason 1. to arrange the images (its uses masonry for this as they're made by the same people), 2. to animate filtering of the content - using the category links in this case. you can also do loads load more stuff with it - http://isotope.metafizzy.co/layout-modes.html
    1 point
  41. You should only have one set of files. That could have been the source of the problem. If you install (or upgrade) Blog via ProcessWire itself (i.e. as opposed to uploading the module yourself), the folder should be ProcessBlog (I think - not sure since being its developer, I don't install in that manner since I have the files locally). Whatever the case, you should only ever have one set of files, irrespective of whether they live in different folders. So, yes, delete one set and rename the Blog folder to what it should be (my guess is ProcessBlog; if not that, Blog, but definitely not MarkupBlog; I shouldn't think so). Hope this makes sense . Regarding _footer.php, is that a template file or a file you are including within some other template file? Btw, looking at the code in footer.php, I notice you are getting a number of pages by their IDs. Whilst that is the most foolproof way to do it, down the line, especially if there's several such calls in different template files, you will start to get confused what page 1040 was , especially if the code is not documented. In this regard, some people prefer to get by page: $pages->get('/path/to/page/'); Of course, if a page's path changed....you'll have a different problem to deal with. Just my 2p.
    1 point
  42. * updated : PhpMailer 5.2.22
    1 point
  43. It's weird, I was also about to start on something very similar, but also just recently noticed @rot's module, and now yours. @rot has been quiet here for a couple of months, so it would be good if he could confirm his intentions with updating his module. If you are close to being functional, it would be great to test both to figure out the differences in feature set.
    1 point
  44. +1 Since @rot does not seem to have enough time to work on his module (he can correct me anytime... ), I think it is quite reasonable for you to finish and maintain this module of yours. I would also be happy to use it, and share my findings about how it performs, etc.. meaning "testing it".
    1 point
  45. Thank you for all your responses. kongondo's response in particular was really helpful in focusing my attention. szabesz, I have been working on a front-end user registration system as well, have been following that thread: I am now trying to wrap my head around the basics of forms in PW; a generic form, just getting some data submitted to a database. Isn't Soma's thread/example mostly about rendering the form through the API, input fields etc., not so much about how the data gets processed? If it is possible to just use a plain html form in a template, I'd like to start there. The main thing I need to understand today is how to process the data from the form, how to get it into the database via PW. I'll follow up when I have tried some things... Ryan gave a very clear explanation of how to work with the database in Processwire: BTW, apologies for my dumb questions. I also use these threads to keep track of my own "research" and hopefully that will help others in the same situation.
    1 point
  46. Hey flydev, Looks great. How far have you developed this? The other module is at the very least beta software. I've got it running on several websites and it is running quite fast and smoothly. On the other hand I think there could be improvements. Perhaps you could join forces? Your modules both have the same goal. If you need help, I'm happy to help in any way.
    1 point
  47. I think this new approach is similar to template engines in one respect: the idea of extending a named block. This feature is present in template languages like Smarty and Twig and I for one find that feature very useful. I don't see any other similarities to template engines though. What would be your idea of misuse of this new strategy? If you mean it allows (encourages?) developers to not follow the MVC pattern then I don't see this as a big issue. There is no cardinal rule: "Thou shalt use MVC in all projects" - it depends very much on the type of developer you are and the type of project you are working on. When Ryan says... ...I take this to mean people who are new to PHP development in general. People who have a design background, or those used to a drag-and-drop interface, or who have previously worked only with static HTML. If someone has a lot of PHP experience I doubt they would find anything about PW difficult to understand - more like a breath of fresh air. And people who are new to PHP development are not going to be: building large, complex web projects working on long-lived projects that will be handed over to future developers collaborating on a project with other developers in a team For any of these I totally see the value of MVC. But if you are a newbie working on <10 page brochure websites you do not need MVC.
    1 point
  48. Google has killed off one of their pre-oAuth authentication methods, and the popular GAPI library is still relying on it. In case that anyone here happens to use said library for communicating with Google Analytics, please make sure that you're not running it in an environment where errors are publicly displayed. This is especially important if the GAPI authentication request isn't properly wrapped with try..catch, since the stack trace will contain Google credentials as-is, i.e. unencoded and publicly visible. Just a word of warning, since currently a simple Google search will result in a whole lot of sites with exactly this issue, and with plain-text credentials (partly or completely) visible.
    1 point
  49. Macrura and I have put together a more definitive version of the editable page field which I will post to the module directory as soon as I get a chance. I agree, however, that a "page table meets page field" field is a must down the line. I have a scenario with a client right now where this would be the only ideal solution. The scenario: Client adds a company page with details about the company. Each company can have several contacts associated with it, such as a primary contact and an administrative contact. The user should be able to see some information about each contact at a glance (like a PageTable), and needs to be able to select a contact that already exists (like a Page field) but needs to be able to create and populate new contacts and have them automatically selected (like a PageTable).
    1 point
  50. I'm having this problem as well, and I need iframes for other kinds of content (not just video), so the Video Embed module isn't a solution for me.
    1 point
×
×
  • Create New...