Jump to content

Peter Falkenberg Brown

  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Peter Falkenberg Brown

  1. Hi Ryan and All, I've been using a Perl script called "SimpleForm" that I've written and updated over the years. One reason I like it is because I created pre-processing and post-processing functions that allowed me to add any type of custom code I wanted to do, either before the data was processed as a submit, or afterwards. However, it doesn't fit into the PW framework, since it's in Perl. Thus, I'm exploring buying Form Builder, but in reading the feature list, I couldn't quite get whether it allows this type of totally customizable, code-able pre and post processing. I might have missed that, but can someone let me know if Form builder has that functionality? Also, I want to be able to collect and save data, then send someone to the free PayPal site, and then have the person return to a PW page where the form data can be updated "as paid." Has that been done with Form Builder? Thanks! Peter
  2. Hi Macrura, You are exactly right. I don't remember placing this line in the module backend data field "Default Link to XSL Stylesheet" "/site/templates/styles/rss_feed.xsl" but it was there. So, I removed it, and then uncommented the line in the module, and all was well. I suppose I could have placed that value in the data field: I just don't remember doing so, and never had that file on my system. Oh well... mystery solved, and the module has no error. It was human error! Oy. Ugh. Thank you VERY much for clarifying this. Peter
  3. Hi Dragan, Yep, that worked. This is the line that I had to comment out: /* if($this->xsl) $out .= "<?xml-stylesheet type='text/xsl' href='{$this->xsl}' ?>\n"; */ This would be a good thing to fix in the module, I do believe. This is one of Ryan's core modules, I think. Thanks! Peter
  4. Hi Ryan and Team, I'm using the module "RSS Feed Generator" v1.0.2, in PW 3.0.42. (I'm going to upgrade when 3.1 comes out.) I just noticed that my rss feed here: http://significatojournal.com/rss/ doesn't display anything in Chrome (but works in Firefox). (The source xml is being generated.) I also saw that Chrome requires an RSS extension to display RSS: https://chrome.google.com/webstore/detail/rss-feed-reader/pnjaodmkngahhkoihejjehlcdlnohgmp?hl=en so I installed it, but still nothing. I then went to the NY Times and saw that their feed worked in Chrome *if* the extension was installed. I compared the raw xml at the NY Times against the raw xml in my feed, and saw a significant difference. However, since the xml is generated by the module, I didn't really want to mess with it. Here are the two snippets from the headers. (The rss tree looks similar -- it's just the first set of declarations that look different.) RSS FEED GENERATOR AT SIGNIFICATOJOURNAL.COM: <?xml version='1.0' encoding='utf-8' ?> <?xml-stylesheet type='text/xsl' href='/site/templates/styles/rss_feed.xsl' ?> <rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'> NY TIMES FEED: <rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:nyt="http://www.nytimes.com/namespaces/rss/2.0" version="2.0"> I believe that the module should be modified, for Chrome support. Any thoughts? Thanks! Peter
  5. Dear Abdus, That worked! Thank you! Really appreciate help from you, and BitPoet, and OF COURSE, Ryan and team for making such a great CMF! Peter
  6. Hi Abdus, Thanks.... I tried that based on your comment, and I got this error: Error: Class 'Page' not found... Peter
  7. Dear BitPoet, Thanks very much for this! I could just feel in my bones that I had forgotten something wonderful about PW. I think I saw that blog post in my email when it came out, but then the info didn't stick in my brain. I'm able to read the data from "DOMAIN_1" but when I try to save it into DOMAIN_2, the page object still belongs to DOMAIN_1 and gets saved into that domain. I have some generic code below. # FileCompiler=0 require('/home/DOMAIN_1/public_html/wire/core/ProcessWire.php'); $DOMAIN_1_site = new \ProcessWire\ProcessWire('/home/DOMAIN_1/public_html/', 'http://DOMAIN_1.com/'); $DOMAIN_1_selectors = "SELECTORS HERE"; $DOMAIN_1_results = $DOMAIN_1_site->pages->find("$DOMAIN_1_selectors"); foreach ( $DOMAIN_1_results as $DOMAIN_1_result ) { $DOMAIN_1_url = $DOMAIN_1_result->url; $DOMAIN_1_name = $DOMAIN_1_result->name; . . . more fields here . . . #........................................................................ ### CODE HERE TO INSERT DOMAIN_1 PAGE INTO DOMAIN_2 $DOMAIN_2_site = new \ProcessWire\ProcessWire('/home/DOMAIN_2/public_html/', 'http://DOMAIN_2.com/'); $DOMAIN_2_new_page = new \ProcessWire\Page(); # THIS BREAKS: $DOMAIN_2_new_page is still attached to DOMAIN_1 # and gets saved into the domain 1 database. . . . more code here . . . } Any help is much appreciated. Seems like I'm not properly initializing the vars for DOMAIN_2. Thanks! Peter
  8. Dear PW Gurus, I searched and didn't find this answer -- hope I didn't miss something. I have 3 production installations of PW on my server --- 3 different domains. I'm developing a PHP script that will run from the shell prompt, and pull a certain number of pages from domain A, and then insert those pages into domain B and C. (The field template structure is identical between the 3.) My script starts by connecting to the PW installation for domain A by using this include: include("/home/USER_DIR/public_html/index.php"); which of course connects the script to that particular database. (All 3 domains use a separate DB and separate installation of PW.) Install A uses PW v3.0.61 running under CentOS. I think I'm missing some wonderfulness in PW, but I'm stumped over how to take the data from A and then do an include statement to the B install (to insert the pages into B) and then do the same thing with C. I would think that the second statement: include("/home/USER_DIR_B/public_html/index.php"); would conflict with all of the variables, etc that are pulled in with the first include, and then so on, with "C." Is this a perfect examples of why someone should use name spaces? I admit that I've never used them, so I'm at the bottom rung of knowledge about the syntax, etc, to do that. The script is truly uncomplicated, otherwise, ie. - read 3 or 4 pages worth of fields into variables - insert them into B and C's installations. - done. Any thoughts? I'm running this script as root, (which I've done with the "A" part, so that the permission issue would not be a problem. Thanks in advance for any help! Peter
  9. Dear Robin and BitPoet, Wow!! This is why I love ProcessWire. The details above are exactly what I need. And of course it was already there --- I just hadn't kept up to date with all of the new documentation, during the last couple of years when I was focused on other projects besides PW app development. So... gotta catch up. Thanks to you both! Peter
  10. Hi Robin, Thanks... that code is clear and understandable. I think I'm a bit stuck on the fact that I'm not using template files with this app --- I'm only accessing the data from the admin pages, so unless I'm missing something, I would think that the code above would have to be incorporated into one of the admin template files. Is that correct, and if so, any thoughts on which one? One of the downsides of copying out the admin template files to the site directory, in my opinion, is that the default admin template files get overwritten on certain updates. Kind of messing with the core, in my opinion. I think it would be really cool if PW had an add-on module which could define a calculated field like this. Or even make it a special "calc" field type. Yours, Peter
  11. Hi Robin, Although I've built large front end apps with PW's API, I've never tried to modify the admin back end. Based on the interface that it has, I'm under the impression that one would have to modify the files under wire/templates-admin, or make a copy of the admin template into the site folder and modify code there. Do you have any tips on the best way to achieve your idea above? Are there any examples of this type of Pages::saveReady call that you know of? Thanks! Peter
  12. Hi All, I might have missed something, but I couldn't find this... I'm looking for a field type that will calculate a result based on numeric values in other fields in the same page, and store the data when the page is saved, and update it when the values change. (Rather than just displaying the values dynamically at run time, although I suppose that would be better than nothing.) I.e. "order_total" = "quantity" * "unit_price." with order_total being the calculating field type. Of course, I could write template php files that do this, but I'm trying to wrestle with the 3.x admin pages to essentially record data for an ordering system that will only be used by internal staff, so that I don't have to design a complete front-end for the system. I've got the customer field set, and the items, and the sales (i.e. "orders") pages set up. I'm trying out the repeater field to handle multiple items in one order, i.e. 4 copies of this, 10 copies of that, all pulled with page select fields from the items "table." (Rather than create one page for each "order item".) Most orders won't have more than 1 or 2 items, and I think they would max out at less than 10 order items. A native "calc" field type would help tremendously, or an admin spot to tell a float field to run a php file when saving or updating the page, that would do the calculations, would also work. Thanks! Peter
  13. Thanks, Robin, for that explanation. The # FileCompiler=0 declaration was in only one file. Also, my other site didn't have this problem. I wonder why... I thought I read somewhere that you could include the namespace declaration in the top include file, so I tried that in the controller file listed above, but it didn't work. But... in any case, adding that declaration did fix the issue. Thanks, again! Peter
  14. Dear Robin, That resolved it. Thanks! However, I'm curious: the other 3.0.61 site works fine, without that namespace declaration. Any thoughts on why that might be so? Also, all the files in my system are include files, running off a controller file. All of the field templates are defined to pull up this file: custom_template_controller.php, which then pulls up various page files, like 'home.php', 'section.php', 'article.php', etc. Those top level includes then include around a dozen or more smaller include files, like the menu, the header, etc, etc. I'm wondering why the menu file choked, but the other includes did not. Because of the Hook code? Here's the code in the top control file: <?php include("./inc_vars.php"); include("./inc_functions.php"); #.................................................................... # block future publish dates; don't block home page (id 1) if ( ( $page->id == '1' ) || ( ! empty( $publish_date ) and $publish_date <= $now ) ) { # page can be displayed } else { throw new Wire404Exception(); } #.................................................................... include("./$custom_template_file"); Thanks for your help! Peter
  15. Hi All, I copied a 3.0.42 site to a new domain, and then upgraded it to 3.0.61. All was well. After finishing that domain, I copied the new 3.0.61 site to a new domain, and modified all of the variables, settings, etc, as normal. When I went to the home page, I got this error: Recoverable Fatal Error: Argument 1 passed to menu_post_process() must be an instance of HookEvent, instance of ProcessWire\HookEvent given, called in /home/USER/public_html/wire/core/WireHooks.php on line 777 and defined (line 80 of /home/USER/public_html/site/templates/inc_create_menu_mobile.php) I saw that error once before, in 3.0, when I tried to put a file compiler false directive in config.php. That was solved when I placed this directive: # FileCompiler=0 in a php file in my home dir. That is, it had nothing to do with the menu code at all, but it was affecting it. That fix still exists, and none of this happened on my first 3.0.61 site that I copied *from*. That earlier issue is documented in this post: I'm wondering if it's something in 3.0.61 that got screwy because I copied the site. I deleted the cache, and sessions, to no avail. In fact, I deleted the code that even uses the above php file that has the FileCompiler directive in it. The pages load fine when I comment out the menu. The menu uses the MarkupSimpleNavigation module. The menu file has this code in it: function menu_post_process(HookEvent $event) { $page = $event->arguments[1]; $new_code = $event->return; # check for open_in_new_tab if($page->open_in_new_tab) { $new_code = str_replace('href=','target="_blank" href=', $new_code); } $event->return = $new_code; } I'm stumped. Thanks for any help! Peter
  16. Thanks, LostKobrakai, My form has a function in a file in the template directory that includes a captcha php file in the /home/USER directory. When I placed: # FileCompiler=0 at the top of the included php file (the one in the /home/USER directory), the error went away. The problem must have been that FileCompiler went to work on the included php file in the home directory and then tried to click through the other subdirectories in the home directory. If I had moved that file to the site/template directory, it might not have had that problem (I presume). I didn't test that because the declaration above fixed it. Thanks for your help! Peter
  17. Dear All, I'm hoping this is just a 3.x config tweak. But as it stands, 3.x has broken my embedded html forms, which is a real problem. I really, really don't want to roll back or go with 2.8. Hoping for genius input.... Peter
  18. Hello PW Gurus: I just upgraded my site from 2.7 to 3.0.42. I thought all was well until I went to a couple of pages that had embedded forms. I embed them by a hand-rolled method like Hanna code. I have a field called "code_block1" in which I place the html form, and then in the body / rich text field, I add a tag: {{code_block1}} and then replace the tag with the code at run time. Under 3.0.42, I get this error: Error: Exception: DirectoryIterator::__construct(/home/USERNAME/.checkers/): failed to open dir: Permission denied (in /home/USERNAME/public_html/wire/core/FileCompiler.php line 817) The form references a few Perl and HTML files that exist in the public_html dir and above it. (e.g. the form action is a .cgi script in public_html.) I thought perhaps it was because the form referenced the parent "home" dir above public_html, but when I changed the ".." syntax to "." it still failed. So, I removed the form from the code block field, and the page worked. The error above references what looks like an anti-virus directory (".checkers"), which is owned by root (600). Thus, PW couldn't get into it. However, there are a number of other dirs in the home directory that are also owned by root (it's a cpanel box), so I don't think it's specific to the ".checkers" dir -- it's simply choking on a root only dir in the home directory. I think the issue is that FileCompiler.php is trying to iterate above the public_html dir, which it shouldn't, in my opinion, but is doing so because of of file paths in the form. Not sure... I tried adding FileCompiler=0 in a comment in the template, but I got an error that the directive had to be at the top of the script. I use a whole bunch of include files for headers and footers, etc, and wrap around templates, so that I can have a few unique templates for the "middle" of the pages, so if I put the directive at the very top, it will not compile any of the templates. I tried adding $config->templateCompile = false; to the config.php file, but then I got this error, from a menu template: Recoverable Fatal Error: Argument 1 passed to menu_post_process() must be an instance of HookEvent, instance of ProcessWire\HookEvent given, called in /home/USER/public_html/wire/core/WireHooks.php on line 625 and defined (line 80 of /home/USER/public_html/site/templates/inc_create_menu_mobile.php) The menu file uses MarkupSimpleNavigation. On line 80, I have this function: function menu_post_process(HookEvent $event) { $page = $event->arguments[1]; $new_code = $event->return; # check for open_in_new_tab if($page->open_in_new_tab) { $new_code = str_replace('href=','target="_blank" href=', $new_code); } $event->return = $new_code; } The menu works fine until I add the template compile directive to the config.php file. I realize that the menu issue is a secondary issue -- I think. So, I'm stumped. I need to use a variety of forms, so I can't abandon them. Thanks for any help! Peter
  19. Thanks, Adrian! I pulled the values out of the config.php in wire, and used those, with some tweaks, and the errors went away! I'm so delighted with ProcessWire I could just dance a jig. Peter
  20. Hi Folks, Not sure if this should be a new thread or not, but since this is related to the Pageimage file, I thought I'd post it here. I just upgraded to PW 3.0.39 on a staging domain. The only error I've seen so far (with debug=>true) is when I click on the Files menu. At the top of the page, I get 4 or 5 of these errors: Notice: Undefined index: sharpening in /home/... path .../public_html/wire/core/Pageimage.php on line 506 I'm running on CentOS with PHP 5.6.27. Yours, Peter
  21. Dear Rick, Thanks for your help! Two or more heads are better than one. Happy New Year. Peter
  22. Dear All, I simplified the method above, and instead of using the figure / figcaption method, I used a single <div> with the class "caption_left". Then, I placed a <br> code after the image, and pasted the caption after that -- all in the same div. It seems to work quite well in FF, IE, Chrome, and Opera, except that the width of the div has a delay in its adjustment until the image fully loads. I used a combination of CSS and JQuery code to make the div width the same as the image, so that the captions would follow the image width. Because there's no child div to mess with (i.e. figcaption), the vertical div overwrite issue is no longer a problem. Here's my code. CSS: .caption_left { float: left; max-width: 50%; height: auto; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 0.7em; color: #003333; font-style: italic; font-weight: normal; text-align: left; line-height: 1.5em; margin-right: 10px; } JQuery: <script> $(window).load(function() { $(".caption_left").each(function(){ image_width = $( this ).find("img").width(); $( this ).width( image_width ); }); }); </script> [EDIT] Because I have both a caption_left and caption_right style, I changed the JQuery to use a wildcard for "caption_": <script> $(window).load(function() { $('[class*="caption_"]').each(function(){ image_width = $( this ).find("img").width(); $( this ).width( image_width ); }); }); </script> [END OF EDIT] [sECOND EDIT] I used the above method on a complex page of images with long captions, and sidebar divs which had images and captions inside them. All worked well, except that at the end of the image resizing, my page had blank spaces at the bottom of the main content column, because the images inside the column had resized upward. Adding a window.resize command fixed it, thus: <script> $(window).load(function() { $('[class*="caption_"]').each(function(){ image_width = $( this ).find("img").width(); $( this ).width( image_width ); }); $(window).resize(); }); </script> [END OF SECOND EDIT] Then, in site/modules/InputfieldCKEditor/mystyles.js, I added the two caption styles so that I could easily apply that style to a div in the body field, into which I would add the image: CKEDITOR.stylesSet.add( 'mystyles', [ { name: 'Caption Left', element: 'div', attributes: { 'class': 'caption_left' } }, { name: 'Caption Right', element: 'div', attributes: { 'class': 'caption_right' } }, The only gotcha that I can see is that when the images have long captions, the div widths take a moment to adjust down to the image widths, after the images load. * Anyone know how to make that faster? * Any thoughts on the solution above? => I also noted that my previous figure/figcaption styling messed up the magnific-popup styles that I used, based on this post: http://processwire.com/talk/topic/5260-how-to-hack-core-or-hook-to-add-classinputfieldfilelink-to-inserted-images-that-link-to-larger-versions/#entry50703 ... suggesed by Martijn and Teppo. So, I deleted my figure / figcaption styles, and the popups went back to normal. Peter
  23. Dear Martijn and Rick, Thank you both for your input. Rick: I don't want to force images to be a certain size just to make things responsive - I'd rather use a system to match the caption block to whatever size the image is. - I tried my very first JQuery routine, and it kind of sort of works in Firefox, but it breaks in Chrome, with one image not working at all, and one image quirky. If you search on the word "Carl" and then "Richard", you'll see that I moved two images to the "figure" method. (The Carl image has the grey caption: "Carl Falkenberg Brown, (Peter's Father; during WWII)".) I added a yellow background to the figures, and a grey background to the caption, to see things better. Here's my code. I made the figures 50% max-width, so that they didn't scrunch the wrap-around text into a tiny column for small devices. CSS: figure { position: relative; max-width: 50%; background-color: yellow; } figure img { max-width: 100%; display: block; width: auto; height: auto; } figure figcaption { position: absolute; width: 95%; max-width: 95%; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 0.7em; color: #003333; font-style: italic; font-weight: normal; text-align: center; line-height: 1.5em; padding-top: 3px; padding-bottom: 3px; padding-left: 2.5%; padding-right: 2.5%; margin-bottom: 5px; background-color: #F0F0F0; } Here's the JQuery, loaded in the <head> section, looping through all "figure" elements: <script> $( window ).ready(function() { $("figure").each(function(){ child = $( this ).children("figcaption"); figure_height = $( this ).height(); figcaption_height = child.height(); $( this ).height( figure_height + figcaption_height + 10 ); }); }); </script> I tried the "resize" event instead of "ready", but it created what looked like a cascade of ever-growing heights - perhaps because of the frequency that resize is triggered? So, then I used "ready." Again, this is my first stab at Jquery, so I'm probably missing something. But it seems like it might be going in the right direction.... Maybe? Yours, Peter
  24. Dear Rick, Thanks for this effort! At first, it seemed to be the answer, but I discovered that it only works when the percentage of max-width is smaller than the image in relationship to the page. For example, I changed my CSS to: figure { max-width: 50%; } and then, when I view the Richard image at full desktop size, the caption text goes out to the 50% width, leaving the image at its native, smaller width. Even if I used 25%, it wouldn't work if the image was only 20% of the width of the page. But... you were close! Peter
  25. Dear tpr, In Firefox it looks like it worked because of the combination of inline-block in the figure and display: table-caption; in the figcaption. But yes, in Chrome, the caption has a weird right hand margin that takes up 1/2 the space of the cell. I suppose media queries might do something, but the other solution would be to dynamically assign figure heights (or div heights) by using javascript. I think. I'm amazed that this hasn't been solved in responsive-web-design land already. Thanks for your help on this... If anyone else has light bulbs going off, I'd love to hear about it. Peter
  • Create New...