joer80

Members
  • Content count

    225
  • Joined

  • Last visited

Community Reputation

69 Excellent

About joer80

  • Rank
    Sr. Member

Contact Methods

  • Website URL
    http://www.webprojoe.com

Profile Information

  • Gender
    Male
  • Location
    Texarkana, TX

Recent Profile Visitors

2,428 profile views
  1. Yeah, from what I understand, Any number of different ec2 servers could all run the processwire files and serve users with apache or nginx but connect to one file system for assets and one database. (Aurora and EFS are both fully managed and fault tolerant so ec2 would be stateless.) 100 gigs of EFS is about $30 per month with unlimited requests and bandwith, so no additional charges.
  2. Have you tried using EFS? https://aws.amazon.com/efs/?nc2=h_m1 Turning on cloud front is also an option to speed things up.
  3. has anyone tried this yet? https://bitnami.com/stack/processwire
  4. I found it! Posting for future people. http://cheatsheet.processwire.com/pagearray-wirearray/setting-and-modifying-items/a-removeall/ http://cheatsheet.processwire.com/pagearray-wirearray/setting-and-modifying-items/a-remove-key/
  5. I have a template that has a page field that holds several pages, and I have it working that I can add pages to its page field via api, but how do I remove a page without deleting the page it is linking to? Just unlink it? This is how I am adding it: $pagetoadd = $page->id; //Add page to a page field on 123 $p = wire("pages")->get("id=123"); $p->setOutputFormatting(false); $p->pageFieldExample = $pagetoadd; $p->save(); How would I remove one? Or even remove all and add back what needs to stay?
  6. I think I found the answer.. Instead of using page, you just use pages. It can be at any depth. return $pages->find('parent='/pathofparent/');
  7. When creating a page field that uses Custom PHP code to find selectable pages , the example shows this: Return $page->parent->parent->children("name=locations")->first()->children(); It seems this only works if your page is at a specific depth in the page tree that matches the number of parent-> listed here. If you move the page up a level or down a level, the select will break. Is there a way to return a page array without a specified depth?
  8. I am in a module that is hooking before page save so maybe it would be best if I leave output format off? I am wondering if processwire is expecting that? I dont mind treating it like an array as long as it is expected behavior and not a bug that will be fixed later! Thanks for all your help!
  9. I was able to use output buffering and get it to: result: bool(false) ob_start(); var_dump($page->of()); $result = ob_get_clean(); $event->message("result: " . $result);
  10. var_dump($page->of()); doesnt seem to do anything. If I take off the "->of()" it will print out the page info.
  11. I do further down the page. This is the flow. addHookBefore (save) $event->message("background-image: " . $page->BackgroundImage->url); //Gives background-image: /site/assets/files/1312/ addHookAfter (save) setOutputFormatting(false); (save a different page)
  12. That is what I would have thought also, but it is set to "Single Item (Null if empty)" with 1 as the max images. Looks like it is returning an array no matter what I do.
  13. When I do $page->BackgroundImage->url it gives the path without the filename. Is that normal? I was thinking it gives both. If I do $page->BackgroundImage->url . $page->BackgroundImage I can get it to show both. What am I doing wrong? Thanks!
  14. Here is the version that drops the Themes All Merge field and makes a file instead. (Each page still has a css cache field.) I am using a timestamp on the css filename for cache busting. That way you can set a 6 month time frame on css files and bust out every page save. <?php class CacheThemeCSS extends WireData implements Module { public function init() { $this->pages->addHookBefore('save', $this, 'updateMyCachedCSS'); $this->pages->addHookAfter('save', $this, 'updateThemeCachedCSS'); } //Update the Cached CSS of the page I am on. public function updateMyCachedCSS($event) { //ini $CachedCSS = ''; //Update CSS Cache for page I am on $page = $event->arguments(0); //Prepare CSS for this page $CachedCSS .= '/* ' . $page->title . ' CSS Start */' . "\n"; //Load Item Styles if given if($page->Styles){ $CachedCSS .= '#' . $page->template . '-' . $page->id . '{ ' . $page->Styles . '}' . "\n"; } //Load CSS File Additions if given if($page->CSSAdditions){ $CachedCSS .= $page->CSSAdditions . "\n"; } $CachedCSS .= "\n"; if($CachedCSS){ $page->CachedCSS = $CachedCSS; } } //Update the Themes CachedCSSFilename and make file public function updateThemeCachedCSS($event) { //ini $CachedCSS = ''; //Get all CachedCSS styles $results = $this->wire('pages')->find("CachedCSS!=''"); foreach($results as $result){ $CachedCSS .= $result->CachedCSS; } //Get Active Theme ID $Settings = $this->wire('pages')->get("template=settings"); $FileNameFormat = 'merged_' . date("Y-m-d_H:i:s"); //Get Active Theme so I can update its CachedCSSFilename $ActiveTheme = wire('pages')->get($Settings->ActiveTheme->id); $PreviousCachedCSSFilename = $ActiveTheme->CachedCSSFilename; $ActiveTheme->setOutputFormatting(false); $ActiveTheme->CachedCSSFilename = $FileNameFormat . '.css'; //Set the new value $ActiveTheme->save('CachedCSSFilename'); //make a file with $CachedCSS $myfile = fopen('styles/' . $ActiveTheme->CachedCSSFilename, "w"); fwrite($myfile, $CachedCSS); fclose($myfile); //Delete previous merge file. unlink('styles/' . $PreviousCachedCSSFilename); //$event->message("Old file: $PreviousCachedCSSFilename deleted"); } } //end class