Leaderboard
Popular Content
Showing content with the highest reputation on 02/23/2016 in all areas
-
Hey guys, here's a video demonstrating the Live Preview feature of ProDrafts. This feature should be available to ProDrafts users this week. Please view the larger + HD version so that you can see it better.10 points
-
ProcessAssetsBackups is a new module I've developed as an Image Archive. Why? When multiple people maintain content, sometimes updating older pages, eventually someone reports as "missing" an image which someone discarded a year ago. This archive tool explains what happened and provides the old image. Status: It's working (in 2.7.3) and provides the functionality I need for my current project but it could do more. Before I put it out in the world I'd like to know what people would like from such a module. It could archive other file based assets and do more in terms of Restore and Explore operations. In my test I've backed up about 1.5GB of images from a site with about 30,000 pages. Click a button in the page editor to see chronological listing of past and current images from the archive. Read the overview to see what we have so far. Overview: The module maintains a backup of Processwire file assets for images (not the variations, only files with one dot). The tree of archived files is positioned outside of the Processwire installation, partly for logistics of site maintenance and partly to avoid conflicts with Processwire's access control. Batching and cron are involved because of the quantity and ongoing nature of the work. To update the archive, image field table records are inspected in the order of their modified timestamps. After each batch of images the last timestamps are saved in module config so the updater knows where to resume. Cron should call this frequently. A small PHP script provides access to the archive. Cron uses it to run the updater like this: http://www.example.com/abService.php?cmd=update To get a report on available assets for a given page call it like this: http://www.example.com/abService.php?cmd=explore&id={$page->id}; In the backend a /processwire/setup/assets-backups/ page lets you set which image fields are to be backed up. On save it resets the timestamps in the module's config info so that everything is checked. More about the archive contents: When the updater finds a new image it saves that image and also saves a small json file containing the image field's record for that image. Having the field data opens up possibilities for additional features. These json files are named by the timestamp, field name and sort value (to sort in a useful way and be unique). In most cases the image file names are unaltered. The exception is when a new replacement image has the same name as an existing image but is a different size. In that case the existing copy is suffixed with the new image's timestamp (indicating time of retirement) before the new image is copied. Access to the archive files can optionally be restricted by an .htaccess file. That rewrites URLs, sending them to the abService.php script which is setup to return content only to users who are logged in and have certain roles. Others get a 404. The script can easily be edited to return only files with certain extensions (e.g. allow images but not json files). Making use of the archive: An "Image Archive" button can be added to edit pages for templates having images. This is done by adding a RuntimeMarkup field to the page and pasting in a few lines of code to open a abService.php url in a modal. Currently this display is simply a chronological list of the images with their timestamps and filenames. If you want to revert to an earlier image you can drag and drop it to a folder on your computer and then drag and drop it from there to an image field in a page editor. Any suggestions?3 points
-
3 points
-
As far as I can tell, there are two solutions to your issue: <?php namespace ProcessWire; require 'index.php'; var_dump(new Page()); ... or: <?php require 'index.php'; var_dump(new \ProcessWire\Page());3 points
-
Hi all, worked it out using a pen and paper haha, followed the code and wrote down the word it seemed to be spelling out from the random string at the top. The random string turned out to be not so random spelling out base64_decode.2 points
-
I just tested with Soma's form tutorial and it rocks! I will definitly use it in my next project. Just put two attributes like : $submit->attr("ic-post-to", "{$config->urls->httpRoot}contact.php"); $submit->attr("ic-target", "#contact-form-error"); thats all... Impressed.2 points
-
Just found http://intercoolerjs.org/ It does declarative ajax. Frontend wizardry without writing javascript. I'm impressed.1 point
-
this module is intended for superusers during development and alpha state (although there should be no critical parts) only tested with chrome and pw 2.7.2 https://github.com/BernhardBaumrock/InputfieldEditLinks todo: - check if it works with ajax fields - add icon to view current page template to change template specific field-values bugs: - two icons on page fields1 point
-
1 point
-
Ah. I tried that, but I had to hit Modules -> refresh to get it to pick up the changes! Then I got a file compiled message and they showed up as a site module. I was not required to select what version to make it load, it just started using the site version as soon as I hit refresh!1 point
-
You need to go to the main Modules page and install the new Theme module. If you have not renamed it, ie left it as AdminThemeDefault, then I think you should get the option to choose which one to use.1 point
-
Module development is fun and educational - glad you learned stuff along the way. It's not a bad addiction to have BTW - That module of Soma's of one of my must haves for sure! Glad you like Tracy!1 point
-
hi adrian, of course i can, my module has several advantages: i tried your awesome tracy debugger for the first time i learned something new i found out about soma's much better module and will have a look how he did it thank's for pointing me to soma's module! should have found that earlier... would have saved me lots of clicking1 point
-
Hey guys, I believe that those instructions from Ryan about copying the templates-admin folder to site/modules/ are outdated. All you want now is the AdminThemeJoer or AdminThemeAndrei folder in site/modules/1 point
-
1 point
-
@BernhardB - looks good, but I would like to know if there are any advantages over Soma's Helper Field Links: https://processwire.com/talk/topic/421-helperfieldlinks-field-and-template-edit-shortcuts/ which also provides links to edit fields and templates, as well a lots of info on the settings right there in the Inputfield. Please don't this as a criticism - honestly curious, and also making sure you already know about the other module.1 point
-
A new panel would be too much (there's already quite a few of them ). What I could imagine is a toggle setting in the module to show the default language values or the current language values. Alternatively, adding a button next to the default language values which would show the other language values on click (maybe in a lightbox?). Anyway, I still have to use it for a while to decide its usefulness.1 point
-
Thanks! No issues here The PW info shows the page title/name/path, parent, etc, but they show only the default language values, even viewing another language. Have you thought about displaying language values instead? I'm not sure if this would be much beneficial, just asking.1 point
-
First I want to thank you for this module I missed only one little thing and therefore I sent you a pull request. I added a litte script which adds a hash to the url when clicking an item. On the other hand, if you enter such an url, the related item will be expanded and the page scrolls to this position. This way it is possible to send an url to an editor without having to say, open this link and after that click on the third headline. https://www.domain.com/processwire/setup/admin-help/#foo1 point
-
Yes, I have one variable $help defined like this from the Compiled template file: $help = 'kjlkj'; barDump($content); timer(); ?> <?php if(class_exists('\ProcessWire\TracyDebugger')) { \ProcessWire\TracyDebugger::$templateVars = \ProcessWire\TracyDebugger::templateVars(get_defined_vars(), \ProcessWire\wire('page')); } And the $Variables panel shows only: array() Nice to be of some help!1 point
-
One more idea. Maybe it's a SSL certificate problem. Could you try to copy this cert to such a location (you need to adapt the path): /Applications/AMPPS/extra/etc/openssl/certs/cacert.pem. Then update php.ini and restart Apache: [curl] ; A default value for the CURLOPT_CAINFO option. This is required to be an ; absolute path. curl.cainfo="/Applications/AMPPS/extra/etc/openssl/certs/cacert.pem" openssl.cafile="/Applications/AMPPS/extra/etc/openssl/certs/cacert.pem" Found on stackoverflow. I extended the error message again, added curl_error() output. Could you please pull the develop branch, test again and paste the error message?1 point
-
I changed the module line 223 to this: $event->return = preg_replace('/(\?>)?$/s', '$1', $event->return) . "\n?>\n<?php\nif(class_exists('\ProcessWire\TracyDebugger')) {\n\t\ProcessWire\TracyDebugger::".'$templateVars'." = \ProcessWire\TracyDebugger::templateVars(get_defined_vars(), wire('page'));\n}"; And now I don't get the error any more. BUT the variables panel only shows "array()" no real variables from my template. I try to make a clean install in the evening.1 point
-
I found that the image URL is actually a 302 Redirect. >>> https://www.facebook.com/ads/image/?d=AQKSUWuaIXz-dJmE44rETRVS0tH_wzPCCIb0oJQqB9LKNeLWUSFkJvcHYNCx0pywb4q8k6iaC9RF25kOlvgY7NCzW96myAtYf8u6Ap4gi2_CVdJ-eScWQhmB8dGbAfl1iKiR_CS1gMMxHwWWfo_nLxeZ > -------------------------------------------- > 302 Found > -------------------------------------------- Status: 302 Found Code: 302 Location: https://scontent.xx.fbcdn.net/hads-xfa1/t45.1600-4/12480837_6037580358670_471536793_n.png P3P: CP="Facebook does not have a P3P policy. Learn why here: http://fb.me/p3p" X-Frame-Options: DENY Content-Type: image/png X-Content-Type-Options: nosniff X-XSS-Protection: 0 Strict-Transport-Security: max-age=15552000; preload Public-Key-Pins-Report-Only: max-age=500; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E="; pin-sha256="q4PO2G2cbkZhZ82+JgmRUyGMoAeozA+BSXVXQWB8XWQ="; report-uri="http://reports.fb.com/hpkp/" Pragma: no-cache Expires: Sat, 01 Jan 2000 00:00:00 GMT Cache-Control: private, no-cache, no-store, must-revalidate Access-Control-Allow-Origin: * Set-Cookie: reg_ext_ref=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=.facebook.com; httponly Vary: Accept-Encoding X-FB-Debug: n+c81EJaLrZR8h4YdM/RGKNqGl8MN/vv8rPkQiyKQnA/KPlV1vMuWMwF2TkWiNTDrj/0CdHxzjCSvAA7G1Qpow== Date: Tue, 23 Feb 2016 10:57:37 GMT Connection: close Content-Length: 01 point
-
1 point
-
Could you please check whether the php curl extension is enabled? It seems that it comes with xampp but isn't enabled by default (I don't use xampp so this is just a guess). Have a look at your php.ini, uncomment the following line: ;extension=php_curl.dll Restart your Apache server and check your phpinfo() to see whether curl has been properly enabled or not.1 point
-
Maybe the filename is simply too long for Windows. It used to be 256 characters (probably still is). Your image filename is 296 chars long... Another issue could be http://stackoverflow.com/questions/8084172/facebook-thumbnails-issue-traced-to-safe-image-php Also, d_aqksuwuaixz-djme44retrvs0th_wzpccib0ojqqb9lknelwusfkjvchyncx0pywb4q8k6iac9rf25kolvgy7nczw96myatyf8u6ap4gi2_cvdj-escwqhmb8dgb.com_ads_image__d_aqksuwuaixz_djme44retrvs0th_wzpccib0ojqqb9lknelwusfkjvchyncx0pywb4q8k6iac9rf25kolvgy7nczw96myatyf8u6ap4gi2_cvdj_escwqhmb8dgbafl1ikir_cs1gmmxhwwwfo_nlxez doesn't really have a file extension o_O If the images are all of the same filetype, maybe add it manually? Or do a CURL header check (2nd block of code here http://stackoverflow.com/a/31046363)1 point
-
1 point
-
Of course both work -.- I tried multiple times to add the namespace ProcessWire at the top without any luck..now it just works haha Just for the record, both of snippets work for me. Thank you teppo! Making my first namespace experiences with pw devns..1 point
-
Here's what I did to install wireshell on windows 10 and xampp * Download composer-setup.exe and install it. Identify \utl\xampp\php\php.exe* composer global require wireshell/wireshell* Add %USERPROFILE\AppData\Roaming\Composer\vendor\bin to user PATH (in system properties, environment variables)* Run wireshell.1 point
-
https://processwire.com/talk/topic/6102-batch-child-editor/ Try out the Add mode - just enter a page name for each row in the textarea and you're done!1 point
-
@alan do you get <li> instead of <fieldset> tags? That would be the default behaviour. You can set the HTML tags that are rendered, even by inputfield type, see here.1 point
-
Hi Jakob, That's not possible currently but you could do a pre_match on $blog->renderPosts($page) to remove the link...Sorry, short on time and can't give an example at the moment...1 point
-
Thank you so much ! I can't believe I've passed through this one... It caused me a real headache having to manually repair the bad work with my 'delete' function. Now I've learned something again tonight thanks to both of you and I'm still enjoying more and more discovering ProcessWire Thanks again !1 point
-
hey this is great and was something i was eventually going to work on also, because it would be good to have a dedicated fieldtype for key value where they are entered into fields like this. Currently i use tables for this, and here is a thread with some other info, possible use cases; one thing that might be cool would be to have another column as in Martijn's example, so there is a name (key) label and value, and in his example there is also a trick for hiding the name of the keys from non super users (so they wouldn't break the front end in case they changed an in-use variable) https://processwire.com/talk/topic/8373-use-delimited-texarea-table-or-yaml-for-settings/1 point
-
1 point
-
1 point
-
@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.1 point
-
There is a default markup array in InputfieldWrapper ( https://github.com/ryancramerdesign/ProcessWire/blob/980ce4f0be2054dfbad4a7b334d35bdca42da7da/wire/core/InputfieldWrapper.php ): $defaultMarkup = array( 'list' => "\n<ul {attrs}>\n{out}\n</ul>\n", 'item' => "\n\t<li {attrs}>\n{out}\n\t</li>", 'item_label' => "\n\t\t<label class='InputfieldHeader ui-widget-header{class}' for='{for}'>{out}</label>", 'item_label_hidden' => "\n\t\t<label class='InputfieldHeader InputfieldHeaderHidden ui-widget-header{class}'><span>{out}</span></label>", 'item_content' => "\n\t\t<div class='InputfieldContent ui-widget-content{class}'>\n{out}\n\t\t</div>", 'item_error' => "\n<p class='InputfieldError ui-state-error'><i class='fa fa-fw fa-flash'></i><span>{out}</span></p>", 'item_description' => "\n<p class='description'>{out}</p>", 'item_head' => "\n<h2>{out}</h2>", 'item_notes' => "\n<p class='notes'>{out}</p>", 'item_icon' => "<i class='fa fa-{name}'></i> ", 'item_toggle' => "<i class='toggle-icon fa fa-angle-down' data-to='fa-angle-down fa-angle-right'></i>", // ALSO: // InputfieldAnything => array( any of the properties above to override on a per-Inputifeld basis) ); You can override this with your own array: $form->setMarkup = array( // your stuff here ); And the last note in the first code block there says you can override per field as well, so happy days - you can do InputfieldText and so on and play around and see what happens. I would suggest {attrs} would always be required for simple fields like input type=text etc as this will have the field name and so on.1 point
-
I've managed to modified the original module to include a InputfieldPageListSelect. Probably not good for large amounts of images due to the ajax calls. However for my purposes, a hero slider to link items, it works fine. In template: <a href="<?php echo $pages->get($img->link)->url?>"> FieldtypeImageExtra-PageListSelect.zip1 point
-
Hi, just wanted to let you know, that I started another gist for this here: https://gist.github.com/4258927 I added the word count thingy and some smaller tweaks, but I'm definitely going to add the rest (particularly proper documentation), when I find time for it. Thanks, Soma, for kickstarting me on this! Ah, and another question for everyone: Would it be more elegant to integrate the functionality for plain text inputfields in this module or would you prefer to have it as a seperate one?1 point
-
Looking a little closer, I think the simplest solution will be for you to extend InputfieldImage.module, creating a new module. The module won't need much code in it. It'll just have to override two methods (outlined below). I've included some sample code in this message and it's written in the browser and untested. So you may have to adjust it and play around a bit to make it work. Unless you want to also create a new Fieldtype, you'll need to work within the data available to FieldtypeImage, and that means just a single 'description' field. You'll use that 'description' field to hold an encoded version of multiple fields. I would suggest using JSON (with PHP's json_encode() and json_decode()) or XML, whatever you prefer. But here's an [untested] example of the two methods you would override in your new module that extends InputfieldImage.module: <?php protected $descriptionTemplate = array( 'your_field1' => '', 'your_field2' => '', 'your_field3' => '', // or whatever you want ); protected function renderItemDescriptionField(Pagefile $pagefile, $id, $n) { $description = json_decode($pagefile->description, true); if(!$description) $description = $this->descriptionTemplate; foreach($description as $key => $value) { $description[$key] = htmlentities($value, ENT_QUOTES, "UTF-8"); } $out = <<< _OUT <label for='your_field1_$id'>Your Field #1</label> <textarea id='your_field1_$id' name='your_field1_$id'>$description[your_field1]</textarea> <label for='your_field2_$id'>Your Field #2</label> <input type='text' name='your_field2_$id' id='your_field2_$id' value='$description[your_field2]' /> <label for='your_field3_$id'>Your Field #3</label> <input type='text' name='your_field3_$id' id='your_field3_$id' value='$description[your_field3]' /> _OUT; return $out; } Then you'll also need to override ___processInputFile with something like this (example): <?php protected function ___processInputFile(WireInputData $input, Pagefile $pagefile, $n) { $changed = parent::___processInputFile($input, $pagefile, $n); $id = $this->name . '_' . $pagefile->hash; $description = $this->descriptionTemplate; $description['your_field1'] = $input['your_field1_' . $id]; $description['your_field2'] = $input['your_field2_' . $id]; $description['your_field3'] = $input['your_field3_' . $id]; $description = json_encode($description); if($description != $pagefile->description) { $pagefile->description = $description; $changed = true; } return $changed; } Once you've created and installed your new module, you'll select it as the "Input field" in field's settings, for your image(s) field. You'll also want to make sure that you set it to "no" for entity encoding the description field, in the field's settings. The main drawback of this approach is that you'll need to decode the fields from the image's description field every time you want to access them. So if you are iterating through some images in your template, you'd do it like this: <?php foreach($page->images as $image) { // decode the description field to an array $description = json_decode($image->description, true); // if there's nothing there, then skip it if(!$description) continue; foreach($description as $key => $value) { // you decide if this is necessary for your intended use (usually I would say Yes) $description[$key] = htmlentities($value, ENT_QUOTES, "UTF-8"); } echo "<p>Field 1: $description[your_field1]</p>"; echo "<p>Field 2: $description[your_field2]</p>"; echo "<p>Field 3: $description[your_field3]</p>"; } We can get around this drawback by implementing a hook to do this for you once a page has finished loading. However, if it's that important, I would suggest looking at creating a new Fieldtype instead, as that would be ultimately more efficient, and probably easy to do. If you want to take that approach, let me know because you won't need to do any of this encoding/decoding, instead we'll just have the Fieldtype's DB schema keep the fields instead. So with that approach, the corresponding Inputfield would be a little different.1 point