Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/01/2017 in all areas

  1. // tested only backend part $this->addHookAfter('FieldtypeSelectExtOption::filter', function($e) { if ($this->wire('page')->template == 'admin') { if ($this->wire('page')->process == 'ProcessPageEdit') $id = $this->wire('input')->get->id; else return; } else if ($this->wire('page') instanceof RepeaterPage) $id = $this->wire('page')->getForPage()->id; else $id = $this->wire('page')->id; $e->return = "pages_id='$id'"; });
    4 points
  2. You maybe could use my module FieldtypeSelectExtOption in this case. install module create a field with this Fieldtype go to details tab of the new created field choose your preferred Inputfieldtype select the field holding your images as 'Source Table' save field select 'sort' for option value and whatever you want as 'label' set ther filter to 'pages_id = 1234' (1234 is a placeholder for the pages-id holding your image field and repeaters) save again add the field to your repeater matrix template done Tell me if it works or if any problem occurs.
    4 points
  3. Tracy went to language school! Now she shows page titles and names in the current language, along with the title and name of that language in the Summary section. And she has a completely new Language Info section showing a summary of the title, name and active status of each language. Hopefully this should help to debug why something is not showing on the front-end. The ⓘ icon highlights titles/names that are missing in the current language. It shows the default title/name instead, along with this icon. Let me know if you notice any problems!
    3 points
  4. @Roman Schmitz - just wanted to let you know that I have committed a new version to Github that fixes your issue, as well as updates the module in several ways for newer PW versions. Please let me know if you have any problems with the new version.
    3 points
  5. No issues here with the scroll (Chrome/FF). I have plans to modify the field edit link tooltip, then I'll try to make them work in repeaters too, and perhaps add a template context feature too.
    2 points
  6. This syntax works fine for me with plain Repeater fields, so it should work for Repeater Matrix fields too: $results = $pages->find("my_repeater.my_nested_repeater.my_textarea%=foo"); So maybe typos are slipping in somewhere else... Testing this did expose a bug where pages are matched when the repeater fields are empty - will file this at GitHub shortly. Done: https://github.com/processwire/processwire-issues/issues/205 There is another way you could do this, but I think the selector with subfields is more elegant... // returns the root container page for any repeater item no matter how deeply nested function getRootContainer($page) { if($page instanceof RepeaterPage) { return getRootContainer($page->getForPage()); } else { return $page; } } $results = new PageArray(); $repeater_pages = $pages->find("my_textarea%=foo, has_parent=2, include=all"); foreach($repeater_pages as $repeater_page) { $results->add(getRootContainer($repeater_page)); }
    2 points
  7. @Jozsef - that error should be fixed in the latest version - please let me know if you have any more problems with it. @Ivan Gretsky - latest version adds that new setting - let me know if it works as expected. I also added to/revised the explanatory text for the various access settings in the hopes of makes it easier to understand. Cheers, Adrian
    2 points
  8. I am voting for for that option)))
    2 points
  9. @Jozsef - I'll look into that shortly. @Ivan Gretsky - Yeah, I did change behaviour slightly there. Previously the debug bar would display in DETECT mode on a local dev environment even without the "tracy-debugger" permission. Even though as far as I know it isn't possible to spoof $_SERVER['REMOTE_ADDR'], I thought it still might be a little confusing/concerning to users. I would be happy to bring this back as an option though. I'd add a new config setting checkbox that says - "Force development mode for guests when DETECT determines localhost", or something like that. Would that be helpful for your workflow? On the issue of debugging under different roles, don't forget about the User Switcher panel which allows you to switch to any user (including logged out as guest) and still have the debug bar enabled.
    2 points
  10. I'd add it to the config just because to me a locale is like a config value. init.php might be a little late because auto load modules are already initialized https://processwire.com/blog/posts/processwire-2.6.7-core-updates-and-more/
    2 points
  11. The function filter() is hookable. You can modify the selector string returned by filter().
    2 points
  12. It's also perfect for xml, json, [insert any datatype] .... .
    2 points
  13. @adrian thanks a lot for sharing this and for pointing me in the right direction! To clear the original values you can just pass "null" to the "to" method: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/WireMail.php#L152 Same works for cc & bcc, but to be honest, I only tested this in combination with WireMailSmtp. It might look different without WireMailSmtp (e.g. no cc/bcc) The whole hook function looks like this and it works as expected. $this->addHookBefore('WireMailSmtp::send', null, function($event) { if(!$this->config->debug) { // when not in debug mode do nothing return; } $mail = &$event->object; // store orgiginal recpients $recipients = array( 'to' => $mail->to, 'toName' => $mail->toName, 'cc' => $mail->cc, 'ccName' => $mail->ccName, 'bcc' => $mail->bcc, ); // reset all original recipients $mail->to(null); $mail->cc(null); $mail->bcc(null); // add debug recepient $mail->to = 'Dropbox <dropbox@my-domain.com>'; // create debug information for mailbody $debug_body = '### DEBUG INFO ###<br />'; $debug_body .= 'TO: '.implode($recipients['to'], ', ').'<br />'; $debug_body .= 'CC: '.implode($recipients['cc'], ', ').'<br />'; $debug_body .= 'BCC: '.implode($recipients['bcc'], ', ').'<br />'; $debug_body .= '### / DEBUG INFO ###<br /><br />'; // replace original mailbody $new_mailbody = str_replace('<body>', '<body>'.$debug_body, $mail->bodyHTML); $mail->bodyHTML($new_mailbody); return; });
    2 points
  14. I'd probably use a repeater with fields "quantity", "unit" and "ingredient". This way, you can also do searches for individual ingredients and reorder them easily. But you can of course go the textarea way and simply split its content on newlines. <ul class='ingredients'> <?php foreach(explode("\n", $pages->ingredients) as $ingredient) { echo "<li>$ingredient</li>\n" } ?> </ul>
    2 points
  15. I missed the second post. Now I have the new version installed and everything works great. Thanks again for the quick response.
    2 points
  16. Hi @adrian - thank you for your quick reply. I have changed the line and now everything works as expected. I'm very excited!
    2 points
  17. I think Adrian also automates EVERYTHING. I wish I could also do that too...
    2 points
  18. As fas as I know, currently there is no way for a module developer to include a changelog in a way that enables us to check out the changes in the admin before upgrading.
    1 point
  19. I recently had a revelation when building HTML emails, what's the difference between HTML emails, and HTML web pages? Other than the horrible table syntax, the result is the same, it's still HTML. This got me thinking why not use a CMS to help generate the HTML emails based on a template? Just like we using a CMS to help generate HTML web pages. We started by setting up ProcessWire (our usual CMS of choice) and added the relevent fields for the sections of the email. Then we took a previous email moved the content into ProcessWire and hooked up the code to pull that content back into the correct places. Repeater fields allowed us to have repeatable sections that are easy to add too, change order of or remove, giving us huge flexibility when a client changes their mind last minute. The speed of setting up and dealing with ProcessWire allowed us to go from concept to working prototype within a day. To use the emails, we just view source of the generated page, and copy and paste into the email system. Sometimes Litmus inliner is required to allow the email to work in Outlook, but we can run it through that before pasting into the email system. Future development could be integrating a css inliner into the generation step, to avoid using litmus inliner. Hope this helps show how ProcessWire can be used in a different scenario.
    1 point
  20. As a graphic designer I like the new options to output markup with the templates (region function and regions markup strategy) but testing them I think they could adapt a little more for ease of use. In this proposal I modify the syntax and the way of assigning the values, while I try to maintain the concept. Next the common example, in "_main.php" <!doctype html> <html class="no-js" lang=""> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--[pw headseo]--> <!--[/pw]--> <!--[pw headstyles]--> <link rel="stylesheet" href="css/normalize.min.css"> <link rel="stylesheet" href="css/main.css"> <!--[/pw]--> <script src="js/vendor/modernizr-2.8.3.min.js"></script> <!--[pw headscripts]--> <!--[/pw]--> </head> <body> <!--[pw header]--> <h1><?php echo $page->title(); ?></h1> <!--[/pw]--> <!--[pw body]--> <?php echo $page->body(); ?> <!--[/pw]--> <!--[pw footer]--> <!--[/pw]--> <!--[pw footerscripts]--> <script src="js/jquery.min.js"></script> <!--[/pw]--> </body> </html> then in the template file "home.php" <!--[pw headstyles+]--> <link rel="stylesheet" href="css/home.css"> <style> body { padding-top: 50px; padding-bottom: 20px; } </style> <!--[/pw]--> <!--[pw head+]--> <h2><?php echo $page->headline(); ?></h2> <!--[/pw]--> <!--[pw footer]--> <h3>About Homepage</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec efficitur dignissim nisi nec consequat.</p> <!--[/pw]--> Well I'm not a programmer, I hope you understand the above. But the idea is: Using html comments for regions definition, this is a standard in html, and not interfere with the DOM or with the page structure, allowing using it in document areas that are not visual. The current option basically is to use DIV but this is not correct in areas like the head tag. Using the open/close tag system allow the use of IDE features for html as auto-completion, code coloring, code validation, visual previews and more. Allowing populate the initial values for regions without variables concatenation and with the previous advantage (auto-completion, code coloring, etc) The pages can be render without additional Ids and class, maybe useful for debugging and can be cleaned in production with something like $config->cleanRegions = true; It can support the current prepend, append, before, after etc regions strategy, I think its a mix of the current Region Markup. As I said I am not programmer but I think it can be implemented using Output Buffering ob_start (); ob_end_clean (); capturing the code between open/close comments tag and assigning them to the corresponding region ... If someone likes and have time to analyze and improve this idea, are welcome because I don't know how to implementing it .. sorry
    1 point
  21. @szabesz - firstly, sorry for renaming that setting on you I just posted a response in that Wishlist thread - I agree that we need this badly - I have added some suggestions for how, and also to include a "Breaking changes" flag in the ProcessWire Upgrades module, which I also think is important.
    1 point
  22. I would also love to see this - I think it would be great if we could define it in a Github repo changelog.md file and have the automatically imported into the text in the modules directory, and perhaps even displayed in the module info within a PW install. Perhaps it would even be nice to have a way to add a flag about breaking changes that would show up in the ProcessWire Upgrades module so you are warned before upgrading. @ryan - any thoughts on this? I'd be happy to work on it - obviously I could do the PW side of it from the repo, but would need access to the php files for the modules directory to make that side of things work.
    1 point
  23. I wish there was a supported way to display a simple CHANGELOG that comes with a module. Other CMSes utilize this dead simple but very useful feature. I wonder why we have to live without it. Once I pointed this out, but only four of us seem to care including @adrian, of course Why are people are so uninterested in this? Strange. Last time I spent at least 5 minutes to find the "Admin Style" option of Tracy because it was renamed to "Server Type Indicator". A simple message like "Admin Style was renamed to Server Type Indicator" would have saved me the hassle. There are so many settings of Tracy that I often get lost, especially when things are renamed or moved around.
    1 point
  24. Hi @tpr, would it be possible to get the field edit links that show on hovering a field label to work on fields that are inside repeater items? Ooh, and another idea re: field edit links. What if Ctrl-click brought up the settings for the field in the template context? (i.e. the template overrides) Edit: one more thing... The "Configure" anchor links in the Submodules panel do not scroll me to the right options panel, but scroll down quite a bit further. Tested in Firefox and Chrome on Windows.
    1 point
  25. I think Profields Table might be the nicest solution for this - one column each for "quantity", "unit" and "ingredient".
    1 point
  26. @Tyssen , if you decided for this approach of caching the xml, you can see how I've done this when I was getting info from Slideshare using GuzzleHttp client. use GuzzleHttp\Client; public function getSlideshows() { $client = new Client([ // Base URI is used with relative requests 'base_uri' => 'https://www.slideshare.net/api/2/', // Set timeout. 'timeout' => 35.0, //Slideshare was taking long 35 seconds to respond. The xml has 100+ items. ]); $api_key = 'xxx'; $username = 'xxx'; $time = mktime(date("H")); $secret = 'xxx'; $sha1 = sha1($secret].$time); $cache = wire('cache'); $response = $cache->get("slideshare_xml"); //save and cache the xml if(!$response) { $url = $client->get('get_slideshows_by_user?username_for='.$username.'&detailed=1&api_key='.$api_key.'&ts='.$time.'&hash='.$sha1); $response = $url->getBody(); $cache->save('slideshare_xml', $response); //default is 24h } $xml = new \SimpleXMLElement($response); echo $xml; // $slide["secret_key"] = (string) $xml->Slideshow->SecretKey; // $slide["title"] = (string) $xml->Slideshow->Title; // $slide["description"] = (string) $xml->Slideshow->Description; // $slide["url"] = (string) $xml->Slideshow->URL; // $slide["thumbnail_url"] = (string) $xml->Slideshow->ThumbnailURL; // $slide["embed_url"] = (string) $xml->Slideshow->SlideshowEmbedUrl; // $slide["created"] = (string) $xml->Slideshow->Created; // $slide["language"] = (string) $xml->Slideshow->Language; // $slide["num_views"] = (int) $xml->Slideshow->NumViews; }
    1 point
  27. FYI - I had to add it to init.php on certain servers: https://github.com/processwire/processwire-issues/issues/184#issuecomment-280079855
    1 point
  28. Is the data from the XML needed to be shown in real time? I'm mean, does it change A LOT every minute or so? I don't think so, as is not an auction site apparently. So I think is a good idea to import the data as PW pages and using a cron job or manually import only the fields that changed on a daily update and import new items if not created already.
    1 point
  29. If you would upload an image named "Ö.jpg", upload would fail. setlocale() solves this issue. This warning is echoed just in PW 3.0.53. You won't screw up your site, but it's possible that date/currency (and other locale aware) functions would produce different output.
    1 point
  30. https://github.com/processwire/processwire-issues/issues/184 If your server has Sweden locale installed (check with locale -a in shell), then you can use that, if not, try with what warning says. If you use ML put setlocale() in /site/init.php
    1 point
  31. Nice to hear others are using this technique too. For my case the emailing system we were required to use has an "editor" but it's terrible, with PW i can add condition switches in the CMS to arrange partials in the email to a particular order etc. So much potential.
    1 point
  32. Ah, thank you! That seems to be the last piece of the puzzle. The solution works for me as well.
    1 point
  33. Please see my second post - I have updated the module with that fix (actually done differently), as well as some other improvements / updates. I would recommend grabbing the latest version of the module. Cheers, Adrian
    1 point
  34. I think @ryan is unlikely to switch from region attributes in tags to a different system where regions are defined using HTML comments, considering that the Markup Regions feature is already published and currently being used in its existing form. But I do agree with your request to support a region tag that is stripped out of the final output. As you noted, that would be particularly useful for defining multiple regions inside the <head> element. There is a GitHub feature request that covers some of this stuff: https://github.com/processwire/processwire-requests/issues/78
    1 point
  35. Hmm... But #2 isn't required, it's only one of the conditions under which the file access will be blocked, so I still don't get it. I think I will post on GitHub.
    1 point
  36. I agree with you, in my sketch I adjust the margins and eliminate lines to make it more compact and clean... more contrast can help too
    1 point
  37. Hi everyone - @tpr has done a great job on changing the way the ML info tooltip is displayed - it's now part of a hidden row. Here is his screencap of it in action! This and all the other recent ML changes are now committed to Github. Please test carefully and let me know if you find any problems, and don't forget the AOS language switcher for changing between languages!
    1 point
  38. I have a pull-request for this module, pull-request adding multi language support to reCAPTCHA and multiple usage on one page. You can see usage on screenshot. For set reCAPTCHA language, (reCAPTCHA Language Codes) : <?php if(modules()->isInstalled('MarkupGoogleRecaptcha')) { echo modules()->MarkupGoogleRecaptcha->render($lang = "en"); }; ?> For multiple reCAPTCHA usage, after all form render, call multiple usage script : <?php if(modules()->isInstalled('MarkupGoogleRecaptcha')) { echo modules()->MarkupGoogleRecaptcha->getScriptMulti(); }; ?>
    1 point
  39. I do something similar, but instead of styling the page for the email, I have a separate template file for emails that builds the html for the email using tables and inline css and sends that directly to the list of subscribers. In my case, a monthly enewsletter is composed of several different articles (each a separate child page). The template for these child pages has a field to select what month/year the article belongs to. The email sending script queries matching articles, compiles, and sends. The possibilities are endless really
    1 point
  40. I like it, this new version of the admin theme is a step forward for Processwire. I'm a space fan in the design, I like when the user interface can breathe a lot, but I think it's too white or too "light" now, it's hard to see on a 27-inch monitor. I would like the color of the header bar, buttons hover and other small details can be configured in the administration, as well as the logo (keeping the height) to match the brand of our customer, this will be a great advantage. Of course the Processwire identity is maintained in the footer. I think the default color may match the Processwire website that I like and it's refreshing. The developer can customize with parameters in the administration, this can be achieved using a small css file with color codes to override some elements and this file can be generated when the profile page is modified. I was modifying some screens directly with the Chrome Inspector and this is the result. I made adjustments in the background tones, margins, colors, hiding elements like lines, etc. For example, the help paragraph that is always visible, it would be nice to display it on demand with help icon or directly by activating them in the VIEW menu. Because it is useful the first few times you use Processwire, but when you learn it only occupies an unnecessary space.
    1 point
  41. Thanks, I've added width: auto to the CSS (no version change).
    1 point
  42. Hi @Roman Schmitz - sorry about that! I will commit a fix a little later (I want to clean up some other stuff while I am at it), but for now please change: https://github.com/adrianbj/FieldtypePhone/blob/56ec89e7fc81cdc693ce72f9f9030edf3f49bd63/FieldtypePhone.module#L159 to: if($value['data_extension'] != '') $pn->extension = wire('sanitizer')->text($value['data_extension']);
    1 point
  43. Hi @adrian Perhaps slightly off topic but... I'd like to report that I had a recent differential backup that was growing rather fast, and it turned out to be tracy files in the session directory of the site. I've since excluded the offending session directory from the backup (shouldn't have been there in the first place) but it might be worth noting that the total size of all the tracy sessions files had grown into the 10s of GB. I wonder if there is any practical way Tracy could be made to cull its old session files? Best wishes, Steve
    1 point
  44. A few updates to the server type indicator ribbon: It's now possible to display it on the frontend as well. It might seem weird, but on occasion I have been looking at the frontend in the wrong tab (live vs dev) and wondering why my changes aren't doing anything You can now hide the indicator along with the Tracy debug bar when you use the hide icon. Here is the css to use if you'd prefer to have the indicator along the bottom: body::before { content: "[type]"; background: [color]; position: fixed; left: 0; bottom: 0; color: #ffffff; width: 100%; padding: 0; text-align: left; text-indent: 5px; font-weight: 600; text-transform: uppercase; z-index: 29999; font-size: 15px; height: 22px; line-height: 22px; pointer-events: none; } which looks like this rather than the default sidebar. It is of course also fixed so it always visible when you scroll.
    1 point
  45. Hi @nico Did you ever get a chance to look into this? To be able to specify a NOINDEX or NOFOLLOW on a page by page basis would be great. I know the original request on GitHub is quite old but it's still a feature that IMHO would really enhance the Module.
    1 point
  46. I'm running 0.8.7 right now and it doesn't seem like you can specify on a Index, noindex, follow, nofollow etc on a page by page basis. These setting should be showing up on the SEO tab of any page, right?
    1 point
  47. Solved it by reading how $pages->clone() does it, and just doing that.... I also see that $pages->clone() has the ability to set an argument to specify a page ID which solves my issue of cloning a page and not having the the page ID I want after the clone. //copies the fields of one page to replace the fields of another page. function copyFields ($sourcePage, $destinationPage) { //Copy Fields between pages $destinationPage->of(false); $sourcePage->of(false); foreach ($destinationPage->template->fieldgroup as $field){ if($field->type instanceOf FieldtypeTable){ //You get duplicare SQL index errors if you don't use clone. $destinationPage->$field = clone $sourcePage->$field; }elseif($field->type instanceOf FieldtypeTextarea){ //Update image an file links in rich text fields $destinationPage->$field = str_replace("/files/{$sourcePage->id}/","/files/{$destinationPage->id}/",$sourcePage->$field); }else{ $destinationPage->$field = $sourcePage->$field; } } // Copy $sourcePage's files over to new page if(PagefilesManager::hasFiles($sourcePage)) { $destinationPage->filesManager->init($destinationPage); $sourcePage->filesManager->copyFiles($destinationPage->filesManager->path()); } return $destinationPage; }
    1 point
  48. You could output a json config object using php , then it will be available in your js. before your scripts in the header: <?php $jsconfig = array( 'root' => $config->urls->root, 'domain' => $config->httpHost ); echo "<script>var config = " . json_encode($jsconfig) . ";</script>"; ?> this will output an json object <script>var config = {"root":"\/","domain":"pw2-dev.ch"};</script> you can access in js like this <script> $(document).ready(function() { $('#header').click(function(){ window.location = "http://"+config.domain;; }); $('#search_form').click(function(event){ event.stopPropagation(); }); }); url = config.root; </script> This is the most easy and convenient way for me.
    1 point
×
×
  • Create New...