Jump to content

creativejay

Members
  • Posts

    259
  • Joined

  • Last visited

Everything posted by creativejay

  1. There are 245 potential matches for any product search, but right now my largest display on any pages, the way they're called, is 37. I *do* want to offer a complete list in two spots on the site, but that didn't seem wise with the lag we were experiencing. The site has sped up considerably since my host upgraded the PHP, and PHP-FPM seems to have also been a speed boost. I'm going to be more careful with my find()s, but I'm going to be looking at how best to add those two find()s resulting in 245 back in. One can have pagination (though the pages with pagination seem to be where I got those memory errors, though I haven't investigated more at this point), but the other should be a very basic list of the pages with links to the files they contain, and the point of that page has always been a quick reference without having to click through multiple pages. But maybe I'll add a search bar to that page instead if it still loads slowly.
  2. Thanks! I'm hands-off for the moment so I don't lose anything in the account switch to allow for PHP-FPM. Then I'll take a peek at that module. You guys have saved me hundreds of hours of beating my head against my desk, and probably added a few years back to my life by alleviating stress. I can't thank you enough. With the update to PHP 7 the server is already running far faster. I was able to put back in those feat_icon_imgs that I yanked out yesterday, even! Now it's just a wait to see if there's fallout from the next step, and then I'm in the home stretch!
  3. Okay! Hosting went through each module for PHP 5.6 and installed/enabled the 7.0 equivalent. They also increased the allowed_memory size to 512M when they experienced the same issues. I'm going to have to work on the news section. I don't know if it's Pagination or my code, but that's eating up resources like Halloween candy. Okay.. that storm past, I will hold my breath and start the PHP-FPM.
  4. Now getting (silently failing) errors with FormBuilder (latest ver): Call to undefined function __() referring to this line: <html lang="<?php echo __('en', __FILE__); // HTML tag lang attribute
  5. Okay... things are starting to look stable for the moment. Someone with godlike powers is just having a good tug on me today.
  6. $this->_() corrected it in the front end. For a minute. Then I went looking for more errors in the admin, and after accessing the , I see And, as a bonus: File: /public_html/wire/core/Modules.php:2360 Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 266240 bytes) in /public_html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-master/src/Tracy/BlueScreen.php on line 217 Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 266240 bytes) (line 217 of /public_html/site/modules/TracyDebugger/tracy-master/src/Tracy/BlueScreen.php) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. I cleared my cache and sessions directory. I am running the latest stable PWire install. So I manually shut down the Siblings editor module and gained access to the back end again. Searching for more errors, now. Found some: That memory size message. Error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 21119000 bytes) (line 812 of /site/modules/PageImageManipulator/ImageManipulator02.class.php)
  7. I tried clearing my cache files and it got worse. From the front end: Error: Uncaught Error: Call to undefined function _() in /public_html/site/modules/ListSiblingsTab/ListSiblingsTab.module:12 And in the backend: 3: /** 4: * Add "Siblings" tab to page editor. 5: * 6: */ 7: 8: class ListSiblingsTab extends \ProcessWire\WireData implements \ProcessWire\Module { 9: public static function getModuleInfo() { 10: return array( 11: "title" => "Page Edit Siblings", 12: "summary" => _("Add siblings tab to page edtior"), // <--- This line 13: "version" => "0.0.1", 14: "autoload" => true 15: ); 16: }
  8. 2017-10-16 13:47:40 guest http://comnet.net/comnet-products/ethernet/media-converters/cnfe2mcpoe.html Error: Uncaught Error: Call to a member function getConfigData() on null in /wire/core/Pageimage.php:486 Stack trace: #0 /public_html/wire/core/Pageimage.php(346): ProcessWire\Pageimage->___size(300, 0, Array) #1 /public_html/site/assets/cache/FileCompiler/site/templates/product-display-superlongform.inc(25): ProcessWire\Pageimage->size(300, 0, Array) #2 /public_html/site/assets/cache/FileCompiler/site/templates/prod_series.php(2): include('/...') #3 /public_html/wire/core/TemplateFile.php(268): require('/...') #4 /public_html/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render() #5 /public_html/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___render', Array) #6 /public_html/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #7 /public_html/wire/modules/PageRender.module(51 (line 486 of /public_html/wire/core/Pageimage.php) 2017-10-16 13:51:08 guest http://comnet.net/about/news Error: Uncaught Error: Call to undefined function imagecreatefromstring() in /public_html/site/assets/cache/FileCompiler/site/modules/PageImageManipulator/ImageManipulator02.class.php:812 Stack trace: #0 /public_html/site/assets/cache/FileCompiler/site/modules/PageImageManipulator/ImageManipulator02.class.php(1968): ImageManipulator02->imLoad() #1 /public_html/site/assets/cache/FileCompiler/site/templates/news.php(69): ImageManipulator02->canvas(50, 50, Array, 'n', 0) #2 /public_html/wire/core/TemplateFile.php(268): require('/...') #3 /public_html/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render() #4 /public_html/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___render', Array) #5 /public_html/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #6 /public_html/wire/modules/PageRender.module(514): ProcessWire\Wir (line 812 of /public_html/site/assets/cache/FileCompiler/site/modules/PageImageManipulator/ImageManipulator02.class.php) 2017-10-16 13:54:34 guest http://comnet.net/comnet-products/ethernet/media-converters/cnfe1m1ms-x.html Error: Uncaught Error: Call to a member function getConfigData() on null in /public_html/wire/core/Pageimage.php:486 Stack trace: #0 /public_html/wire/core/Pageimage.php(346): ProcessWire\Pageimage->___size(600, 0, Array) #1 /public_html/site/assets/cache/FileCompiler/site/templates/product-display-superlongform.inc(180): ProcessWire\Pageimage->size(600, 0, Array) #2 /public_html/site/assets/cache/FileCompiler/site/templates/prod_series.php(2): include('/...') #3 /public_html/wire/core/TemplateFile.php(268): require('/...') #4 /public_html/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render() #5 /public_html/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___render', Array) #6 /public_html/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #7 /public_html/wire/modules/PageRender.module(5 (line 486 of /public_html/wire/core/Pageimage.php) 2017-10-16 13:55:08 (superuser in admin) Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1126400 bytes) (line 191 of /public_html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-master/src/Tracy/BlueScreen.php) These are my error logs from debug. I stripped out the /root/user portion of the paths reported.
  9. Even faster in 7.0, but now we've got some PHP errors getting thrown. Does anyone happen to know what modules, aside from pdo/mysql, might be required to be installed on the server for ProcessWire?
  10. Thanks everyone! I wouldn't have gotten this far without you. I have asked them to switch to 7.0. I will test and then ask them to enable PHP-FPM, test again. Then switch TracyDebugger into Production Mode, then enable ProCache. Then give the site a last lookie-loo, and then throw the switch. My eyes hurt! ETA: Without any of the above being completed, the site is loading faster for a guest. A very good sign!
  11. Okay, my host is prepared to enable PHP-FPM on my say-so. PHP has been upgraded though the active version is currently 5.6. Is there an ideal PHP version, for the current release of PW3.x? And should I be aware of anything before requesting PHP-FPM be enabled? I've been asked "if I'm sure" and that's giving me heart palpitations (that and all the coffee that kept me going through this mess all weekend).
  12. No, I am using the TracyDebugger bar that loads for the superuser. I implemented that code and the first instance took the expected 1240 ms, while the second instance (the original call on the page) then took .6 ms. The pages still load somewhat slowly in the second browser I have open (where I am not logged in). I currently have ProCache disabled while I try to suss this out. Does this mean ProCache will provide similar caching to the code you offered, or should I still go through and force cache the common id lists?
  13. Checking times in Tracy, I see (not that surprising) that my selector for locating the products on the site is a bit of a hog: Not surprising, since a lot of the pages that hit this slowdown contain a similar $pages->find() call. Which is the largest offender here? That it's returning 245 results, or that it would technically be checking every page in the tree for that template and status? I added a has_parent=1048 to confine the search to the Products section, but that only improved the timestamp to 1240.6
  14. That's the cat with the short tail, right? XD (In other words, I have zero linux skills)
  15. Oh, okay a new reply without my prompting (I do love this host's support response): Anything I need to be aware of if I have them install PHP 7?
  16. Thank you szabesz, I asked my host about it and the response was "what did you have in mind?" They did offer to install litespeed and provided this information on what it offers: https://www.a2hosting.com/kb/a2-hosting-products/turbo-web-hosting/differences-between-turbo-and-swift-servers To those of you who understand this better than I, would this be worthwhile for a monthly fee, or are these largely improvements I can handle with PWire modules? I will play around with the timestamps this morning now that my files are in their final resting place, before I must throw the switch later today.
  17. Eliminating the prod_feat_imgs call from the foreach did seem to speed things up, but not to the near-instant page loads I've come to expect. I really hope I can improve performance from the scripting and that I don't need to find a new host. I'm developing on a managed VPS account, in a subdirectory. To answer your question, abysmally slow was 26 seconds or more per page (and if the images were being rendered afresh, up to four minutes, including a time-out and a reload to finish processing them).
  18. Thank you both very much for taking the time to reply and help me out. abdus, thank you very much for the rewritten code. I begin to see what you mean. Thankfully, in this case, I am the client. I am building this site for my day job, and I know a bit about the number of products that typically are added in any given year (generally no more than 5). On the individual product categories, (organized by the product templates' placement in the page tree), right now the maximum number is 37. While that section will grow, my main concern is the speed of the pages upon which every product is listed for the convenience of someone (most often, myself) who needs to reference something quickly. The site needs to launch last year (of course!), so while I figure this out I will likely keep such bloated pages unpubbed so I can work to improve their performance before I make them public. I'm self-taught, and this is the most complicated (in terms of interlinking pages) that I've ever created a site. I had no idea it was going to so greatly impact performance to loop it the way I have until the information was already populated and I saw the results of the foreach. The reason that I have the prod_feat_imgs in a Repeater field (as a page reference) is that I've got ~45 icons that appear both in the category list and on the product pages themselves. These have default value captions (in the referenced page's title field) which occasionally need to be overridden per product (for example one boasts of operating temperature range and in 85% of cases is one value (set in the 'page-select-option' page along with the icon) but in other cases will need to be overridden. So prod_feat_imgs is a repeater which includes a page reference (prod_feat_ and a textfield to override the referenced page's title. I have set up the product templates with a large number of getPage fields (and a whole hidden section of the page tree dedicated to universal options to choose from, for the same reason as above: future proofing). Thankfully not that many are built into repeaters (I started to realize what a wicked web I'd woven as I tried to get the repeater information into the markup but didn't realize it taxed PW to run as much as it did me to code). Many, however, are multi-select. In the case of prod_feat_imgs, I will periodically need to go in an update the entire list of 45 images if we redesign them. It seemed future-proof to update them on 45 pages rather than track them to separate image fields across potentially 200-300 product pages. So, all that was to explain my thought process in why I'm not putting the Image field directly in the product template fieldset. It doesn't seem that Image Extra would help me in this use case. If you have another suggestion to how to approach this, I am open to hearing it! Right now the best alternative I can come up with is to take the page reference (prod_feat_iconpages) out of the repeater and just add additional pages to that section of my page tree for the variations. This will become ungainly in the future, though, as cases like the temperature example would require a new entry for a minor variation in spec. I'm planning further updates to the site (the full improvement list I intended to be ready for launch, but there was too much data entry required for the time allotted), and this image's caption could be overridden by the actual specification for temperature, for which I was planning to use a table field on prod-series' children pages, prod-model (this promises another headache of markup looping. I'm almost glad I didn't have time to include this in the current launch). I am using ProCache currently. I thought ProCache handled the basic functions of WireCache and extended them. Am I mistaken? Thank you, I will adopt this practice going forward. Thank you. I did want to look into these (having seen them in sample code) but didn't have the vocabulary to search for them! (The worst part about being self-taught). Yes, thank you. I write it into the HTML elements while I'm fussing about with the templates, then migrate them over into my referenced css file. But it would make my life easier to at least structure it the way you did in the rewritten code. Thank you. I'm not sure on the direct takeaway of that thread (I did find it before I posted this one). Are you suggesting switching to AJAX/JSON or using the MySQL monitor? This is the most complicated site I've ever designed, and I was under the impression that, as long as I refined my queries down as much as I could (using get instead of find wherever possible), that the query was not a terrible drain on the process, and that this was the PW advantage over other CMS. Obviously, I need to reapproach my thinking on the matter. Yes, and this was my red herring. As I adjusted image sizes in the template markup, I fully expected the delay. It was only when I finished and the page was still slow that I realized there was another, probably more fundamental, problem with my coding.
  19. I'm displaying a list of products which are found by their templates, but the pages are taking a very long time to load. At first, I blamed it on my image rendering (using PIM2), but even with all those images now stored in the file tree, the page is taking abysmally long to load. ProCache seems to help but I don't feel as though what I'm trying to do should be gnawing the bones of my resources quite so long. The variable for the selector is defined in my header include: $productCatList="prod_series|prod_series_ethernet|prod_series_access|prod_series_accessories|prod_series_fiber|prod_series_pwr_supplies|prod_series_pwr_systems|prod_series_wireless"; $getCurrentProdOptions="template=$productCatList, prod_status_pages!=1554|1559|1560|4242"; Then in the template for the page upon which the directory loads: $products = $pages->find("$getCurrentProdOptions"); include_once("./prod-list-row.inc"); echo $out; And the prod-list-row.inc foreach (which is on every page that's exhibiting the slowdown): <?php $sum = 0; $out =""; $out .= "<div class='span_12_of_12'>\n"; foreach($products as $p){ $sum += 1; if ($sum % 2 == 0) { $bgcolor = '#fff'; } else { $bgcolor = '#e4e4e4';} $par = $p->parent; $out .="<div class='section group' style='background: $bgcolor ; min-height: 110px'>\n"; $img = $p->prod_image; $thumb = $img->pim2Load('squarethumb100')->canvas(100,100,array(0,0,0,0),'north',0)->pimSave()->url; $out .="<div data-match-height='{$p->title}' class='col span_2_of_12 hide'>"; $out .="<a href='{$p->url}'><span class='product-image-box'><img src='{$thumb}' alt='{$p->title}' title='{$p->title}'></span></a>"; $out .= "</div>"; $out .= "<div data-match-height='{$p->title}' class='col span_6_of_12'>"; $out .= "<div class='prod-list-name-label'><a href='{$p->url}'>{$p->title}</a></div>"; if($page!=$par) { $out .= "<div class='prod-list-category-label' style='font-size: .7em;'>Category: <a href='{$par->url}'>{$par->title}</a></div>"; } $out .= "<div class='list-headline' style='font-size: .8em;'>{$p->headline}</div>"; $out .="<div class='learn-more-buttons-sm'>"; $out .="<a href='{$p->url}' title='Product Specs and Documentation'><span class='find-out-more-button' style='font-size: .8em;'><i style='font-size: .8em;' class='fa fa-lightbulb-o' ></i> &nbsp; Learn More</span></a>"; $out .="</div>"; $out .="</div> \n"; $out .= " <div data-match-height='{$p->title}' class='col span_4_of_12'>"; if(count($p->prod_feat_imgs) >0 ){ $out .= "<div class='featured-icons-list' margin: 2em .5em;'>"; foreach($p->prod_feat_imgs as $feat){ $icon = $pages->get("$feat->prod_featicon_pages"); if($icon->image) { if($feat->prod_feat_textlang) { $icontitle = $feat->prod_feat_textlang;} else {$icontitle = $icon->title;} $out .= "<img src='".$icon->image->size(35,35,$imgOptions)->url . "' alt='" . $icontitle . "' title='" . $icontitle . "' class='listing-feat-icon' style='margin-right: .5em;' />"; } } $out .= "</div>"; if($p->prod_product_line){ foreach($p->prod_product_line as $pline) if($pline->image) { $out .= "<div style='height: 35px;'>\n"; $out .= "<img src='{$pline->image->size(75,35,$imgOptions)->url}' alt='{$pline->title}' />"; $out .= "</div>"; } } } $out .= "</div>"; $out .="</div>"; } $out .= "</div>"; Is there a clear culprit here of what I'm doing that's so stressing the system? I turned off TracyDebugger because I saw another thread about that causing slowdown (even though I'm using the latest), but that had no effect. Every time I thought I found the culprit and commented it out, nothing changed. Would appreciate some more eyes on this. Thank you! ETA: prod_feat_imgs is a repeater field which contains a Page reference field (from which I pull the image and title) and a multilanguage textfield (to override the page reference title if it exists). Could that be the problem?
  20. $field = []; $childrenByField =[]; foreach($children as $child) { $tableCount = count($child->prod_vid_bandwidth); if($tableCount>0) { foreach($child->prod_vid_bandwidth as $item) { $value = number_format($item->band_lo,1,'.',''); $field[$value][] = $child; } } } foreach($field as $f => $items) { $childrenByField[] = "$f"; } if(!empty($childrenByField)) $prod_vid_bandwidth_lo = implode(" OR ", $childrenByField); $field = []; $childrenByField =[]; foreach($children as $child) { $tableCount = count($child->prod_vid_bandwidth); if($tableCount>0) { foreach($child->prod_vid_bandwidth as $item) { $field[$item->lo_unit][] = $child; } }} foreach($field as $f => $items) { $childrenByField[] = "$f"; } if(!empty($childrenByField)) $prod_vid_bandwidth_loU = implode(" OR ", $childrenByField); $field = []; $childrenByField =[]; foreach($children as $child) { $tableCount = count($child->prod_vid_bandwidth); if($tableCount>0) { foreach($child->prod_vid_bandwidth as $item) { $value = number_format($item->band_hi,1,'.',''); $field[$value][] = $child; } }} foreach($field as $f => $items) { $childrenByField[] = "$f"; } if(!empty($childrenByField)) $prod_vid_bandwidth_hi = implode(" OR ", $childrenByField); $field = []; $childrenByField =[]; foreach($children as $child) { $tableCount = count($child->prod_vid_bandwidth); if($tableCount>0) { foreach($child->prod_vid_bandwidth as $item) { $field[$item->hi_unit][] = $child; } }} foreach($field as $f => $items) { $childrenByField[] = "$f"; } if(!empty($childrenByField)) $prod_vid_bandwidth_hiU = implode(" OR ", $childrenByField); unset($tableCount); Here's the code that finally output my table fields. Note that my floats were being converted to integers so I had to force the display of their decimal places with number_format(). Originally, I hoped to cycle through the fields and output standardized strings of HTML based on their type and structure, but in the end I am omitting too many fields, and need to specialize the output code a little too much to make that feasible. So I am working my way through 170 fields, but hopefully this will put me ahead in this project when I'm done (toward integrating a Pages2PDF tie-in from these fields later), rather than being as behind as I feel! Thanks so much to everyone who chimed in to give me a hand!
  21. Thanks for this, I will definitely be putting it to use!
  22. Thank you abdus, this seems to be what I need. I am working on getting the output exactly as I want it, per the example array to string above, but I can confirm that it build an array containing the information I need!
  23. Thanks for taking a look, abdus. prod_vid_bandwitdth is a table. band_lo is an integer column in that table. I was showing everything I tried in the above. -> did not work, either.
  24. I think this is an API question more than a PHP one. I have a repeater and several tables, and I cannot seem to access the fields I want. The following code throws no error but $prod_vid_bandwidth_lo is empty: $field = array(); $childrenByField = array(); foreach($children as $child) $field[$child->prod_vid_bandwidth->band_lo][] = $child; // <-- THIS LINE foreach($field as $f => $items) { $childrenByField[] = "$f"; } $prod_vid_bandwidth_lo = implode(" OR ", $childrenByField); While the following reference outputs an error calling band_lo an undefined constant: $child->prod_vid_bandwidth.band_lo And this gets us back to no error but no output: $child->prod_vid_bandwidth->get("band_lo") How do I access, in the context of this code, the content of a field within a FieldtypeTable or FieldtypeRepeater of the child page? Thanks so much! I'm almost there! (and for the record I decided not to iterate through the fields and try to define them based on fieldtype... I'm going through the fields manually, and it's shaved time off the load. Wish I'd just sucked it up and did that way back when I first started. Spent a lot of time beating my head over how to do this with a minimum number of foreach loops.)
  25. Thank you very much! That's working. Next step: figure out how to output values other than integers and strings.
×
×
  • Create New...