Leaderboard
Popular Content
Showing content with the highest reputation on 08/18/2017 in all areas
-
This week's post is actually last week's post, just updated with a lot of new content. Since the topic is pretty much the same as last week, I thought it fit better this way. We've continued to make a ton of progress with the export/import features over the last week, and it's all covered in the updated blog post here: https://processwire.com/blog/posts/processwire-3.0.71-adds-new-core-module/7 points
-
Here's a mixin I put together for creating hamburger icons. It utilizes the checkbox hack so you can use CSS only to show a mobile menu (or off-canvas menu, etc). Unlike other mixins here you can specify a selector for the label tag if it's not directly below the checkbox, so the label (the icon) can be placed anywhere in the DOM. There is also a "hamburger_tint" helper mixin included to easily colorize the icon/text on hover or in a checked state. Parameters: width: the width of the icon. default: 32px thickness: the thickness of the bars. default: 3px gap: the vertical space between the bars. Overall height is: thickness*3 + gap*2. default: 7px color: the color of the icons. default: #000 (black) radius: border-radius value to round edges. default: 0 anim: seconds of animation duration (transition-duration) or timing function + duration (eg. "ease-out 0.3s"). Use -1 to disable morphing to an "X". default:0.25s labelselector: in case the label is not right after the checkbox, use this setting to tell the mixin where to find it. Eg. "~ div.content header nav label". default: "+ label" padding: extra spacing around the icon. default: 0 text: show text next to the icon, by default on the right. Values: "left" or false to disable. Requires an extra "span" tag. default: "right" CodePen demo GitHub4 points
-
4 points
-
I agree. I'd really like to be able to support ProcessWire and @ryan much more. We should have a git-backed documentation site. The Meteor Docs, as an example, are built in Hexo and managed on Github: https://docs.meteor.com We can then make sure it is up to date as a community instead of it resting on Ryan's shoulders.2 points
-
I encountered a situation over the past few months where tables have been crashing when a user saves a page in PW. I'm assuming it is something related to the server/hosting provider (Site5), because it only happens on this host, but across completely different unrelated accounts. When it happens the table in question gets "marked as crashed", and then shows "in use" when you see the table in PHPMyAdmin. No data is retrievable by PW from whichever table/field is crashed, so if the body table crashes, then the front end doesn't show any body text anymore until someone goes into PHPMyAdmin and repairs the table. I'm trying to make a module or at least some button the client can click from their admin that will run a repair on the tables so i don't have to help them and go to their cPanel etc.. I added a button on the dashboard of the sites in question (for sites that i use a dashboard on), or i told them to bookmark the link to the repair process, something like example.com/repair_database.php?action=repair; so far it seems to work but wanted to check to see if anyone sees any problems or improvements to this, it was done in only a few minutes, so may have left out something... I'm not sure if this could/should be made into a module, since it is conceivable that a table could crash that would render the modules system non functional, so thought maybe better to be a bootstrapped script(?) <?php // in root of pw installation - this is the 3.0+ version; repair_database.php /* Bootstrap PW ----------------------------------------- */ include("/home/path/to/index.php"); $config = \ProcessWire\wire('config'); $user = \ProcessWire\wire('user'); if(!$user->isLoggedin()) die("access denied"); function optimizeTables() { $tables = array(); $db = \ProcessWire\wire('db'); $result = $db->query("SHOW TABLES"); while ($row = $result->fetch_assoc()) { $tables[] = array_shift($row); } foreach ($tables as $table) { $result = $db->query("OPTIMIZE TABLE `$table`"); while ($row = $result->fetch_assoc()) { echo $row['Table'] . ': ' . $row['Msg_text'] . "<br /> \n"; } } } function repairTables() { $tables = array(); $db = \ProcessWire\wire('db'); $result = $db->query("SHOW TABLES"); while ($row = $result->fetch_assoc()) { $tables[] = array_shift($row); } foreach ($tables as $table) { $result = $db->query("REPAIR TABLE `$table`"); while ($row = $result->fetch_assoc()) { echo $row['Table'] . ': ' . $row['Msg_text'] . "<br /> \n"; } } } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Database Repair & Optimize Tool</title> </head> <body> <pre> ____ _ ____ __ __ / __ \___ ____ ____ _(_)____ / __ \____ _/ /_____ _/ /_ ____ _________ / /_/ / _ \/ __ \/ __ `/ / ___/ / / / / __ `/ __/ __ `/ __ \/ __ `/ ___/ _ \ / _, _/ __/ /_/ / /_/ / / / / /_/ / /_/ / /_/ /_/ / /_/ / /_/ (__ ) __/ /_/ |_|\___/ .___/\__,_/_/_/ /_____/\__,_/\__/\__,_/_.___/\__,_/____/\___/ /_/ </pre> <?php if($input->action == 'repair') { repairTables(); } if($input->action == 'optimize') { optimizeTables(); } ?> </body> </html> example button:1 point
-
Ah - Debugger I see. I never really know what to do with it. Such a huge array of options I don't fully understand. Ever consider making a video walkthrough? I solved my earlier issue. I thought I needed to make this more complex than it needed. In the end, it was just a case of // For each related_products in Matrix field set a variable called $matrix_item foreach($page->related_products as $matrix_item) { // If the Matrix field content is of type: 'related_product' if($matrix_item->type == 'related_product'){ // For every child page of the related_random page, output a single random one based on the product template... foreach ($matrix_item->related_random->children('template=product, sort=random, limit=1') as $prod){ // output this echo "...1 point
-
OK, so I guess this is definitely a facepalm Friday... I was playing around with hooks lately. And one of those hooks created emails to notify me whenever a certain page-type was edited/created. Today, I had to create several pages via API. Worked out all nicely and all... till I realized that I have also sent out some 20k email notifications. Within 1-2 hours. This of course notified the hosting company, and they disabled WireMail altogether. After a phone call with the hosting company, they put the chmod back to 0644. I disabled that hook and everything is smooth sailing again... Feel free to add your own personal favorite facepalm.gif here... mea culpa... and TGIF!1 point
-
Hi @ryan, I just wanted to say thank you for the fantastic updates you've included. I recently had to export/import some pages from prod to dev for testing using the new module, and it all seemed to work magically. Great job! I'm looking forward to using this more.1 point
-
I played around a bit with custom JS based Input. Here are the settings for 3 individual JS based input options: ColorPicker by Stefan Petr (http://www.eyecon.ro/colorpicker/) initial JS $('#{id}').ColorPicker({ color: '{value}', onChange: function (hsb, hex, rgb) { $('#{id}').attr('value', '#' + hex); } }); include JS colorpicker/js/colorpicker.js include CSS colorpicker/css/colorpicker.css JSColor by Jan Odvarko (http://jscolor.com/) initial JS var input = document.getElementById('{id}'); var picker = new jscolor(input); include JS jscolor-2.0.4/jscolor.js Color Picker (http://dematte.at) initial JS $('#{id}').colorPicker(); include JS dematte/jQueryColorPicker.min.js Pull js file from here: https://github.com/PitPik/colorPicker/blob/master/jQuery_implementation/jQueryColorPicker.min.js1 point
-
This is what I ended up doing... On each of my templates I added an include to languages.inc and in languages.inc I have the following... <?php $languages_array = array(); foreach ($languages as $language) { $url = $page->localUrl($language); $languages_array[] = array( 'url' => $url ); } $language_json = json_encode($languages_array, true); ?> <script> var languages = <?php echo $language_json; ?> </script> Then in my JS wrote a function that updates the values of the language switcher URL from the json outputted per page load. function languagesUpdate() { var language1Url = languages[0].url, language2Url = languages[1].url; $('aside.main ul.languages li').eq(0).find('a').attr('href', language1Url); $('aside.main ul.languages li').eq(1).find('a').attr('href', language2Url); } Then I called this function when the AJAX was successful and seems to work a treat. Maybe this'll help someone!1 point
-
1 point
-
I do believe this is to do with Let's Encrypt SSL certificates and I don't think this is anything to worry about. Malware with ProcessWire, pah1 point
-
1 point