Search the Community
Showing results for tags 'caching'.
-
I'm building a site that renders certain features using reusable classes. Unfortunately FileCompiler caches the files and my changes don't show up unless I clear the FileCompiler cache. On top of that, when I try to use the wire() function inside a class it throws a "Fatal error: Uncaught Error: Call to undefined function wire()". I've tried playing with ProcessWire namespacing, but have come up short. My files are structured as such: app.php - Is included in my templates and loads classes as they're called with spl_autoload_register. - classes/ExampleClass.class.php - Loaded by app.php Thanks!
-
Hi, I'm building my homepage, it contains ~60 custom fields (lines or words I define & translate in the admin in different languages). The homepage is dynamic and my users are logged. I'm trying to avoid many MySQL queries to retrieve the fields I've setup in the admin, I think I can do better than 60 different queries to display that content on the home. Regarding performance, will markup cache a good approach here ? I understand it makes sense when you have a scrolldown menu which is built within a loop for example but is it still good if I cache 60x a word or a group of words in my code ? Another idea I had was to dynamically determine which language is used by the user and load a language file which contains the translated text (uk.inc.php) and so on... (less elegant I think, but I'll use that anyway for dynamic expressions such as "you have %nb items in your cart"). Thanks
-
Just a small question on selector performance and room for improvments... i use a little function that renders me all archiv links like /2015/ /2014/ and so on...all years that are _used_ in the article system... This cause a selector without limit...and there will be many posts/articles in future now there are about 40 - it will scale up to 100 fast and more will follow...so here is the question about caching the find query or using other code...? Basic information i work with a URL segment approach that show me /year/ and /category/ overview pages. (Category or not the problem while here limit works and pagination is used) Code from the year archive: function renderArchive() { //check for url segments $seg1 = wire('sanitizer')->pageName(wire('input')->urlSegment1); //get all posts to check for years $posts = wire('pages')->find("template=artikel"); //get homepage url for the links $homepageurl = wire('pages')->get('/')->httpUrl; //get article root page for links $artikel_root = wire('pages')->get(1068); //get year list $out = '<h4 class="subtitle">Archiv</h4>'; $out .= '<div class="listbox1"><ul>'; //Setup for the year sidemenu $years = array(); // find the array of years for all events foreach ($posts as $y) { $dateY = $y->getUnformatted("publish_from"); $years[]= date('Y',(int)$dateY); } $years = array_unique($years); arsort($years); $year = ""; foreach($years as $key => $year) { // Output the year $class = $year === $seg1 ? " active" : ''; $out .= '<li class="'.$class.'"><a href="'.$homepageurl.$artikel_root->name.'/'.$year.'/">'.$year.'</a></li>'; } //close list $out .= '</ul></div>'; return $out; } Could this done better - or cached somehow (I'm not really experienced with caching such things) regards mr-fan
-
Hi I have this really stubborn issue which has gobbled up my evening. It's clearly a caching issue or a .htaccess but nothing seems to resolve it. I have a site on domain.com and VPS 01 Because I want to develop some ideas on a separate test server, I made an exact copy of the site and database onto temp-domain.com and VPS 02 Any template and include changes I upload to VPS 02 are not showing up. The templates files are on the VPS 02 server and the file manager confirms this. However VPS 02 ProcessWire install is clearly reading files from VPS 01. To confirm this I make a small change to the footer running on VPS 01. I reload VPS 01 and VPS 02 and both sites show the updated footer. These are the steps I've taken to clean things up. disabled ProCache cleared the site>assets and site>cache folders ensured that both config files have the proper httpHosts set but somewhere, VPS 02 is getting it's base path from VPS 01 Furthermore, I can confirm this by viewing the source and mouse-over a CSS file. The root host path is displayed as domain.com/path/to/file for a split second before it displays temp-domain.com Any ideas? Both sites have the same database name, userAuthSalt, user login etc etc so there's lots of room for error. I saw a post regarding running PHP as an Apache Module instead of Fast CGI. This makes no difference to my issue.
-
Hi Guys, We are working on a project which includes a new ProcessWire site and a WordPress blog. The site is built in ProcessWire and the blog will reside in a directory labeled blog on WordPress (Same Server, Same Root, 2 databases). Since the Blog should mirror the website, we need to find a way to pass the header and footer to the blog. This way the user visiting the website will see they have not left the site but is now viewing a blog. (hope I didn't confuse anyone) My question is, has anyone done this? If so, how? I have seen others cache the header and footer files from custom CMS's but not on a ProcessWire site. Any direction on this would be greatly appreciated. Thanks guys!
- 25 replies
-
- caching
- header include
-
(and 1 more)
Tagged with:
-
Thought I would share the following experience here for anyone interested in caching in PW. Converting a site from modx (Evo) to PW and finding some interesting performance issues. One page which pulls in content from 50 other pages ran really well under modx, page load (uncached) was around 450ms (yeah, not that fast but a lot of database action and formatting happening there). Converted the site to to PW and it took a massive hit, loading in around 3200ms. I was surprised as I always though PW was supposed to be lightning fast. It's possible (probable?) I'm doing something with $pages which is not well optimized, not sure at this stage but will look more into this when I get a moment. Anyway, I found two parts which were taking the longest to process and coded MarkupCache to these areas. Never used it before but found it very easy and nice to work with and just works beautifully, superb, all credit to the developer. The result of this quick bit of optimising was a page load speed reduced from 3200 to around 600ms. Impressive. And so easy to manage. While on the topic; There are several options for caching in PW, including template caching, markupcache, and procache. There's bit's and pieces on the forums about each, but is there a writeup somewhere summarising pros and cons of each? I was thinking of trying out template caching or even better ProCache but the site is probably too dynamic. Analytics, counters, live stats on the pages, etc. so I'm thinking it will be not so good yeah? Any advice welcome.
-
Hello everyone, I'm currently trying to find the best way to solve a problem and I'm not really sure, whether there's an easy solution. Consider this example: 1. There is a template for "author", "article" and "tag". 2. The "article" template has a) a pages field for authors on or multiple authors and b) a pages field for on or mutilple authors tags 3. On the "authors" page I want to display a list of all tags, for which this author has articles. The naive approach would be to just get ALL tags, iterate through them, check if there's a page with the given author and this tag and if yes, add them to the list of display tags. Something like this: $authorTags = new PageArray(); $allTags = $pages->find('template=tag'); foreach ($allTags as $tag) { if($pages->count("template=article, tags=$tag")) { $authorTags->add($tag); } } While this works great, there's obviously a big performance problem: it doesn't scale since each additional tag results in one additional query. The cache will have to be cleared on changes of each article, which could happen pretty often, so this is not a solution. My second approach was to have an additonal field for tag in the "author" template and write a module that hooks into page save of "article" pages, checking for changes in the tags field and replicating them in the given author's pages. In the "author" template you can then just display your tags as a "native" field, which shoud be simple and performant. While I think, that this will probably the best and most clean solution, it will also be a lot of work, so I was wondering whether anyone of you maybe knows a) an easier (while still performant) way to archieve this, or b) a finished module that already solves this problem or is at least a good starting point to solve it. Thanks a lot for your answers already, Marc
-
Hi there, As I'm starting to work across pages, I'm seeing some cases where I might like to re-use queries or HTML fragments that in my original framework, I may have cached in properties of more globally accessible object references. In templates, you're in a page-centric scenario and I wondered whether there is anything in the framework for stashing values for use across template processing? Thanks!
-
Hi, Coming from modx (Evolution) I found one restriction (which was later solved in Revo version) was a page limit of between 2000 and 5000 pages, after which performance apparently took a nosedive. I never fully tested this but it was a restriction I was always aware of and it did prevent be building a couple of sites. I would be interested to know if there is a theoretical "page limit" in PW, or alternatively has anyone developed a site with 5000+ pages and how well does it perform. How does it affect caching? Thanks
- 12 replies
-
- performance
- page limit
-
(and 1 more)
Tagged with:
-
I was trying to find pages that one or more items populated in an AsmSelect field with: $tagged_pages = $pages->find("tags.count>0"); My test kept finding the Home page that didn't have anything populated in the AsmSelect field "tags". Eventually after trying lots of alternate ways to do this search, as I'd been adding and removing fields etc, even though Home showed no items in it's AsmSelect, I added one, then deleted it, back to no items, and now the test that had appeared broken was working fine. Might this be due to caching and if so is there a way, while developing, I can globally set PW to not cache so stuff like this can't happen? Or might it be due to me adding/removing/adding back fields and somehow confusing some internal/session/other-cached settings? Tks to anyone with any ideas!