Jump to content

MuchDev

Members
  • Posts

    378
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MuchDev

  1. Thank you so much! Managing those backups has been a little bit of a pain, now the pain is gone. Nice touch with the cleanup, 20 backups cleaned out . This module is indispensable now.
  2. Thanks for the replies everyone, this really clears things up. Hehe, so self reflective . Thanks for clarifying, I did read that it was possible and the document said otherwise, I guess I was just hoping that the documentation was just a tad out of date. Too bad that this doesn't work, it's going to make this line in the repeater a little more confusing to the editors at first, but I'm sure they will forgive me .
  3. Sorry, didn't mean to ruffle any feathers, never said I was the one who came up with the code. I just figured that clarifying by posting a modified version with different image sizes would make the script make more sense to the user along side the original script posted by soma. I would never intend taking credit for soma's genius .
  4. It took me a lot of tweaking to get my server setting right for bluehost, the problem you may end up with once you get your execution time sorted will be memory if you are doing piles of images (like me). One thing that I found really helpful was a script that I wrote. This is a utility and the timeouts are maxed just for doing a really large run when I was getting ready to bring a server live. This script finds all the images on my site and pulls them into memory, if they don't exist then the server generates a cached derivative of it. ini_set('max_execution_time', 60*999); // 5 minutes, increase as needed $pa = $pages->find("template=items,artwork_img.count>0,id>14000"); $pa = $pa->reverse(); $count = count($pa); echo "<h1>Processed</h1>"; echo "-------------------------------------------<br/><br/>"; for ($i = 1; $i < $count; $i++) { set_time_limit(300); $item = $pa->pop(); $filename = $item->artwork_img->filename; //$ImageSizer = new ImageSizer($filename); //$ImageSizer->resize(1116,0); if(count($item->artwork_img)){ $item->artwork_img->width(900); $item->artwork_img->width(1116); $item->artwork_img->width(365); $item->artwork_img->width(255); } echo $filename."<br/>"; $pages->uncache($item); } echo "<h1>Yet to be Processed</h1>"; echo "-------------------------------------------<br/><br/>"; foreach($pa as $p){ echo $pa->filename.'<br/>'; } I then decided I would just let field generate the image on upload, just in case a user added a huge pile and didn't give the server a chance to generate the derivatives. When this would happen the server would, of course, hang while processing. For that I just used soma's script, and never looked back. <?php class ImageCreateThumbs extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'ImageCreateThumbs', 'version' => 100, 'summary' => '', 'href' => '', 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookAfter('InputfieldFile::fileAdded', $this, 'sizeImage'); } public function sizeImage($event) { $inputfield = $event->object; if($inputfield->name != 'artwork_img') return; // we assume images field $image = $event->argumentsByName("pagefile"); $image->width(900); $image->width(1116); $image->width(365); $image->width(255); } } ?>
  5. Hey all, currently building a newsletter builder that can create newsletters from fields and existing items as well as repeater fields that have more content areas. As you can see from all this there are a lot of scenarios in which one field will be hidden while others are visible. With this in mind I am attempting to set all my fields so that they display conditionally based on a couple inputfieldSelect boxes. This is going well for nearly all fields up until the point in which I need to use a != selector. Here are the select boxes with options that I am using to hide/show body and headline input fields. newsletterContentType **1:=New **2:=Linked Content newsletterContentLayout **1:= Single Column **2:= Two Column **3:= Compact Article Block So the one scenario is this, I would like to have a text box hidden if newsletterContentType=2 and newsletterContentLayout=2 or 3. As we are curently unable to have OR operators as specified by the documentation I have attempted to write it like: newsletterContentType!=2, newsletterContentLayout!=1 So the way that I interpret this to mean is * always show this field unless these two boxes are set like this * The problem with this code though is that processwire seems to interpret that expression to mean , = or. Is there to write this in a language that this field will understand?
  6. Hey 4 sec for Seattle to London on a $35 apache server doesn't seem too shabby, not to mention 12mb budget broadband. I'll be setting this up on nginx some time this week and see whats transfers are like.
  7. I just have to chime in with nothing helpful other than to say how thrilled I am to see this. This is going to be such a fantastic tool for content creators.
  8. What a beautiful site, everything seems to work great! I am currently listening to a enchanting guitar solo and clicking around. The connection between the media player and the rest of the site is really slick. I love how when you are listening to a track, whatever page that the item is on shows a now playing icon, most music sites don't even have that functionality (even the really big ones). My only note would be that I was a little confused when I clicked on the catalog and ended up on the site search, I guess I was expecting a more simple display of represented artists than a fully featured search. Thanks for showing this!
  9. K lill pi is up and running with procache now. * I lied, it was loaded but not running totally wasn't paying attention.
  10. Hey there, thanks for the awesome profile. I'm going to probably use it as an example for a simple site I'm doing as a class project. Here it is running on a raspberry pi. therestaurant.endoftheinternet.org
  11. Hello there. I'm trying to write a seemingly simple function and am a bit confused as to why this isn't working. I have a page full of items that have tags in their own page fields. I add those to an array and then implode them to a select string. I then would like to find pages that are tagged with those tags. For instance some items are tagged with a tag that is used to build an entire page. That page has a field called TagSelector. Some times a tag will contain some items that have pages built from that tag and I want to have some buttons to allow the user to just click on through to a larger section. So the issue is I will have to do a search for many terms at once to find a page that is tagged. When I run the search I am unable to locate anything for some reason. Will this require that I run searches separately or is there something simpler that I am missing? This is what is passed to the find : TagSelector=10734|10715|8192|10711|13311|10712 function renderTagButtons($q,$pageItems){ if($q !== "" || $q !== null){ $tagnames = ""; $tags = new pageArray(); foreach($pageItems as $pageItem){ $tags->append($pageItem->Tags); } $tags = $tags->find("sort=title"); foreach($tags as $tag){ $tagnames[] = $tag->id; } $alltags = implode("|",$tagnames); $alltags = 'TagSelector='.$alltags; echo $alltags; $matches = wire('pages')->find("$alltags"); if(count($matches)){ $tagBtns .= '<h3>Related pages:</h3>'; foreach($matches as $match){ $tagBtns .= "<a href='{$match->url}' class='btn btn-default sectionbtn'>{$match->title}</a>"; } return $tagBtns; } } }
  12. Well I got my brand new pi2 all loaded up with mysql and apache, this thing is great! I have it shared through my dyndns if you wanna give it a try. I just have the bluevr profile loaded on processwire. Credentials are: admin / password. go to: therestaurant.endoftheinternet.org
  13. Yeah man, I am not positive but that looks like it may do the trick. Just add an extra field to the "tag" field that holds aliases and then search for them. To be honest though I am no expert and I would recommend trying it out, you may have some issues locating items based on aliases. I am sure someone will chime in if I am pointing you down a dark path.
  14. Ok, I'm doing a little thinking on this and I have a couple ideas depending on how you would like to approach this. Searching for tags in processwire is actually quite simple. Tags, as Kongondo just said can be related using a page field on the tagged item. Currently the way that I manage tags is using the pageAutocomplete field. This module allows you to quickly add multiple page references based on a specific path. You tell the field the path of the pages that will be acting as tags. If the tag doesn't exist, I have the field set to automatically create a new one. Ok. So that method will require that the user types in all of the tags individually, which would be pretty quick, but this is something that you would like to avoid. So what I am thinking is creating a little module that adds "subtags" based on a "master tag". So to do this you would most likely want to create 2 separate tag templates. One tag template will be a master, and the other will be a sub. So your master tag template will have a minimum of 2 fields. The first field will be a title and the second will be a page autocomplete field, this field will be pointed to your subtag path. So you will have your master plant and all of the other names that it would be related to. Then the subtag would just be a single title template that is also related to the page. The module would just hook to page save, look to see if the page has a tag field, if the tag field contains master tag then add its subtags. If you want your search to turn up a search based on a tag you will need to run your search like this. $matches = $pages->find("TagField.title|title|anotherFieldtoSearchBy*=$query");
  15. K so I've now been using this module for 6 days and everything is working perfectly, lovin' it. So I guess the only thing that I would like is to be able to limit the amount of backups that this module creates and have that setting somewhere accessible either through a hard coded variable or the admin interface. I'm thinking just a delete function that is called when the latest backup is complete. I'm going to take a look and see if that is something that I may be able to contribute.
  16. I know it does seem a bit wacky, but this is for a company that is used to their database system and is just getting use to the site that I built them. I really feel that the way that they work, if I were able to provide them a simple to use module that could interface with their existing database directly from processwire that they would have the easiest time getting the hang of things. I also would really like to build this as well, I think it would be a helpful tool to have for others. My goal is to port this beast as straight across as I can manage, but I may just end up using it as an example. I guess we will see once I dive into this later on in the week. I will try and keep you guys updated .
  17. So I have a client that is pretty entrenched with a filemaker database and was wondering if there was anyone whom had created a filemaker module for processwire. I located a pretty well featured module for drupal and from looking around it I see that it seems fairly compatible without any hacking. So if there isn't one out there yet I suppose I will be porting this one over from drupal into processwire. Any other recommendations? I am also considering just creating a simpler version that would just work directly with the database and fetch the records and format a csv, then relate images using the admin interface.
  18. Well I really appreciate the extra sets of eyeballs I have stretched the cache time out using procache and I haven't seen an issue in the past several days or so which is further convincing me that this is related to the amount of load on the site at the time that the page is attempting to be regenerated. That selector is just unable to pull any items because the site is busy maybe? itemFunctions is all markup related and generates the item cards based on the page fields supplied to it via functions, so there is no selectors. Also all of the custom functions included in this template are called in two other templates that do not generate this error. I would but as this is a live site now wouldn't debug mode cause all users to view current debug information?
  19. I was half way through trying to write this when I found your module. Thank you thank you thank you . Made really quick work of an important feature.
  20. Well don't say I didn't warn you. Here is a collapsed version so that you can see most of the ins and outs . <?php include('./includes/header.inc'); include('./includes/itemFunctions.inc'); include('./includes/socialButtons.inc'); include ("./includes/contactForm.inc"); echo generateLightbox(); echo generateArtBio(); //if artist is contemporary use phrase "featured works" //if artist is antique use phrase "available works" $verbage = ""; ## testing fix 2-2-2015 ## removed extra leading space in id selector for unknown selector bug if($page->parent->id==1248){ $verbage = "Featured works by: "; }elseif($page->parent->id==3636||$page->id==3637){ $verbage = "Available works by: "; } //set max items if ($page->maxItems){ $maxItems = $page->maxItems; }else{ $maxItems = 50; } ################################## $parents = $page->children; $items = new PageArray(); $allitems = new PageArray(); foreach($parents as $thisItem){ $items->import($thisItem); $items->import($thisItem->children); $allitems->import($thisItem); $allitems->import($thisItem->children); } // configuration for pagination needed $total = $items->count(); $start = ($input->pageNum-1)*$maxItems; $items->setLimit($maxItems); $items->setTotal($total); $items->setStart($start); ################################## $born = $page->artist_born; $died = $page->artist_died; $nationality = $page->artist_nationality; if($born || $died){ if($died == "") $died = " "; $birthDeath = '<small>('.$born.' - '.$died.')</small>'; } ?> <section class="container wrap"> <div class="row"> <div class="artist-intro"> <h2 class="sectionTitle"><?php echo $verbage;?><strong><?php echo $page->artist_firstname.' '.$page->artist_lastname.' '.$birthDeath;?></strong> <? echo $nationality; ?></h2> <div class="artbioTop"> <?php echo $page->artist_biography_snippet; if($page->artist_biography!=""||strlen($page->artist_biography)>10)//if there is a bio then print markup for button else just render social buttons { $bioBtn = ""; $bioBtn .= '<div class="bioBtnHolder">'; $bioBtn .= '<div class="bioBtnHolder">'; $bioBtn .= '<button href="#artBio" class="artistBio btn btn-default" data-toggle="modal"><span class="artBioIcon glyphicon glyphicon-user"></span>Artist Biography</button>'; $bioBtn .= '</div>'; if($page->YouTube) $bioBtn .= youTubeButtons($page); $bioBtn .= renderDownloads($page); $bioBtn .= renderSocial(); $bioBtn .= '</div>'; $bioBtn .= '</div>'; echo $bioBtn; }else{ $bioBtn = ""; $bioBtn .= '<div class="bioBtnHolder">'; if($page->YouTube) $bioBtn .= youTubeButtons($page); $bioBtn .= renderDownloads($page); $bioBtn .= renderSocial(); $bioBtn .= '</div>'; $bioBtn .= '</div>'; echo $bioBtn; } ?> </div> </div> <div class="row"> <?php //social dropdown and pagination menu $hasSections = false; foreach($parents as $child){ if($child->template=="itemsSection"){ $hasSections = true; } } if($hasSections||$items->getTotal()>=$maxItems){ echo '<div class="pageNavTop">'; echo '<div class="socialHolder socialHeader">'; if($page->useButtons==1)echo generateButtons($allitems); echo '</div>'; echo $items->renderPager(array( 'listMarkup' => "<ul class='pagination pageNavBtns'>{out}</ul>", 'currentItemClass' => "active")); echo "</div>"; }else{ echo "<div class='spacer'></div>"; } ?> </div> </div> <?php if(count($items)<1){ $dflt .= '<div class="row">'; $dflt .= '<div class="col-xs-12"> '; $dflt .= '<img class="fitwidth align-center" src="'.$pages->get(4945)->UnderDevelopment->first()->url.'">'; $dflt .= '</div>'; $dflt .= '</div>'; echo $dflt; } ?> <div id="masonry" class="row"> <?php foreach($items->filter("limit={$maxItems},start={$start}") as $item){ //Remember to not return any tags in the string if no information has been returned. //option 1 - one is an item and then just print it. if($item->template->name=='items'){ $gridSizer = $item->gridSizer; echo generateItem($item,$gridSizer); } //option 2 is a subsection. Print 100%width divider with text areas if($item->template->name=='itemsSection'){ echo "<div id=".$item->id." class='grid-item masonrySection col-xs-12 subsection'>"; if ($item->subsection_description){ echo "<h2>{$item->title}</h2>"; echo "<p>{$item->subsection_description}</p>"; }else{ echo "<h2>{$item->title}</h2>"; } echo generateButtons($allitems); echo "</div>"; } } ?> <div class="cards sizer col-lg-3 col-md-4 col-sm-6 col-xs-12"></div><!--setup widths--> </div> <hr/> <?php echo generatePager($items); ?> </section><!--end page-wrapper--> <?php include ("./includes/footnav.inc");?> <?php include ("./includes/footer.inc");?>
  21. I am sure that there is probably more preferable methods of implementing this functionality but there is my first try at a module so I figured I would post it for fun. I have added a lot of sub sections to all the items on my site and because of that I want to be able to search for items based on their hierarchy automatically. If an item is an artwork inside of an artists folder then it is assumed that a user would want to search by the artist to find the item. Because this site has so many darn combo boxes and page fields I figured I would just write a module to push some more knowledge into my brain and in the pursuit add a really handy feature. I currently have a maintenance script crawling the site every night but I would like this relationship to update itself any time that it might change. I am thinking I will set this to page save and page move. Here is what I have so far, haven't even tested it yet but I'm happy to hear your thoughts. Looks like I need to do some thinking about how this will work. This will somehow need to trigger the page's cache field to resave...uggh modules are tricky . I've done some testing and realized I copied my code out of my script and my variable names were wrong, but this seems to work perfect so far. On to finding how to regenerate that cache field. <?php class ProcessRelateParent extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Relate Parents', 'version' => 001, 'summary' => "This will automatically relate an item to it's parent folder. This is used for the parent field that the search engine looks for.", 'href' => 'http://www.muchdevelopment.com', 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookBefore('Pages::save', $this, 'relateParent'); $this->addHookAfter('Pages::sort', $this, 'relateParent'); $this->addHookAfter('Pages::moved', $this, 'relateParent'); } public function relateParent($event) { $page = $event->arguments[0]; if($page->template == "items"){ if($page->parent->parent->template == "base"){ $fieldData = $page->parent->title; }elseif($page->parent->parent->parent->template == "base") { $fieldData = $page->parent->title; } $page->parentSection = $fieldData; $event->return = $page; } } } ?>
  22. Alright this bug has me a bit stumped, as it happens intermittently only on one template on my site usually during high traffic times. The pages all render perfectly of course when I go to check to make sure that the site itself hasn't crashed, but otherwise I just keep getting this message off various pages that use this template (around 8000 pages). So from what I have seen referencing this error has all been in regards to a $pages->find call that has a leading space in a selector. So the problem is that this page uses no finds directly yet I am still getting the error. Which other methods would cause this exception? I was going to post the code, but this is a pretty large template and I dont want to totally overload everyone with the main display of all artwork lists. I feel like this may be related to high traffic times and procache flushing the cache on pages that users are trying to load simultaneously... Any geniuses feel like throwin' your gloves in the ring?
  23. Funny you should post this I just shot off an email today to the maintainer of the website I built. So yes, you absolutely can import into a pagefield using the csv plugin. A page field is pretty much just the page path. So try this out, if you need to do tags using a pagefield it will look like this. image another_field tag_field tag_field tag_field tag_field img.jpg data tag path tag path tag path tag path if your tags are all in one place like siteroot/tags then your path will basically just be /tags/tagname. Do this for every tag on one line. If you put your tags on different lines then they will just override the one before. **Edit I didn't read that you didnt have the tags created yet. You will need to create a csv of just tags first and make those before you try to link them, but that is nothing that 5 min in excel or your favorite spreadsheet program can't solve.
  24. K I just bought a 2, so stoked to set up a tiny pw server .
×
×
  • Create New...