-
Posts
378 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MuchDev
-
Wicked work, some serious design talent. Noticed one thing with the glow on :focus for input boxes in chrome shows up as a blue square outside of the newsletter signup input. Setting the tapered class to the input seemed to fix the styling here for me.
-
I'm with you. That bendy hinge is awesome, but 1500 on a touchscreen tablet laptop... I'll buy a cheap laptop and a kick but dev machine and hold on to my android tablet a little longer . I know what you mean man, I support a network of macs, nothing maddening there trying to keep everything all secure and backed up.
-
You know I saw the query, I didn't think to check the response. Thanks dude
- 11 replies
-
does the apeisa's shopping module support pw 2.5 or even 2.6 ?
MuchDev replied to adrianmak's topic in General Support
Yeah 50eu for a shopping cart system that doesn't take a cut on sales, and is totally extensible and customizable. I use it, and I am really excited about using it on a project. -
I am sure that would be fine. Have you looked into Horst's "Page Image Manipulator", that thing has tons of options. https://processwire.com/talk/topic/4264-page-image-manipulator-1/ https://processwire.com/talk/topic/9982-page-image-manipulator-2/
-
Good point. That sucker is lightning fast. Any chance you would like to share your secret sauce ?
- 11 replies
-
I'd really be interested to see what you come up with as a solution for re-processing everything. If you were worried about your code overwriting your images, you could just have your code omit the compression of the original file. Then you could just compress variations. This wouldn't work if you used your original images as assets though. Maybe an option to only compress variations?
-
How can this be optimized? Redirecting item page.
MuchDev replied to MuchDev's topic in Getting Started
I wouldn't mind explaining at all I should have taken some time and gotten a bit more information to post at first. Items on this site are all artworks. The way that I have set up will allow the editors to build sections a couple different ways. The first way a section is built is by nesting. When using the Artist or Section template you can create items underneath it that are either by the artist that the items are under or they are part of the section that they are under. You can then create another section underneath these which allow for a structure as shown below. You can also organize items for the artist template similarly using a section under an artist. So my reasons for doing this is mostly due to the fact that when I originally built this site I was brand new to processwire and I couldn't figure out a seamless way of creating a system that allowed people visiting the site the ability to browse through the items for a section. My solution was to put all items on the page and then use a lightbox to allow users to browse the items on the page with the lightbox. This is a system which I would like to do away with, but I have yet to figure out a good way to implement browsing through all of the items that are in the section in the order that they appear, and also provide visual reference for where the user is at while browsing. -
Released: PadLoper (commercial eCommerce platform for ProcessWire)
MuchDev replied to apeisa's topic in Modules/Plugins
Agreed, this project is top notch. He has been nothing but helpful on the several issues that I have had. This is really it for native sales through processwire, and the project could have no better leader. This is going to be an essential tool for anyone wanting to stay completely within the processwire ecosystem for their e-commerce projects. -
Works like a charm Well here is some code, the bulk of it soma wrote which handles creating extra images so that on batch uploads there is less of an inital page load. After that it just executes a script that wraps the two programs. Here is the script: LINK <?php include 'ImageCrusher.php'; class ImageCreateThumbs extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'ImageCreateThumbs', 'version' => 102, 'summary' => '', 'href' => '', 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookAfter('InputfieldFile::fileAdded', $this, 'sizeCrushImage'); $this->addHookAfter('ImageSizer::resize', $this, 'crushImage'); } public function sizeCrushImage($event) { $inputfield = $event->object; if($inputfield->name != 'artwork_img') return; //image field here $image = $event->argumentsByName("pagefile"); $image->width(900); //$image->width(1116); $image->width(365); $image->width(255); $path = "/home/username/public_html".dirname($image->url); ImageCrusher::batch($path, true ); // recursive } public function crushImage($event) { $path = $event->object->filename; $crusher = new ImageCrusher($path); $crusher->crush(); } } ?>
-
Fantastic! Thanks man, that makes sense. I'll test it out and post my solution .
-
Hey quick question I hope. I am trying to find the right method to go about getting the filepath of all images when they are saved or resized in a hook. If I use this how would I go about getting the file path from the event? $this->addHookAfter('ImageSizer::resize', $this, 'compressImage'); I will then be passing this off to a script which automates the usage of pngcrush and jpegtran. ImageCrusher::batch($path, true ); // recursive
-
Hey all, so I'm not really sure how I should frame this question, but mostly I was hoping that by posting a script I use on a live site I may be able to get some ideas on how I should better optimize a pretty clunky operation. This template here is for items that sit on pages. The site is laid out where the items are children of their parent page, and the parent page is the view for all the children pages. When you click on an item, the item is displayed at a larger resolution in a lightbox. Because this is an art site I wanted to have the ability for users to have the feeling that they were browsing through an actual gallery, so the focus never leaves the page that they were on. The purpose of this template is one part so that I could build links directly to items from my site search. So the problem with this page is a couple fold. The first problem is that this page is heavy and can take a second or two just to find the proper page to redirect to and insert a #anchor to open the proper lightbox. The second is that after learning a ton over the last year or two since I built it I don't think that it helps anything from an seo standpoint. Well I think I am going to rebuild this, and if you think you have any pearls of wisdom about art websites and their content I'd love to hear it. Also if you spot anything in this code that looks stupid I'd like to hear that too sample page structure to illustrate what this whacky thing does This script gathers all the children and figures out what page the item it is on by getting a max count from the page or the site default. (parent page) | |__item |__item |__item |__section |__item |__item <?php //artwork template only used to redirect back to parent template. //find what page the item is on when using pagination $maxItems = $pages->get(4945)->maxItems; $pagebucket = new PageArray(); //get parents and flip em to find base page $parents = $page->parents->reverse(); //now iterate all pages in reverse to find the base page foreach($parents as $parent){ if($parent->parent->template == 'base' || $parent->parent->template == 'homebase' || $parent->parent->template == 'pastExhibitions'){ $basepage = $parent; break; } } //check to see if section has a max item amount set if($basepage->maxItems>0) $maxItems = $basepage->maxItems; //now add all children to the pagebucket foreach($basepage->children as $child){ $pagebucket->append($child); if($child->numChildren){ foreach($child->children as $grandChild){ $pagebucket->append($grandChild); if($grandChild->numChildren){ foreach($grandChild->children as $greatGrandChild){ $pagebucket->append($greatGrandChild); } } } } } //debug //foreach($pagebucket as $thispage) echo $thispage->title."<br>"; $itemPosition = $pagebucket->getItemKey($page) + 1; $redirectPath = $basepage->url; echo $itemPosition; ////now figure out what page its on $pageNumber = ceil($itemPosition/$maxItems); if($pageNumber>1){ $redirectPath .= "page{$pageNumber}\#artwork_{$page->id}"; }else{ $redirectPath .= "#artwork_{$page->id}"; } //$redirectPath .= $pagebucket->getItemKey($page); //NOW DO FUNKY REDIRECT ---PROFFIT! $session->redirect($redirectPath); ?>
-
Yeah good point there is that too. I think why I used that was in debugging, having direct access to the file made it easier to just delete it and have it re-cache, also I got to play around with some bare metal php.
-
I used an article on stack overflow, I think it was this post: http://stackoverflow.com/questions/20558078/caching-instagram-api-requests-using-php I don't think I had to do too much. I didn't end up using markup cache as you could I just cached the file to a static directory in my cache folder. You can see in the script where you could parameterize your settings in. Good luck .
-
Are you wanting this in xml, or are you wanting to create an html page, or is this to output the markup for your navigational elements? You could make a recursive looping function and feed it the parent element and in that loop call itself to output what you need from the child elements. There are a couple examples from sitemap examples in Ryans sitemap.xml generator, or my lill guy that I based off his that outputs a sitemap in json. Ryan's - https://processwire.com/talk/topic/3846-how-do-i-create-a-sitemapxml/?hl=sitemap Mine - https://processwire.com/talk/topic/11015-json-sitemap/?hl=sitemap You could also try out soma's module if you are looking for something already done. Let me know if you want me to give you a mod on my function.
-
Hey this looks great! I have one recommendation that you might want to consider, I didn't see anything that caches the json array that you get back. I had an issue with a site a while back where periodically due to the server having to make a round trip to the instagram api every load the rest of the page would hang a bit. Not really an issue if you are using something like procache, but maybe a cache option might be a good idea for a configurable option . Just a thought.
-
I did something like this for a newsletter builder that I created using a page table and then on the template i used a bunch of dropdown selectors with field options to hide and show them based on other options on the page so that certain items would show up for certain set ups. So if the option was set to partial width you would then see a dropdown with the 1-12 grid option etc.
-
Hey guys, I know this isn't really a how to, but I am currently working on a system to inline above the fold css and was needing a json pagelist, and figured I would write something to automate it. I included the ability to flatten the tree or keep it expanded. There is also a filter section where you can exclude individual pages by path, parent, id, or template. This is all pretty bare bones and will pretty much just gives you a json array of your page paths, but that is all I needed. This is working code but you will need to clear out the filters for your own site. <?php /* * JSON SITEMAP GENERATOR * By Sam Fleming -- MUCHDEV * This will create a json sitemap for grunt or other purposes * * option includes flat / expanded. Use however you need * * apply whatever filters you need to exclude in the filter array * curently supports excluding by: * Path * Parrent * ID * Template */ ########################################################### ## SET HERE IF YOU WANT AN EXPANDED OR FLATTENED SITEMAP ## ########################################################### $flatten = true; ########################################################### ## YOUR PAGE FILTERS GO HERE ## ########################################################### $filters = array( "paths" => array( "/processwire/" ), "parents" => array( "3211", "5", "55", "98745" ), "ids" => array( "1123", "5985", "321454", "15885", "321115", "39" ), "templates" => array( "template1", "template2" ) ); function buildSitemap($flatten) { $home = wire('pages')->get('/'); $urls[] = $home->httpUrl; $urls[] = getChildren($home->children); if($flatten){ $flatArray = arrayFlatten($urls); return json_encode($flatArray); }else{ return json_encode($urls); } } function getChildren($pages){ foreach($pages as $page){ //iterate through all the filters in array, and if the type matches then set flag to true $flag = false; foreach($filters as $filter){ switch($filter){ case "paths": foreach($filter as $path){ if($page->path == $path) $flag = true; } break; case "parents": foreach($filter as $parrent){ if($page->parrent == $parrent)$flag = true; } break; case "ids": foreach($filter as $id){ if($page->id == $id)$flag = true; } break; case "templates": foreach($filter as $template){ if($page->template == $template)$flag = true; } break; } } if(!$flag) $urls[] = $page->httpUrl; //if page has children then recurse if($page->numChildren){ $urls[] = getChildren($page->children); } } return $urls; } function arrayFlatten($array) { $return = array(); foreach ($array as $key => $value) { if (is_array($value)){ $return = array_merge($return, arrayFlatten($value)); } else { $return[$key] = $value; } } return $return; } echo buildSitemap($flatten); ?>
-
Beautiful work I really liked how you combined all of those elements to make the pages feel so smooth.
-
I think you can do this $products = $pages->find("template=product, stock=1, sort=parent, sort=title");
-
You mean like this? http://modules.processwire.com/modules/textformatter-video-embed/
-
Didn't know that. Even cleaner.