Leaderboard
Popular Content
Showing content with the highest reputation on 04/17/2017 in all areas
-
I am not sure how many established ProcessWire users use the Atom IDE, but since it is free, works on linux, and has the features I like, I decided to install it. It is a very nice and comfortable interface. It would be nice to have the advanced.js provider reference the ProcessWire API directly so that users are always up to date. There are a vast number of similar IDEs, and I don't suggest that ProcessWire 'endorse' any particular one. However, I do think that having such plugins available for a few can only add to the attraction of ProcessWire.2 points
-
I will go peek. I also found a post about SSH-ing into it and removing things like hidden files and so on https://community.wd.com/t/hidden-wdmc-directories-created-by-mcserver-and-photodbmerger-and-the-deletion-of-them/91860/8 Though I will research that a bit more first. BIt of a valuable storage this!2 points
-
https://processwire.com/blog/posts/processwire-3.0-alpha-2-and-2.6.22-rc1/#compiled-template-files "It can be disabled globally by setting $config->templateCompile = false; in your /site/config.php file. If you do disable it, you'll likely want to add a namespace ProcessWire; to the top of your PHP template files where necessary." In practice, the simplest solution is to always add <?php namespace ProcessWire; if none other is required.2 points
-
Hi, I got round to installing the tracy debugger. Pretty lost with it tbh, looks like a huge variety of options. Anyway, just testing it out, but when I click on the console, there's nowhere to type: Looking at some screenshots, seems there should be a black box in there. Not sure what I'm doing wrong here. Brand new install 3.0.42 with Tracy 4.3.2, using google chrome. [SOLVED - SEE EDIT BELOW] One other thing, I wanted to test the 'bd()' method to see what's actually in the whole array. So I can't get the console working (as above) so I typed it straight in my template and I get some output in the dumps recorder. The array is bigger than what it output though so I can't see it all. I used it like this in the template: <?php $json = file_get_contents($config->paths->templates . "/file.json"); json_decode($json, $assoc = true); bd($json); ?> ...which outputs: I've been reading on this page: https://processwire.com/blog/posts/introducing-tracy-debugger/#dumps-recorder-panel but still not getting it right. Any advice would be great, thanks. ==EDIT== Solved the second bit by using: <?php $json = json_decode(file_get_contents($config->paths->templates . "/file.json"), $assoc = true); bd($json); ?> Still no console though.1 point
-
1 point
-
1 point
-
@benbyf, I am not sure if this is the whole code, but I want to point out some parts. <?php // you should use $page->mp3->filename to prevent unnecessary (and slower) network request // let PHP read file from the disk directly $file = fopen($page->mp3->httpUrl, 'r'); fseek($page->mp3->httpUrl, $offset); $data = fread($page->mp3->httpUrl, $length); fclose($page->mp3->httpUrl); // also, this forces client to download whole file wireSendFile($page->mp3->filename, $options, $headers); // whereas sending the parts you prepared is just cheaper print($data); So, the current implementation just sets the headers iTunes was checking for, but it sends whole file, not the parts client requested. This might total to an unnoticeable difference for lower traffic files, but you should opt for sending only the parts client requested. Just my 2 cents.1 point
-
That anwser did the trick i think, i managed to make the implementation below. It must have been a new itunes requirement for byte-range headers. $filesize = filesize($page->mp3->httpUrl); $offset = 0; $length = $filesize; if ( isset($_SERVER['HTTP_RANGE']) ) { // if the HTTP_RANGE header is set we're dealing with partial content $partialContent = true; // find the requested range // this might be too simplistic, apparently the client can request // multiple ranges, which can become pretty complex, so ignore it for now preg_match('/bytes=(\d+)-(\d+)?/', $_SERVER['HTTP_RANGE'], $matches); $offset = intval($matches[1]); $length = intval($matches[2]) - $offset; } else { $partialContent = false; } $file = fopen($page->mp3->httpUrl, 'r'); // seek to the requested offset, this is 0 if it's not a partial content request fseek($page->mp3->httpUrl, $offset); $data = fread($page->mp3->httpUrl, $length); fclose($page->mp3->httpUrl); if ( $partialContent ) { // output the right headers for partial content $headers = array( 'HTTP/1.1 206 Partial Content' => true, 'Content-Type' => 'audio/mp3', 'Content-Length' => $filesize, 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', 'Content-Range' => 'bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize, 'Accept-Ranges' => 'bytes', ); // send partial file wireSendFile($page->mp3->filename, $options, $headers); }else{ // send file wireSendFile($page->mp3->filename, $options); }1 point
-
Thanks for the links and CKEDitor info, Sam and szabesz! I will check out that link to see about tweaking the editor.1 point
-
Oh, so what I tried to install isn't compatible with the latest stable release of PW. Thanks for the link!1 point
-
@tom0360 If you want more control over bootstrap and compile it yourself with SASS, I made a site profile which also includes some functions for rendering drop down menu and accordion: https://github.com/gebeer/site-pwbs1 point
-
@Neveroff Hi, I've not yet tried to install it but you might want to give a try to this one instead: https://github.com/dadish/pw-skyscrapers-profile Introduced in this video:1 point
-
@benbyf just a shot in the dark, but have you considered that with the 2.7.2 version, when you submitted it, Apple was not validating the byte-range request support?1 point
-
SomeC is generally right, CKEditor is a beast you need to tame if you want to use it as a full fledged HMTL editor, I guess this is because it is not designed to be such a thing. A few resources though: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/modules/Inputfield/InputfieldCKEditor/README.md1 point
-
@ryanC this is a very helpful resource for image handling: https://processwire.com/api/fieldtypes/images/ CKeditor is a different story, it will strip out tags unless you tell it otherwise. I found trying to manipulate CKEditor to be a pain in the butt and I try to not use any inline stuff in there at all (no added classes/ids or anything), I've always found you can target HTML tags using CSS wherever they might be. I simply use it for bigger blocks of text that need header/paragraph combos and maybe an image inserted. You can search the forum for "ckeditor allowed styles" or "ckeditor stripping tags" (something along those lines) and there are a few posts about editing the config file to allow what you are asking for.1 point
-
Hey! This is a very early/experimental/alpha not for production environments release of a new module I'm working on. Just testing the possibilities and the interest that might be for such a thing. The idea is to be able to quickly create fields while working inside the template files without having to go to the admin. For example, in an early stage of development when creating a layout, insteading of putting a placeholder headline and then going to the admin to create the headline field where the real content will be, you can create the field directly from the template file by doing: <h2><?=$page->field("A nice headline", "headline", "text")?></h2> This will create a new "headline" text field when it doesn't exist in the system and add it to the the template of the page you're working on and add "A nice headline" value to it. On a second run the module will recognize that the field already exists on that template and will simply return it's value. The method accepts three string parameters in the order ( value, field name, field type ). Value and name are required but field type will assume "text" when omitted. $page->field("A nice headline", "headline"); // creates a text field $page->field("A nice paragraph", "body", "textarea"); // creates a textarea field The method also accepts a boolean parameter in any position: TRUE forces the value to be saved into the field on that page, FALSE (or omitted) sets that value to the field when it adds it to the template, but leaves it how it is when the field already exists in the page. This is the only situation when this module can be destructive, and it's only concerning the value of the field on that page: $page->field("Another nice headline", "headline", TRUE); // will create or add a text field and add the value to the page even if the field already exists there The method also accepts an array as parameter. This array will be used as options for the creation of the field. The options array will override the string parameters when they clash. $page->field("A nice headline", "headline", array( 'name' => 'subtitle', 'label' => 'Subtitle' )); // will ignore the name "headline" and use "subtitle" instead As soon as the fields are created and added to the template, all the method will do is return the value, just like if using $page->headline, unless you use the TRUE parameter which will override the value of the field by the value in the first parameter. -- With this module you can, for instance, convert an existing HTML template quickly, just by pasting the html into a template with no fields created yet, and going through all the code, replacing the content by calls to my field() method. In the end you should have a working page with all the fields created in the template. Now you just need to go to the fields and adjust their preferences. So, just download it > install it > test it > tell me what you think! dynamicPageFields.module.zip -- Edit: Multilanguage fields threw an error but they don't now. You can create a multi lang text by doing: $page->field("A nice headline", "headline", "textlanguage"); that third parameter is just a case insensitive simplification of input field names to make it easier to write. You can still use the original input field name like "FieldtypeTextLanguage" if you prefer.1 point
-
That syntax is not quite right. The format is this: elements [attributes]{styles}(classes) So your rule would be: a[href,rel](*) Don't think you need to include the href attribute though as that is allowed by default.1 point
-
This isn't actually an installable profile though - you can explore the template files but without the database from the demo site it's not as useful as it could be. @ryan, could you please make an exported profile of the demo available?1 point
-
I think you should create a thumbnail on after saving the image with a hook. see https://processwire.com/api/hooks/captain-hook/?filter=image <?php // hook to this method protected function ___fileAdded(Pagefile $pagefile); $this->addHookAfter('InputFieldImage::fileAdded', $this, 'createThumbnail'); // create the thumbnail public function createThumbnail(HookEvent $event){ $file = $event->return; // new thumb $page->image->width(200); } with that you create the thumbnail right away on image uploading. I think that would work. But haven't tested that code.1 point