Search the Community
Showing results for tags 'Copy'.
-
This might be a somewhat niche module but I had a need for it and maybe others will also find it a useful development helper. Lister To Clipboard Easily copy a selector for the current Lister filters or selected results to the clipboard. For superusers only. Why? Lister or Lister Pro is handy for finding pages according to certain page attributes or field values and you can see the matched pages in a results list. Sometimes I want to run code on some or all the Lister results. Lister Pro allows results to be processed through Page Action modules but there are a couple of downsides to this: To execute custom code you would have to create a custom Page Action module and this may not be worth the trouble for a one-off operation. If you want to process only selected individual pages you can only select items from one page of the results. If you navigate to a different page within the paginated results the selection is lost. Lister To Clipboard gives you an easy way to copy a selector for the current Lister filters or a selection within the results so you can paste it into the Tracy Debugger Console or use it elsewhere in your code. Usage In Lister (Find) or in a Lister Pro instance, create filters to match the pages you want to target. If you want to select individual pages within the results, click an empty area of the cell within the first column (i.e. don't click directly on the page title). The cell will get a green background to indicate that it is selected. If there is more than one page of results you can move around the pagination to select more pages. Below the Lister results there is a blue box showing a selector string that will find the pages shown in your Lister results (or your selection within those results) when used in $pages->find(). Click the copy icon to copy the selector to the clipboard, then you can paste it into the Tracy Debugger Console or wherever you want to use it. https://github.com/Toutouwai/ListerToClipboard https://processwire.com/modules/lister-to-clipboard/
-
This module is sort of an upgrade to my earlier ImageToMarkdown module, and might be useful to anyone working with Markdown in ProcessWire. Copy Markdown Adds icons to images and files that allow you to copy a Markdown string to the clipboard. When you click the icon a message at the top left of the screen notifies you that the copying has occurred. Screencast Note: in the screencast an EasyMDE inputfield is used to preview the Markdown. It's not required to use EasyMDE - an ordinary textarea field could be used. Usage: Images When you hover on an item in an Images field an asterisk icon appears on the thumbnail. Click the icon to copy an image Markdown string to clipboard. If the "Description" field is populated it is used as the alt text. You can also open the "Variations" modal for an image and click the asterisk icon to copy an image Markdown string for an individual variation. Usage: Files When you hover on an item in a Files field an asterisk icon appears next to the filename. Click the icon to copy a link Markdown string to the clipboard. If the "Description" field is populated it is used as the link text, otherwise the filename is used. https://github.com/Toutouwai/CopyMarkdown https://processwire.com/modules/copy-markdown/
-
Hello all, wasn't sure where to put this, so it goes in General section. Ryan shows a hook that we can use to mirror files on demand from live server to development environment to be up to date with the files on the server without having to download complete site/assets/files folder. I just implemented this but had problems getting files to load from a site in development that is secured with user/password via htaccess. First I tried to use WireHttp setHeader method for basic authentication like this function mirrorFilesfromLiveServer(HookEvent $event) { $config = $event->wire('config'); $file = $event->return; if ($event->method == 'url') { // convert url to disk path $file = $config->paths->root . substr($file, strlen($config->urls->root)); } if (!file_exists($file)) { // download file from source if it doesn't exist here $src = 'http://mydomain.com/site/assets/files/'; $url = str_replace($config->paths->files, $src, $file); $http = new WireHttp(); // basic authentication $u = 'myuser'; $pw = 'mypassword'; $http->setHeader('Authorization: Basic', base64_encode("$u:$pw")); $http->download($url, $file); } } But, unfortunately this didn't work. So now I am using curl to do the download. My hook function now looks like this function mirrorFilesfromLiveServer(HookEvent $event) { $config = $event->wire('config'); $file = $event->return; if ($event->method == 'url') { // convert url to disk path $file = $config->paths->root . substr($file, strlen($config->urls->root)); } if (!file_exists($file)) { // download file from source if it doesn't exist here $src = 'http://mydomain.com/site/assets/files/'; $fp = fopen($file, 'w+'); // init file pointer $url = str_replace($config->paths->files, $src, $file); $u = 'myuser'; $pw = 'mypassword'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 50); // crazy high timeout just in case there are very large files curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, "$u:$pw"); // authentication curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // authentication curl_setopt($ch, CURLOPT_FILE, $fp); // give curl the file pointer so that it can write to it curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $data = curl_exec($ch); curl_close($ch); } } Now I can load files and images from the htaccess protected development server ? If anyone knows how to get this to work with WireHttp, please let me know. Thank you.
-
Hi all! I've been searching/browsing a bit, but can't find what I'm looking for just yet... Perhaps I'm searching in the wrong places, but I thought posting it here might work better/more efficient. I need to do the following; 1. I have the TITLE field (the one set by ProcessWire as default). 2. There's already a whole lot of pages of the template 'project' set up. 3. Now I actually want to be able to add <i> and <br> tags to this title...which is possible if I turn off the specialchar encoder... ...but it also presents the opportunity for people to start typing, and generate the following kind of URLs: TITLE: This is a really long title <br> which <i>needs</i> to be split in two URL generated: this-is-a-really-long-title-br-which-i-needs-i-to-be-split-in-tow Don't want that happening. So, I thought it might be wiser to do the following. Next to the 'title' field, also set a 'display-title' field. But, preferably I'd want to generate this for all the projects already in existance...including copying their content to this new display-title field. Just adding the field means all the titles will need to be copied...not something I look forward to telling the editors of the site ? I saw the Hook for on-save, but that's only for the single page...and I'm not an experienced MySQL-coder/user, otherwise I guess that would've been the way to go. So I'm really curious to hear if you guys think there are other/better options (and what they are) Thanks!
- 8 replies
-
- generate fields
- copy
-
(and 2 more)
Tagged with:
-
I mean.. when the clients are entering values from products list table.. it will be great if they could duplicate the existing row with fields and to change only a few values (like size & price) of them. Just a suggestion. It will e an easy way for entering price tables. thanks a
-
Hi, I have a small module I created that copies across field content from one page to multiple other pages. I just added a repeater field and while it copies across to the other pages it has caused timeout/memory issues with PHP. I think this is because of the multiple fields within the repeater (title, text caption, image) each being copied multiple times. I thought one way to help would be to not copy images across as they're not needed in the other pages. However I'm unable to figure out how to copy a repeater field excluding one field within the repeater itself. This is my current code: // Inline gallery 1 if(count($page->article_inline_gallery_1)) { $translation->of(false); $translation->article_inline_gallery_1->removeAll(); $gallery = $page->article_inline_gallery_1; foreach($gallery as $item) { $translation->article_inline_gallery_1->import($item); $translation->save("article_inline_gallery_1"); } } At the point that each repeater imported as a whole ->import($item) could anyone help to exclude one of the fields within the repeater?
-
Hi there, I was wondering if there's a module that allows me to copy certain pages or content from one instance of Processwire to another instance? Unfortunately, I can't copy a whole instance across as there needs to be some major cleanup job performed and it won't get done in time. Otherwise, if anyone has any code samples that would be much appreciated.
-
Hi, in PW 2.4.0 I have setup a role "publisher", containing the permission to Clone a page and Clone a tree of pages. All Permissions for this role: Delete pages Edit pages View pages User can update profile/password Clone a page Clone a tree of pages The user that is being set to publisher should then be able to view and edit, but also clone a page or tree of pages. Within the templates' Access tab, I have selected the publisher role to be able to: VIEW PAGES EDIT PAGES CREATE PAGES ADD CHILDREN Am I missing a "CLONE PAGES" option here? On the family tab, I have set "Can this template be used for new pages?" to "Yes". For some (for me) unapparent reason, I do not have the option to copy a page from within the tree, the button is missing, even though the template and role/user seems to be setup properly. How can I get this to work? Kind regards, Pascal
-
I have an image field with setting 'Maximum files allowed' set to 1 (in case that's relevant). I drop an image in it and save and then use that image in a textarea field when editing copy (with TinyMCE if relevant). But is there a neat way to replace such an image for a new version? Right now I am dropping in a new image and saving except then the textarea shows a placeholder space not the image which makes sense as the original is gone but if I select the placeholder and click the image icon in the TinyMCE toolbar then I get an error (saying the image is gone) rather than an opportunity to choose the new version. I know I can delete the image placeholder in the copy and add the new one but then I loose stuff like any alignment or size settings. Anyone know if there is a neater way to perform the replacement of images?