Leaderboard
Popular Content
Showing content with the highest reputation on 01/26/2016 in all areas
-
Update: Version 6 (on dev branch only for now) Changes Thanks to @BitPoet, on a paginated coordinates' table, clicking on a marker will, where necessary, bring its page into view --------------------------------- @BitPoet, thanks! Following your ideas, I did it like this: Server-side, add a data-row='n' to each marker specifying its row in the coordinates' table (same number you see on the markers ) In the pagination function (js) for each page, get the number of the first row and add that to a data-first-row='n' attribute for each respective span Created a function that, on clicking a marker, it finds the first span (#2 above) whose data-fist-row is greater than the marker's data-row. If found, our marker's page is the immediate previous page, so we click on that if it's not already in view (!class='active'). If span 'is out of bounds', it means we are on the last page so we click on that instead. If selector returned nothing, it means there's no pagination in place, so we do nothing. Demo5 points
-
As sharpening is the last manipulation step, we can try to optimize the imagesizer in that regard that we try to free memory for one image instance before we pass the $thumb-instance to the sharpening method. If you like, you can first backup the imagesizer.php and then rearrange this part // optionally apply sharpening to the final thumb if($this->sharpening && $this->sharpening != 'none') { // @horst if(IMAGETYPE_PNG != $this->imageType || ! $this->hasAlphaChannel()) { // is needed for the USM sharpening function to calculate the best sharpening params $this->usmValue = $this->calculateUSMfactor($targetWidth, $targetHeight); $thumb = $this->imSharpen($thumb, $this->sharpening); } } // write to file $result = false; switch($this->imageType) { case IMAGETYPE_GIF: // correct gamma from linearized 1.0 back to 2.0 $this->gammaCorrection($thumb, false); $result = imagegif($thumb, $dest); break; case IMAGETYPE_PNG: if(!$this->hasAlphaChannel()) $this->gammaCorrection($thumb, false); // always use highest compression level for PNG (9) per @horst $result = imagepng($thumb, $dest, 9); break; case IMAGETYPE_JPEG: // correct gamma from linearized 1.0 back to 2.0 $this->gammaCorrection($thumb, false); $result = imagejpeg($thumb, $dest, $this->quality); break; } if(isset($image) && is_resource($image)) @imagedestroy($image); // @horst if(isset($thumb) && is_resource($thumb)) @imagedestroy($thumb); if(isset($thumb2) && is_resource($thumb2)) @imagedestroy($thumb2); if(isset($image)) $image = null; if(isset($thumb)) $thumb = null; if(isset($thumb2)) $thumb2 = null; to become this one: if(isset($image) && is_resource($image)) @imagedestroy($image); if(isset($thumb2) && is_resource($thumb2)) @imagedestroy($thumb2); if(isset($image)) $image = null; if(isset($thumb2)) $thumb2 = null; // optionally apply sharpening to the final thumb if($this->sharpening && $this->sharpening != 'none') { // @horst if(IMAGETYPE_PNG != $this->imageType || ! $this->hasAlphaChannel()) { // is needed for the USM sharpening function to calculate the best sharpening params $this->usmValue = $this->calculateUSMfactor($targetWidth, $targetHeight); $thumb = $this->imSharpen($thumb, $this->sharpening); } } // write to file $result = false; switch($this->imageType) { case IMAGETYPE_GIF: // correct gamma from linearized 1.0 back to 2.0 $this->gammaCorrection($thumb, false); $result = imagegif($thumb, $dest); break; case IMAGETYPE_PNG: if(!$this->hasAlphaChannel()) $this->gammaCorrection($thumb, false); // always use highest compression level for PNG (9) per @horst $result = imagepng($thumb, $dest, 9); break; case IMAGETYPE_JPEG: // correct gamma from linearized 1.0 back to 2.0 $this->gammaCorrection($thumb, false); $result = imagejpeg($thumb, $dest, $this->quality); break; } if(isset($thumb) && is_resource($thumb)) @imagedestroy($thumb); if(isset($thumb)) $thumb = null; We only have to move 4 lines that try to release gd image handles above the call to the sharpening method.4 points
-
jonithlnljani how ? wolud makes.infinite ploop no ? or how u.say in englich. circle jerkey or.recurses no ending.samasaras likes when trimmer beard in.bathroon w 2 mirror & u see millonions of willys4 points
-
some recently launched pw-powered sites... Roger Shapiro Fund for New Music Custom blog & news, projects listing and works w/ dataTables... using Soma's social share for the sharing buttons http://www.rogershapirofund.org/ Daniel Lippel, Guitarist http://danlippel.com/ Flowers by Selina Website for floral designer in Westchester, NY. Features custom blog, homepage featured portfolio and full masonry portfolio. http://www.flowersbyselina.com/ Eric Huebner, Pianist media handled by Soundmanager2. A frontpage ajax-powered widget was implemented to let visitors browse the concert & event calendar, with a browsable month view. http://www.erichuebner.com/ Anderson Chase Gallery Simple one-pager http://andersonchasegallery.com/3 points
-
It may not cover all needs, but I usually use an InputfiedMarkup: $f = wire('modules')->get("InputfieldMarkup"); $f->value = "Any HTML you want here";3 points
-
@gebeer: Did you try to use $form->setClasses($array) and $form->setMarkup($array). Using this you are also able to set different classes/markup depending on Inputfield.3 points
-
I will upload it to Github this week for people to try. I'm just cleaning up the coding errors I decided to implement while drunk over Xmas Also I'm not totally familiar with Github, but I should be able to get something useful up before the weekend.3 points
-
$pages->delete($page, true) That will also permanently delete any child pages, media items etc.2 points
-
@teppo - thanks (as always) for checking these out! On a mac, FF,Chrome, the scrolling seems to be ok..i tried it on a kensington roller mouse and an apple touchpad.. OK - thanks for pointing that out , just fixed it (and a few other things as well while i was in there... site was launched back in October, but i don't think it has seen much traffic)... @bernhard - thanks for checking these out - hoping to post some mini case studies about some things that were developed for these, mostly to do with the blog.. @martijn - thanks - couldn't have done these without your modules!, especially AdminCustomFiles! i think almost all of these use the image tagging setup from this past summer2 points
-
You are welcome. Formbuilder is a great tool and makes the task of building frontend forms quite convenient. It covers most of the use cases for forms on websites. Building Forms is always a somewhat complex topic in every CMS/framework and I think Ryan has done a great job, both with Formbuilder and with the form API, to make this task easier for developers. If you need total control over the HTML of your form, coding it from scratch and then processing it manually seems to be the way to go.2 points
-
Hi @Spica, please have a look into ImageSizer. PW already calculates dimensions and compare the needed amount of ram with available ram _before_ opening an image or _before_ creating another instance of an already loaded image: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/ImageSizer.php#L412 https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/ImageSizer.php#L1913 Only thing what comes to my mind is to increase memory, use smaller images or upload only one after the other and not a lot in parallel. Have you tried to upload multiple images as zip-archive? ------------------------------------------------------------------------------------- You can test and call the method from the outsite of imagesizer too, if you like: $info = getimagesize($image->filename); $sourceDimensions = array($info[0], $info[1], $info['channels']); $result = ImageSizer::checkMemoryForImage($sourceDimensions); var_dump($result); EDIT: the only thing what maybe happen in your system is that PHP isn't able to read a setting for max_mem, please have a look here to this line: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/ImageSizer.php#L1934 If you use the above code for a test, and var_dump($result); will show null, PHP isn't able to read a seting for max_mem or there isn't one set. In this case, please also refer to output from phpinfo().2 points
-
I just published a pre-release of my new password reset module. It will enable identification from any field of your choice, and is fully translatable. Integration is just 2 lines of code, the first is calling the controller, the second is loading a script (no dependencies). You can download the code on GitHub at https://github.com/plauclair/PasswordReset. Also, have a look at the reset process in this video https://vid.me/eEVY. This exemple is not styled, but there should be all you need in there to style it. Comments and feature requests very welcome!1 point
-
Modalception for ProcessWire GitHub: https://github.com/thetuningspoon/AdminModalception Direct Download: https://github.com/thetuningspoon/AdminModalception/archive/master.zip Modalception improves the usability of ProcessWire's modal dialog/popup windows when opened from within another modal window. The parent window is expanded to take up the full screen behind it so that additional modals can be opened without the inner windows becoming progressively smaller and less usable. The outer windows' toolbars are hidden from the user to help reduce confusion. * Screencap also features the Page Field Edit Links module1 point
-
A collection of links and information for front-end development. Front-end forms Create simple forms using the API https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ Gist code for the above link https://gist.github.com/somatonic/4027908 Build and process generic forms from page templates https://gist.github.com/somatonic/5011926 Build and process forms manually with the API https://gist.github.com/somatonic/4027908 Upload images https://gist.github.com/somatonic/4150974 Form with fields rendered in a table https://gist.github.com/somatonic/5415646 Manual form markup with file upload handling https://gist.github.com/somatonic/5233338 Form Builder (module) Building front-end forms on your website has never been so simple. ProcessWire Form Builder lets you create, edit and publish forms with no development necessary. http://modules.processwire.com/modules/form-builder/ Front-end member management FrontendUser: login, logout and register users / members (module) https://processwire.com/talk/topic/9811-frontenduser-login-logout-and-register-users-members/ Member login, logout, password reset https://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?p=15919 Popular front-end UI frameworks UIkit http://getuikit.com/ Semantic UI http://semantic-ui.com/ Foundation http://foundation.zurb.com/ Bootstrap https://getbootstrap.com/ Materialize http://materializecss.com/ Skeleton http://getskeleton.com/1 point
-
No solution currently (other than switch from Repeater to PageTable). But issues logged at GitHub: #1567, #16161 point
-
Hang on there sir..... you actually mean to say I got something right on here? There's hope for me yet in the coding world.1 point
-
Or if you want via the admin rather than the API per GuruMeditation's suggestion, you could try Nico's module: http://modules.processwire.com/modules/process-page-delete/ In some ways it is obsolete now that the core has a built in trash action button, but it does offer delete/trash options. Keep in mind though that this will only work with the action buttons in the page list view - the "Delete" link in edit mode will still be trash. Otherwise if you really feel the need, you could hook into Pages:trash (https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/Pages.php#L1517) and change the behavior to delete instead. BUT, is trashing really so bad?1 point
-
1 point
-
Ok, after a quick crash course with Github, I managed to upload the module for testing. I've included my test templates which should give an idea of how to use the module. I use UIkit for testing, so that's the markup you'll find in the templates. Obviously this is early code and has only been tested by me, so don't use it for anything other than testing. The module does NOT sanitize, so you need to ensure you have sanitized your message before you use the topicSave() or commentSave() methods. Documentation is nonexistent, but the module is fairly straight forward and I can help where needed. So, thoughts, issues, insults? Does it have potential? and if anyone wants to add to it etc, please let me know. Link removed - HermodBB is now discontinued and is now being developed as LiteBB. I will update the thread with further information.1 point
-
@LostKobrakai yes, this is right. Here Soma gives a good example of how to use your own form markup and do the processing with PW API.1 point
-
I am using REST API to exchange information between independent PW installs. There is Ryan's Pages Web Service Module you could use on the client sites and then query it from the main site. Or clsource's REST Helper classes for setting up a REST API. I wrote a tutorial on setting up the latter. If you decide to go the REST route, there is the HTTPful REST client for PHP which makes life a lot easier when doing requests with PHP (from your main site to the client sites).1 point
-
The processwire forms api just breaks down as soon as you need flexible non-form markup between different form fields, which is why I'm not using it.1 point
-
Looks great, thanks! Those preview images always remembers me of pox1 point
-
The Imagesizer detects the settings of the Exif orientation tag and autocorrects this where needed, if it is enabled. The setting to enable / disable this for all variations can be set in $config->imageSizerOptions "autoRotation". The default is true: $config->imageSizerOptions = array( 'upscaling' => true, // upscale if necessary to reach target size? 'cropping' => true, // crop if necessary to reach target size? 'autoRotation' => true, // automatically correct orientation? 'sharpening' => 'soft', // sharpening: none | soft | medium | strong 'quality' => 90, // quality: 1-100 where higher is better but bigger 'hidpiQuality' => 60, // Same as above quality setting, but specific to hidpi images 'defaultGamma' => 2.0, // defaultGamma: 0.5 to 4.0 or -1 to disable gamma correction (default=2.0) ); There is an extra setting for this for AdminThumbs, default is true, too: $config->adminThumbOptions = array( 'width' => 0, // max width of admin thumbnail or 0 for proportional to height 'height' => 100, // max height of admin thumbnail or 0 for proportional to width 'scale' => 1, // admin thumb scale (1=auto detect, 0.5=always hidpi, 1.0=force non-hidpi) 'upscaling' => false, 'cropping' => true, 'autoRotation' => true, // automatically correct orientation? 'sharpening' => 'soft', // sharpening: none | soft | medium | strong 'quality' => 90, 'suffix' => '', ); Please ensure that you have autoRotation set to true for both use cases.1 point
-
I use source tree for all things GitHub...https://www.sourcetreeapp.com/1 point
-
Hi there! Check configuration for "title" field. If you have unchecked "Global" option, the field will not be shown in the first step of page creation.1 point
-
Interesting. The very trendy Google font "Merriweather" I use seems to be incomplete at Google (outdated?), it is missing the "fi" ligature and instead only shows an "i". Safari is now using ligatures. With this code I could tell Safari to stop using ligatures: -webkit-font-variant-ligatures: no-common-ligatures;1 point
-
Regarding (ii) and after a cursory glance at the JS: Store the page numbers in an attribute in the pager's spans in paginateTable In the marker's click event, calculate the row position through row.prevAll('tr').length Calculate the matching page number from the position and limit Find the matching pager item through the attribute in the first step and fire a click event on it1 point
-
Hmmm... I'm looking for a module that can clean my house and can make me coffee...1 point
-
So, 48 hours or so after a question that initially got the standard "PW != WP" answer, there's been a reasoned discussion, people have come round to seeing some merit in the initial premise, and BitPoet has a couple of alpha modules on GitHub. That is an extraordinary testament to the quality of PW and this community.1 point
-
Okay, so I've done it. Two sets of modules, one for the server side, the other for the client side. There are still a lot of ToDos, like adding dedicated endpoints on server and client (I'm currently hooking indiscriminately into ProcessPageView::execute, but I'd like to go the route of only loading the listeners for this template) or adding some kind of challenge-response mechanism to keep nosy third parties out. The modules are up on github: Server component Client component There's also a screen cap in the readmes. Both module sets have lots of hooks, so component modules should be easily able to extend the basic functionality. Currently, the online functions arealdy built-in are the setup of the management connection on both sides and getting basic client information. I haven't really looked at the upgrade or db backup modules, so I've got no idea how complicated remoting them would be. But the sky's the limit. Comments, critiques and pull requests welcome!1 point
-
Yes, all these points would mean creating a monster. In terms of database backups or malware scans, those are highly platform specific and not something easily implemented in a module. A centralized overview actually makes sense to me. Showing.PW and module versions and outputting some statistical information is also quite doable. Displaying a momentary status can be done, but continuous monitoring is not something that you can build on top of PW - for this, you'd need to add some layers under or next to it. I've started tweaking together a set of modules that could serve as a base. I'll try to add the necessary hooks to allow extending it tomorrow and put an alpha release on github. If nothing else, it's an interesting conceptual challenge1 point
-
You have a $searchdate of format January-2016 and the date that is saved in your page in field date is 12-January-2016? PHP doesn't know by default that 12-January-2016 is a day within the month January of year 2016. So you need to do some date calculations with PHP. Try this to find out if "12-January-2016" lies within January 2016 // example code // convert the saved date of the page to a timestamp // $date = strtotime($page->date); // I assume the date is saved on the page in field date $date = strtotime("12-January-2016"); // convert the $searchdate to a timestamp $searchdate = strtotime("January-2016") + 1000; // get first and last timestamp of the given month and year $getdate = getdate($searchdate); // get the month number (e.g. 1 for January) $month = $getdate["mon"]; // get the year (e.g. 2016 $year = $getdate["year"]; // get first timestamp of that month in that year $first = mktime(0,0,0,$month,1,$year); // echo date('r', $first); // get last timestamp of that month in that year $last = mktime(23,59,00,$month+1,0,$year); // echo date('r', $last); // now check if $date is in the range between $first and $last function check_in_range($first, $last, $date) { // returns true if $date is in month January of year 2016 - else returns false return (($date >= $first) && ($date <= $last)); } var_dump(check_in_range($first, $last, $date)); // either true or false Now you can use check_in_range($first, $last, $date) in your if - elaseif statements. Try the code live here. PS: I don't know what it is, I just like to fiddle around with date calculations...1 point
-
Dates are not saved as text, therefore you cannot use any text based selectors. You'd need to compare them based on date values (timestamps).1 point
-
Field templates are like natural, built-in "partials". I'm super-excited about the repeater matrix but the field templates are a superb, micro-optimization that will bind very specific output with a field type. I think this will make for a much more efficient way of building pages and especially so when those pages include repeater matrix fields. Very awesome and genuinely exciting.1 point
-
Usually it works if you just set the "$entryPage->titel" to the value, but think it only works with the ID. Depends if you use the "ID" or the additional "value" options (id=value|title) If using value: foreach ($options as $option) { $field->addOption($option->value, $option->title); } foreach ($entryPage->titel as $value) { $valArray[] = $value->value; // array of values selected, not key=>title } $field->attr("value", $valArray); Using ID foreach ($options as $option) { $field->addOption($option->id, $option->title); } $field->attr("value", $entryPage->titel); // just passing the field (only when outputformatting off) If that doesn't work just make an array using id. foreach ($entryPage->titel as $value) { $valArray[] = $value->id; }1 point
-
I read a bit more into MUUT and they just keep their database totally separate, so the users only exist in the CMS you choose. So basically, if you ever switch CMS, you would need to convert your user accounts to a new CMS and change the MUUT user array data to the new CMS' variable. Not a big deal actually. What I meant by the $user conflict is you can't have two things called $user. $user is reserved in ProcessWire, so not sure what the options are there. There also doesn't seem to be anything in the index.php you posted above that actually does anything to do with MUUT, however now I say that I see the JS at the end that points to the URL of the MUUT forum, so maybe it's passing some variables via JS? The reason I asked about index.php is because in ProcessWire you don't do any templating in the root index.php file. You edit the templates in /site/templates/ instead. I think, whichever CMS you ultimately settle on to work with MUUT, you need to understand the CMS you're using and how it works first, so read some tutorials, look into the docs and watch the overview video (quite out of date now, but gives you an idea of how things work). I'm also concerned when you say you have time constraints - what you're attempting to do isn't simple if you're not au fait with both systems, though top marks for diving in at the deep end and giving it a go1 point
-
@mindplay.dk I'd be interested in this project, could you add me on bitbucket? My username is "wanze". Thanks1 point
-
1 point
-
I'm not sure what login you mean but for custom login using $session->login(user,password) you'd have to code it like this: //.. try{ $u = $session->login($username, $pass); if($u && $u->id){ $session->redirect("/somepage/"); } } catch(Exception $e) { echo $e->getMessage(); }1 point
-
The problem with having multiple sites pulling and/or manipulating from the same database is that the two sites become dependent upon one another. If something needs to change with the data source, then both sites need to change. If one site becomes compromised, both sites are compromised. When two sites need to talk to each other, regardless of platform, the best practice is to use JSON or XML web services. For the example you mentioned, and in the context of ProcessWire, I would use RSS feeds. Generate a feed of the data you want to share using the RSS Feed Generator module. Then output it on another site using the RSS Feed Loader module. Now you have two sites easily sharing data in a bulletproof manner. For more complex needs, you might also want to check out the Pages Web Service module.1 point