Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/15/2016 in all areas

  1. There are two possible options to fit / contain images into a predefined rectangle / square: With the bare core options, you need to pass your width / height and an additonal setting for cropping = false. (the distribution default is true!) $containedImage = $page->original_uploaded_image->size(500, 500, array("cropping" => false)); If you find this to abstract or clumpsy, you may use the beautyful Pia, which reduces this to $containedImage = $page->original_uploaded_image->contain("square=500"); Optionally / additionally interesting in this regard maybe the weighten option of Pia here. ------ But both options only help in rendering images that fit into your defined boundaries. They will work with appropriate markup and css styles applied to them, but they do not apply a canvas to the image files. If you really want to increase the images filesizes for that, by adding pixels and not use css styles, you can use the ImageManipulators canvas method. It does exactly that. When using the Imagemanipulator with a recent PW version, please pay attention to use $image->pim2load()->...! the API examples all show the method for PW version prior to 2.6 ------ Examples with Pia and IM: $square = $page->original_uploaded_image->contain("square=500, quality=100")->pim2load("squarecanvas")->canvas(500, 500, array(255,255,255))->pimSave(); // or $bgColor = array(255,255,255); $suffix = "squarecanvas"; $innerSize = 480; $outersize = 500; $square = $page->original_uploaded_image->contain("square=$innerSize, quality=100")->pim2load($suffix)->canvas($outersize, $outersize, $bgColor)->pimSave(); // or $bgColor = array(255,255,255); $suffix = "squarecanvas"; $oneSizeFitsAll = 500; $square = $page->original_uploaded_image->contain("square=$oneSizeFitsAll, weighten=1, quality=100")->pim2load($suffix)->canvas($oneSizeFitsAll, $oneSizeFitsAll, $bgColor)->pimSave();
    4 points
  2. Hi there, I'm not entirely sure what it is that you're looking for, but if your problems really start as soon as you step into the world of object-oriented programming, I would suggest grabbing a copy of Programming PHP (most likely available from your local library) and seeing where that takes you. If you want to really understand how ProcessWire internals work, it's important to understand how object-oriented programming works, and also how PHP works Other "general programming resources" you might find useful are the Codecademy PHP course, which is a pretty good introduction to many basic PHP features, and of course PHP: The Right Way, which is more a collection of best-practices, but contains a lot of valuable information nevertheless. Others can and will no doubt chime in and suggest tutorials, articles, etc. strictly related to ProcessWire, but in my opinion you should first make sure that you get the foundations right.
    4 points
  3. That's because ~= uses fulltext indexes for natural language search, which is limited by its ft_min_word_len setting that defaults to 4 characters (unicode code points). PW's selector operator docs explain that. You could lower that setting, but you have to be aware that MySQL doesn't support proper detection of word boundaries for Asian languages. Recent MySQL versions (>=5.7.6) have the option to let an ngram parser divide sequences of unicode characters into groups (ngrams) of a configured length, but that is also quite a fuzzy thing and may summarily not give the results you want. Usually, Oracle's recommendation is to use a third-party search engine that comes with a dictionary-based preprocessor, e.g. the Sphinx engine.
    4 points
  4. Hi @Junaid Farooqui, welcome to the PW an the Forums. I use a similar approach like you described. But I don't have to use templatefiles for all of my blocks. I only use a few main template files (mostly 2-5, and max around 10 for really large sites). For the blocks I use the Profield RepeaterMatrix, what is explained here: https://processwire.com/blog/posts/more-repeaters-repeater-matrix-and-new-field-rendering/#repeater-matrix-is-released-alpha https://processwire.com/api/modules/profields/repeater-matrix/ With repeater-matrix you are able to level down the block / field files to different extends. My prefered usage is one matrix field with different blocktypes but one rendering file under site/template/fields. But one also can use one separate rendering/view file per blocktype under site/templates/fields/... Also it is possible to mix those usecases how you like. Repeater-Matrix was alpha in January 2016, but is stable now. Do cost a bit money, but is more than worth the saved time. You are able to build nearly an exact usage scenario with the free available Pagetable Field and additional template files for each blocktype. But it is more work and feels not that smooth like Repeater Matrix. Just another possibility here.
    3 points
  5. Basicly this boils down to the fact that with processwire you dont make website the cms way but your way. And you are not going to find your way until after you have made a dozen websites with processwire. Everytime when I finished a website with processwire I saw a better way to organize things in the templates folder in combination with "everything is a page" in your admin folder tree. The delayed output way fits best with organizing things your own way in the templates folder. There are really many posts about this in the forum I cant recall of them now I recommend you look for them, but here is a good example to start with from Camilo Castro: https://medium.com/@clsource/the-wire-render-pattern-806bf6d6097a#.rk8g785m9
    3 points
  6. Try replacing "get" with "findOne". Get always returns unpublished/hidden pages. http://processwire.com/blog/posts/merry-christmas-heres-processwire-3.0.3-and-2.7.3-and-some-more/#new-pages-gt-findone-selector-api-method
    3 points
  7. Despite the documentation, it actually works for me just fine with the latest version of Firebug. Remember that with Firefox/Firebug it actually logs to the Logger tab rather than the Console tab like it does in Chrome. Does that work for you?
    3 points
  8. @adrian I've changed the lister row hover to show actions only on hovering the first cell. @Robin S I'm thinking on how to make things better configurable, but for this time I think I'll make the bold page names optional in PageListTweaks. Here is the preview of the iconified pagelist (and lister actions): On hover after a few milliseconds link text becomes visible to have some hint. Link colors will probably need a bit of JavaScript because using CSS inherit doesn't seem to pull the right color.
    3 points
  9. You probably have an existing image variation from before you set a custom quality setting. PW looks to see if there is an existing variation for an image before it creates one. This works well for variations of width and height, but unfortunately the quality, sharpening and upscaling settings are not recorded in the image name so you have to force a new image if you change one of these settings. Some time ago I made a wishlist post about this. You can clear the variations for an image via the admin, or you can temporarily add 'forceNew' => true to your settings array just to create the variation, then remove it. $option1 = array( 'quality' => 60, 'upscaling' => true, 'cropping' => true, 'forceNew' => true, );
    3 points
  10. ConnectPageFields Allows the connecting of two related Page fields so that changing one updates the other. Purpose of module An example: suppose your website is about movies. You have a template "movie" with Page field "actors". For each movie you add the actors that appear in the movie. All good, but what if you want to find results like... the 10 actors who have appeared in the most movies actors who haven't appeared in any movies since 1990 You cannot retrieve these pages with a single efficient $pages->find() query, and must load a large PageArray into memory in order to iterate or filter it. For the sake of making these types of queries more efficient you could structure your templates/fields so that movies are added to actors instead, but this may be a less comfortable workflow and can run into equivalent problems (e.g. "find the 10 movies with the largest cast"). The solution is to have a two-way relationship so that movie pages have an "actors" Page field and actor pages have a "movies" Page field. This module will keep these two Page fields in sync so that adding "Ryan Gosling" to "Drive" automatically adds "Drive" to "Ryan Gosling". Also, you can select the same Page field in both Page field A and Page field B. For example, create a "Related" Page field for related pages. Choose "Related" for both fields in a pair in the module config. Now when you add "Orange buffoon" to Related for "Donald Trump", "Donald Trump" is automatically added to Related for "Orange buffoon". Usage Install the ConnectPageFields module. If you haven't already done so, create the two Page fields you want to connect and add them to templates. In the module config select the two Page fields in a "Connected field pair" row as Page field A and Page field B. You can add rows as needed using the "Add another row" button. Troubleshooting Make sure you have set the "Selectable Pages" settings for each Page field correctly: The settings for Page field A should allow pages using the template(s) that Page field B has been added to. The settings for Page field B should allow pages using the template(s) that Page field A has been added to. http://modules.processwire.com/modules/connect-page-fields/ https://github.com/Toutouwai/ConnectPageFields Module config: Demo showing how changing one Page field updates the other:
    2 points
  11. Thank you so much. I do have FormBuilder installed, perhaps it would make this easier?
    2 points
  12. content of our cron.php: and the PwCron.module file: Everything is working fine from 20161107-10:15:06 until now, without errors, in a 5 minute intervall. EDIT: Did you refreshed the modules cache after changing the class-, file- and directorynames?
    2 points
  13. $sanitizer->purify() ? or "textarea" with the stripTags option along with "entities" - https://processwire.com/api/ref/sanitizer/textarea/
    2 points
  14. To complete @pwired answer, you can also read this blog post and this. You could also study the code of blog profile 2. It use another approach. I think that after these posts you should have a clear idea on how to structure your template folder.
    2 points
  15. I should probably have known this (learn something new on PW everyday...) Thanks Adrian - all working correctly now.
    2 points
  16. While that's true it's always a bit harder for the user as he has to decide which one to take.
    2 points
  17. Blender! 3D just around the corner! I kind of also like Wings3D even though clearly not as popular as Blender, it has a very interesting proposal as a 3D modelling tools.
    2 points
  18. Thanks for the bug report. If you grab the latest version from GitHub the issue should be fixed.
    2 points
  19. You can do that with css only. Here is an example http://codepen.io/nik-savchenko/pen/vdksm
    2 points
  20. @alexcapes, just pushed a fix to GitHub that allows ConnectPageFields to work with 'single' Page fields.
    2 points
  21. Hi @tpr, In agreement with what others have said, this is a hugely useful module and I really appreciate the work you are putting into it. The recent Esc key shortcut for closing notifications is one more excellent addition. Everyone's preferences are different so it's nice to be able to activate only the features you want. As well as the bold styling in the page list I mentioned earlier, there's another recent CSS change I can't see an option for turning off: the centered submit button on modal windows. Maybe there could be a checkbox list for individual CSS tweaks?
    2 points
  22. <input type="code" class="form-control" id="code"> Don't think code is valid type.
    2 points
  23. It does work! I tried to use Firelogger back when Tracy Debugger was first released and couldn't get it working. Really glad to be able to use that tool now.
    1 point
  24. Well, most important thing is the compiler/namespace feature: https://processwire.com/blog/posts/processwire-3.0.14-updates-file-compiler-fields-and-more/ or in more detail: https://www.google.hu/search?as_sitesearch=processwire.com%2Fblog&as_q=recipe#q=namespace+site:processwire.com%2Fblog Non core/Ryan modules might fail, so it is recommended to read up on them too. And most importantly I would certainly clone it to a dev environment and upgrade that instance of the site firts, just to see what actually happens....
    1 point
  25. Yep, with FormBuilder this should be much easier. Also there were some threads / posts I remember, that handled about formbuilder and email attachements. I would go into the dedicated formbuilder pro forum and check the posts there, or ask there for help, if you do not find examples. If you do not see the Pro Forum for FormBuilder, you should send a mail or PM to Ryan, so that he can add your account to the whitelist of that forum.
    1 point
  26. Ah I see. This is good to know. I got the upload field to 'work' after further debugging the issue.
    1 point
  27. BitPoet, thank you for your hint. Adding this to MarkupSimpleNavigation php file worked: 'selector' => 'template!=MediaLibrary', Is there a way to access the MediaLibrary through the "choose file" button through admin. This button appears when you include images field for the page. Thanks once again for your help and a great module.
    1 point
  28. Maybe I am missing something but it looks to me like it's just the AJAX uploader that's not actually working. I think the file has been selected and if you click your "Continue to Step 2" button it will be fine. I think what you are seeing is related to this: https://github.com/processwire/processwire-issues/issues/38
    1 point
  29. Yes I refreshed the modules cache, but even more, I reinstalled it from scratch (PW, PwCron) but still getting the same error. I will try on a live server into one hour and will come back. Thanks again.
    1 point
  30. Hi, Quick tips Bookmark these two Google queries: tutorial site:processwire.com/talk recipe site:processwire.com/blog Whenever you are in need, just edit the first words accordingly Learn by doing, eg: (4 part tutorial): http://blog.mauriziobonani.com/processwire-basic-website-workflow-part-1/ OOP is "easy", read this one once a month and also study simple ProcessWire modules: http://www.startutorial.com/homes/oo_beginner Find simple ProcessWire modules/profiles in the directory, install them, change them, abuse them. Sooner than you think you will get a hang of it.
    1 point
  31. I have tried it, but added namespace to the files and also renamed the PWCron class-, file-, and directory-names to camelcase PwCron. Don't remember of any other changes. We have a cron setup to call cron.php every 5 minutes via CLI. All is working as expected after the changes described above, incl. the $wire API var.
    1 point
  32. Oops, that's $sanitizer->text() in action. Will think about what to change it to.
    1 point
  33. @Pravin You need to remove the html code - first (<pre>) and last lines (</pre>) in your clean-file.php.
    1 point
  34. Hi @Junaid Farooqui - as far as I know there isn't one yet, but perhaps, @Faisal or @Kemal put one together, but didn't publish it to the modules directory, or perhaps you could all work on one together?
    1 point
  35. Thanks Adrian! I don't know if you've solved Thomas' problem, but you hinted on mine ;-) Stupid mistake…
    1 point
  36. This module comes in handy when you need related pagefields that are dependant on each other. Example: you have a sports team and team members belonging to that team. you need 2 fields: one on the team-page, one on the member-profile. this module keeps both fields in synch. Other examples would be hierarchical company structure or any other kind of membership relation. Demo: settings in this example: Gitlab: https://gitlab.com/baumrock/PagefieldPairs Modules Directory: asap only tested on PW3 and reno theme. Please test it faithfully before using it. please report any issues
    1 point
  37. as there is really no difference between those two modules it's definitely better to stay with robin's version. thank you @Robin S for your hint to ->add()
    1 point
  38. You only need to force a new variation if there is an existing variation that was created with different quality, sharpening or upscaling settings. Once you have got rid of these existing variations you don't need to keep creating new images as that's a waste of server resources. From that point forward PW will serve your variation with the custom quality setting. If you are sure you want all your images with quality 60 then you could set that in config.php. Or if it will vary use the options array when you get the image via the API, as you are doing. If you want to do a one-off clearing of variations site-wide there is a module for that, but note the warning about variations used in RTE fields.
    1 point
  39. Well, I guess I could have figured that out by myself. Thanks a lot BitPoet! The ProcessWire support here in the forum is really great.
    1 point
  40. Hi @MaryMatlow, that's actually a question I haven't yet thought about, since the pages I use it in assembles their navigation menus through more detailed selectors. I don't know if you could exclude it from your navigation by adding a "template!=MediaLibrary" somewhere. I'll give it some thought and post back here.
    1 point
  41. @Robin S I think I've found an issue with the module. It seems to stop image fields from working correctly. When I upload images now I get a thumb + spinner but the spinner never stops. This is what I see in the inspector: Uncaught SyntaxError: Unexpected token < in JSON at position 0(…) parseJSON @ JqueryCore.js?v=1479135253:2 (anonymous function) @ InputfieldImage.min.js?v=119-1479135253:1 When I uninstall the module, image fields work as expected again.
    1 point
  42. Check this discussion, can get you started :
    1 point
  43. A ProDevTools request: A module that puts PW into "record mode", where template/field additions and changes (via admin or API) are recorded in some way. The idea being that a live site could be cloned to a dev environment, changes made and recorded, and then the changes "played back" on the live site to apply them. I use an exported profile for this, which includes all the modules, templates, settings, etc, that I like to have as a starting point for new projects. Exported profiles don't include config.php tweaks, but if you use the ProcessWireConfig module (why isn't this great module in the directory?) then restoring your customised config settings only requires copying config.json to /site/assets/config/. The only thing missing then is user accounts.
    1 point
  44. hi ryan, first of all: great blog post! and great news! i want to start a discussion here (not at the blog post comments) as the forum is the main spot for that and has more features like quoting and so on... i want to support @Michael Murphy with his request of a solid import/export helper and setting up new projects. i've developed some parts on my own but they are far from production ready and tailored exactly to my needs and my environment. what could really speed up everyones development process would IMHO be: export/import function of complete site (not site profile!) include all data into the export (also users and wire folder) include an installer script to re-import the complete site (would be great for pulling live data easily to one's local dev environment) restore site from given dump ability to wipe all users except admin ability to set new admin password and db credentials ability to reset salt the second point would help setting up new projects quickly. i always find myself installing the same modules, setting all the settings... it would even be greater to define such installation profiles via json or the like so we could host them on github and share them. this would also be great for testing / trying out new modules: grab installer (installer.grab.pw) put in file to installer config file (eg github/xyz) set database settings install
    1 point
  45. Wonderful, thank you @Robin S - installed on 3.0.39 and all seems to be working perfectly. This kind of extra control over PageTable fields is something I find more need of the more I use this type of field.
    1 point
  46. @alexcapes, @szabesz, I've updated the module to allow the limiting of multiple PageTable fields and/or multiple templates for the same field. You can now also limit PageTable fields that only allow a single template. Because the module config options have changed I'm afraid you'll need to re-enter your config if you are upgrading from a previous version. I made a thread for the module over here which has a link to the GitHub repo.
    1 point
  47. Sorry I missed this post, but I am hoping by now you have realized that this is an issue with your wireMail setup and not this module. Just an oversight on my part - thanks for the heads up and the solution - much appreciated. It is fixed now!
    1 point
  48. The PW image API allows you to create different sized, cached versions of images for use in different situations. For instance an original image might be 1000 x 700 px, but we can can crop and resize using: $newsize = $page->myimage->size(300,300); And produce a square, cropped and resized image 300 x 300 px. But how can we make this work in a responsive environment so that we choose an image varient created using the API based on viewport size? There are several ways to do this, but in this case, a bit of script called Response.js can be rather useful. Reponse.js allows you to set up a set of parameters for exchanging data on the fly. (Please note that this is NOT an ajax based system, for that, please look up enquire.js) So, you can tell it to look for a certain sized view port by setting breakpoints and then use that to choose what data you want to call in. So, for instance, on their website they give this example: <img src="lo-fi.png" data-src481="medium.png" data-src1025="hi-fi.png" alt="example" /> The default image is the smallest (thinking mobile first) and then there are two further images called depending on the viewport size. The "data-src481" bit relates to the set up code made for this page or site. You can see that it would be fairly easy to add the PW image api to that bit of html. So, onto a real world example I am using in a client's blog. I had two imediate problems - firstly the site uses EMs and by default, response.js uses px. Secondly, I wanted nice memorable names for my various breakpoints. The developer of response.js is a helpful fellow and he wrote me a nice bit of script to do exactly what I want: !function(Response) { var names = ['basic', 'phoneportrait', 'phonelandscape','smalltablet','largetablet','laptop','desktop']; var values = { phoneportrait: '(min-width:20em)', phonelandscape: '(min-width:30.063em)', smalltablet: '(min-width:33.125em)', largetablet: '(min-width:48.000em)', laptop: '(min-width:64.063em)', desktop: '(min-width:80.063em)' }; Response.addTest('view', function(breakpoint) { var query = values.hasOwnProperty(breakpoint) && values[breakpoint]; return !query || Response.media(values[breakpoint]).matches; }).create({prefix: 'view-', prop: 'view', breakpoints: names, dynamic: true}); }(Response); This script is in my sitewide javascript file so that it is available for anything I am doing. All this script is doing is setting my em min-width values against names and then using those to create the calls. So, I would call a breakpoint with: data-view-phoneportrait Just for interest, this reproduces a set of breakpoints I have using sass-mq for my sass development set up. Now all I have to do is mix that up with my images, In the example below, which is for a list of articles in responsive blocks (using the easy to use pocketgrid system) I just swap the image depending on the view port: $smallimage = $article->image_single->size(256,256); $mediumimage = $article->image_single->size(300,300); $largeimage = $article->image_single->size(371,371); echo "<a href='{$article->url}'><img src='{$smallimage->url}' data-view-smalltablet='{$largeimage->url}' data-view-largetablet='{$mediumimage->url}' data-view-laptop='{$mediumimage->url}' data-view-desktop='{$largeimage->url}'></a>"; Response JS can also swap data within a div, though as I said earlier, this does not use ajax, so is best for small bits and pieces. I am finding that with the huge versatility of Processwire, this plays very nicely not just with more complete systems like Foundation, but perfectly with far more versatile system made up of small utilities rather than one big do-everything solution. My tool box now consists of responsejs, enquire, boubon mixins (but I don't use NEAT), various cross browser helpers like respond.js and html5shiv, a very good media query mixin call sass-mq and then my own bits and pieces. So, the lesson here is that the PW api does not just output data, but is part of your toolset for creating powerful and capable dynamic, responsive, mobile first websites.
    1 point
×
×
  • Create New...