Jump to content

Leaderboard

Popular Content

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

  1. Hope you all are having a great week. In this post we cover ProcessWire 3.0.43 (dev) which includes a lot of updates and a newly upgraded $page->url() method. Also a bit on the FileCompiler and revisiting last week’s ProcessWire Weekly recipe. http://processwire.com/blog/posts/processwire-3.0.43-core-updates/
    9 points
  2. I know this is old, but in case new users stumble across this, the Console Panel in TracyDebugger is what you are looking for http://processwire.com/blog/posts/introducing-tracy-debugger/#console-panel The other option for @muzzer's specific request of: $p = $pages->get("template=test"); $p->of(false); $p->set( 'fieldx', 'this is a default value' ); $p->save(); is to check out the "Field Set Or Search And Replace" action in the new AdminActions module which provides a GUI for setting the value of a field on many pages at once:
    5 points
  3. This is the $input->url() method. Without a "./" before it, PHP could feasibly load that file from anywhere in the php include path, and this is why we always say not to do that in your PW templates (unless you really need to have it load from a undefined location). I've not coded FileCompiler to try and track down files from the include path, because FileCompiler can only work with files in /site/. So it does require that a directory be part of the include, even if it's the current "./" directory. It may still work in some cases without it, but I wouldn't recommend it. Also, per the blog post, the /*NoCompile*/ has to be within parenthesis. Or to state it differently, it means you have to use include/require/etc. as a function call like include("./test_include.php" /*NoCompile*/); Thanks, yes it looks like I had an error there that could be triggered in certain cases. I've pushed a fix that is now on the dev branch.
    4 points
  4. Had some fun yesterday implementing an small easter egg in one of my websites: Let it snow on your website based on if it is actually snowing in your location. I use the Weather Underground API and jQuery Snowfall for this. Previously I used OpenWeatherMap for checking the weather, but they want to charge you for access over SSL. Here is what my easter egg looks like: $.ajax({ // Debug with North Pole // url : "//api.wunderground.com/api/YourAPIKey/conditions/q/AK/North_Pole.json", url : "//api.wunderground.com/api/YourAPIKey/conditions/q/Country/City.json", dataType : "jsonp", success : function(parsed_json) { var weather = parsed_json.current_observation.weather; var flakeCount = 0; if (weather === "Snow") { flakeCount = 100; } else if (weather === "Snow Showers") { flakeCount = 75 } $(document).snowfall({ round: true, minSize: 5, maxSize: 10, flakeCount: flakeCount }); } }); Too bad it isn't currently snowing where I live, but maybe soon. Regards, Andreas
    4 points
  5. Greetings to all of you gorgeous people here. I have stumbled across ProcessWire while looking for functionality info on MODx Revo and I felt in love with it. As far as I am not a programmer and have enough books to read and learn throughout my IT job, I was looking for something to be easy (for starting) and that can let me have fun and learn something extra. To make the learning memorable, I am always diving into the matter so following my habit in PW too, I decided to pick up a more complex HTML theme and make it dynamic using PW. Am I a programmer - well, I can read and eventually modify some code, but to write it from scratch - not anywhere close. Am I an HTML guru - not exactly, and that is why I decided to grab a theme I like and play with it. My only requirement was to have a well written and fully validated responsive theme. So I found THIS ONE and plan to work with it (already purchased to support the developer). I am planning to share my approaches and the progress so would appreciate any shared thoughts, advice, and even some criticism if you see me getting into a wrong direction. Having done most of the project under ModX it should not be that difficult for me to have all the bits and pieces in place. Where I am not sure yet how that would be done are the pull up of the latest posts/comments, the categories with listings, search, and some other stuff. What I found great in PW was the fact that it already has a fully working theme that I can dissect, read through a zooming glass and take some code from there. My first question is - which way should I go for the repetitive pieces of code (chunks) - should I create an include folder in site/templates and put all my pieces as XXXX.inc or I should just add those in the database as templates with no file assigned to them and set as not searchable etc. I would appreciate if you share your best experience and give some info why that is the better option so that I can understand the approach and turn it into a proper habit. Once I have this cleared out, I would start documenting the process so any corrections or better approaches can be suggested. Wish me luck on that journey and let's make it happen together. Shall we?
    3 points
  6. <attempted geek joke> If you are into the new syntax of PHP 7.1, how about something like this... public function declareBrexitReferendumResult() : void; /* UK version */ public function declarePresidentialElectionResult() : void; /* US version */ ...take your pick. </attempted geek joke>
    3 points
  7. It's now available in the modules directory: http://modules.processwire.com/modules/process-admin-actions/ It also includes a few new actions. The first post and the Github ReadMe give a small description of each action. Hope you all find something useful among them. Again, please feel free to contribute some actions, or if you have an idea but don't know how to build, let me know and maybe I can put it together.
    3 points
  8. Just count yourself lucky and stop your research now. Trust me, you're not missing much. But seriously, this is what I'm talking about. There's got to be a reason why Germany is the only country whose interest in PW reaches the threshold to register on Google Trends - any ideas?
    2 points
  9. Looking at this It seems like I should be with you guys. But damn, who is David Hasselhoff? I read Wikipedia but still do not get it. Or should I believe the stats and ask @teppo? And PW is definitely at home at Germany.
    2 points
  10. https://processwire.com/api/selectors/ http://processwire.com/api/fieldtypes/comments/ For categories see here
    2 points
  11. Hola amigos I wrote a little DOMDocument magic (long time ago) which would automatically link images add classes for Magnific Popup set alt tag wrap the whole thing in a figure insert figcaption if image description available and wrap multiple figures in a container think that's it.. So for our articles we only needed to open pwimage popup in cke, choose desired image, set the size and alignment To caption images we use description input from image field It was a nice starting point, and at some point I changed DOMDocument to SmartDOMDocument wrapped the code into TextformatterBlogImages.module.. But I had ideas to simplify the whole process..and due to a problem with the old implementation which broke design (just realised it a week ago, or that it's linked to my Textformatter) I finally took the time and rewrote the whole thing. Problem was that figure is not a valid child of <p> so at least in chrome I ended up with orphaned text and an empty paragraph so the text style differed from the rest.. I'm posting this as a boilerplate/resource/idea, it's really basic..everything is hardcoded and it's not flexible right now.. So there is the Textformatter module and a hook which is placed in my /site/ready.php right now but might be moved somewhere else.. Maybe it can become a proper module..Maybe I find time to do so..but if someone is interested everyone is welcome to grab the code and extend/modify for their own needs Here's a little animated gif screencast (it's shrinked so the quality is not very beautiful..) So what it does right now: TextformatterBlogImages.module: first it replaces double line breaks like <br><br> or <br /><br /> or any other combination with </p><p> (I had such occurences) parses the article for <p> tags using simple_html_dom finds all containing images it extracts the image name stripping image variations gets the corresponding pageimage from images field the image itself will be replaced by markup used with LazySizes JS plugin (https://github.com/aFarkas/lazysizes) Example: <img src="fullImageUrl" srcset="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-srcset="smallUrl smallWidth, medium mediumWidth, full fullWidth" data-sizes="auto" width="fullImageWidth"> data-sizes="auto" works for now but I might replace it by normal sizes markup, manually deciding how images should be chosen width="fullWidth" I read that images with width attribute render faster but I'm not sure if this is true even if the image is downsized by css? then the new image will be linked to full size image link with markup for js modal (wrote my own, but not ready yet) if image class contains "align_left" or "align_right" it will wrap it in span moving classes from img to span if pageimage got a description it'll insert the descr below the img within span in another span the old image will just be replaced by the new span image so it will be in the same place it image is not aligned (or align_center) it wraps the image in figure moving img classes to figure and description will be wrapped in figcaption and the figure will be stuffed in an own container before the paragraph (original image within p will be removed) The figure gets a class landscape or portrait according to the aspect ratio Uh, I added another hook property called Pageimage::cdn so the images will be served directly from assets subdomain (using domain sharding option from AIOM but saving the extra redirect) Then there is another "round" reparsing the article for newly created figure containers adding additional class containing the number of children and another class indicating how many of the images are landscape/portrait for later styling like 2lx1p for 2 landscape and 1 portrait We add rows of 1 to 4 images, not more so my stylesheet contains rules for all possible cases like 1 landscape 2 portraits, 3 landscapes 1 portrait and so on to resize the images so alls images in a row will have the same height and the row will be always as wide as the main container as seen in the gif above Because the textformatter is doing everything for us I added a little clickable area to each image in the image field and a little javascript which inserts an image into body cke field on click at caret position Only thing to do is manually break the line after 4 images (or less) (NOTE: This javascript code inserting the clickable area requires at least PW 3.0.17 with new image field, as mentioned by Robin S below) For inline images I have to modify, I guess, the javascript a little, or maybe I can add another script which adds 3 links to inserted images, which add alignment classes to the image Here you'll find the files (and code snippes) https://gist.github.com/CanRau/662a559a07d6d7c492159d1cd497944f Any questions, ideas, improvements, concerns and other comments are highly appreciated PS: I'm not using it in production yet, just finished the version, I think I need to review all articles first to ensure proper migration, and maybe I add the inline handling to the javascript as mentioned before PPS: If you're interested in using this you should at least cache the textformatter output using WireCache, or TemplateCache or you can of course use ProCache, but I wouldn't recommend using it without any caching mechanism as it would re-do all the work every time someone requests the page.. Un Saludo Can
    1 point
  12. Hm, why would chunks in the database be more secure? Usually I am trying to use the $page->render() method as often as possible. You will have reusable components in the tempaltes/fields/ folder then - image galleries, navigations, etc ... also I am using the delayed output method: https://processwire.com/docs/tutorials/how-to-structure-your-template-files/page4 Right now I am beginning to build my own "renderComponent()" function similar to $page->render which handles this, and also automatically includes css and js files which are placed like /templates/components/navigation/navigation.php /templates/components/navigation/navigation.css /templates/components/navigation/navigation.js ... and later it shall also handle require.js automatically. ... And I am dreaming about a "require.css" thingy. ... and then put it into a module ... or so. But it is pretty much up to you, processwire is very open in that respect - you should just start and see where it will lead you. You will better understand the pros and cons when you relly have tried and felt them Also, I think you will get into PHP very quickly by using processwire - just like in my case ...
    1 point
  13. My best guess is that Germans support both David Hasselhoff and Ryan Cramer because both have German last names (and maybe origins - Hasselhoff does for sure). If Ryan's last name was Ivanov he could be much more popular in Russia. But your question @Robin S is pretty interesting marketing wise. Could this be part of the answer?
    1 point
  14. Hello, I created a simple telegram bot. What it does? it enables you to save your voice messages and send them later using emojis or keywords in your group chats. Just add @voxgrambot in your group chats and search all the public voice messages available using text or emojis. If you want to create a new voice message just send a private message to the bot with the command /new . If you want more info send the command /help. The bot was made using Python and https://python-telegram-bot.org The backend was made using ProcessWire 3.x and my Rest API helper. http://telegra.ph/Voxgram-Telegram-Bot-12-03
    1 point
  15. Check out the "Page Active Languages Batcher" action in the Admin Actions module:
    1 point
  16. 1 point
  17. Hey Guys, just wanted to wish happy holidays to all of you from Erika and me! ...and also share a small animation we did to celebrate the occasion: http://ed-works.com/christmas2015/ (this is pure CSS, there's no JS involved)
    1 point
  18. Hi @Rajiv I'm glad you like it I'm refactoring the code to have it more customizable and pluggable, so installation should be easier, too. Don't know when I can post the new version, though. Hopefully within the next days, as I need it anyway for a new project, too ;-)
    1 point
  19. Hi Can, i'm new to processwire... but i think what you've done is really interesting... will make things a lot easier for me... maybe i dont get it... but i need some installation instructions/steps to apply this.... running the latest processwire 3.0.39.
    1 point
  20. Great, thanks There's a funky calculation going on when setting the columns so I decided not to risk things with multiple aos_column_break fields
    1 point
  21. There's a way without additional colbreak fields, see the readme. I didn't want to flood the admin with extra fields.
    1 point
  22. If anyone with php <5.4, be aware that the short [] array index won't work for you. You'll need array().
    1 point
  23. Another option is to use the "Allow HTML" setting in this module: http://modules.processwire.com/modules/dynamic-description-notes/
    1 point
  24. just for the record, it is possible to add html to description via hook without messing around with str_replace or the like: $this->addHookBefore('InputfieldPage::render', function($event) { $field = $event->object; if(!in_array($field->name, array( 'fieldname1', 'fieldname2' ))) return; $field->entityEncodeText = false; $field->description .= ' <a href="#">test</a>'; }
    1 point
  25. Hi, Short answer: It is recommended. Some TL;DR for you : https://processwire.com/blog/posts/processwire-3.0.21-and-2.8.21/#news-for-processwire-2.x https://www.google.hu/search?as_sitesearch=processwire.com%2Ftalk&as_q=migrate#q=namespace+site:processwire.com%2Fblog
    1 point
  26. No problem. I want to install this on several sites we are running. Looks like it has to be done this weekend. Will get back to you.
    1 point
  27. access controlled VIP-Support, I believe. EDIT: this one was my 2.7k post
    1 point
  28. A search on forum members, located in Berlin, turned up the following list: @blickwerker @Bron @ceberlin @chrizz @Dave Damage @dlen @FrancisChung @marcus @Mitko @neophron @Nico Knoll @ottogal @owzim @Philipp Nowinski @RSA @sisterlarao @skries @symb Some of them haven't been active recently, but perhaps a mention will get their attention.
    1 point
  29. I made a few changes in my fork of the module. I added support for DateTimePicker, Recurring Events and DataTables. Here is it: https://github.com/blackberrymamba/FieldtypeEvents
    1 point
  30. one of the first pieces of wisdom i got from Soma was about making a template from where you can execute api stuff; this is needed on every site, because you'll always need some "api playground" where you can test things and run things to change, add, fix content.. my setup is to have a template called tools, and then a subfolder in the templates where i store all of the scripts that i will run on that tools template, then i just include the one i'm currently using into it and go from there. Sometimes when developing a new part of a live site, i can just clone a template, run it under tools and set the virtual page to anything in the site (example, $page = $pages->get(1012); ) but mostly i'm doing complex imports from other systems like joomla, or from spreadsheets with a lot of custom stuff and dependant/related pages, formatting etc..
    1 point
  31. I usually executed such scripts over the command line (bootstraping ProcessWire). Maybe you could use Hanna Code if you'd like to write the code in the admin?
    1 point
  32. You can add anything you want in /site/templates/admin.php, which is the file that is first called when accessing the admin. Incidentally, this is actually also a place where you can add hooks that pertain only to the admin (though it is generally cleaner to do so in a module).
    1 point
×
×
  • Create New...