Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by FrancisChung

  1. I have some subtle issues between my dev environment (OS/X) and my production environments (Unix Hosted). I always suspected the subtle difference between the 2 file systems (1 is semi strict on spelling, the other is super strict) that could be a potential contributor. Have you looked out for any subtle spelling mistakes, case changes or encoding changes that could be contributing to this?
  2. Have you tried upgrading one of the working sites to 3.0.83 and tried unzipping, just to be 100% sure it is 3.0.83 that is causing it?
  3. I've fixed the above issue. I've removed it the Anchor tag that wrapped the logo for the PDF version. Weird that it didn't show up before ...
  4. @Wanze, I downloaded the latest version of mpdf and did a quick file comparison and the two versions looked vastly different. (So much so that the file comparison program 'hung') I didn't dare try merging or upgrading mpdf without any knowledge of its inner workings. There's another thread related to this issue below: Anyways, I managed to get it working but I now have a very strange bug going on. It seems that when I hover over our Site Logo, a Yellow Post it Note appears with the URL written on it? Very strange and not sure if anyone else is having this problem. Initially, I thought it had something to do with the Post it note chrome extension I had installed but uninstalling it made no difference.
  5. After struggling with this for a few days, I've managed to fix it find a hack for it. Basically, I had to turn on debug on in config.php, go through the dependency chain of my classes and functions. I will outline some of the strategies I used but your mileage will probably vary depending on your particular situation. In my situation, this was only happening if I'm trying to generate a PDF file which is a very specific use case. Again to reiterate, I was not getting this issue with my other use cases. 1) Consolidate / Reduce your dependency tree into something smaller. That meant instead of creating an object from a class and calling a method on it, I imported the function as a whole to the calling class 2) Importing functions from a common library/classes and removing references to them. Luckily, there was only 1 function to duplicate. 3) Change all require/include calls to require_once -> include_once 4) You can try using class_exists function as a last resort, only if you're sure you've cleaned up your call chain. I just couldn't work out why it was trying to load these 2 classes twice, so I used class_exists and that was the last error I fixed before I got it to work. I had tried to use class_exist with other classes in my earlier attempts and it was just propagating the issue down the call chain. This is the hack I'm really not comfortable with, but whatever works right now I will take it. if (!class_exists("\Site\Logo")) include_once("Logo.php"); if (!class_exists("\Site\KeywordParser")) include_once("KeywordParser.php"); P/S How I got into this mess in the first place is because I have a class template that automatically does a include_once to my Library PHP file that has commonly reused functions
  6. Has anyone come across this error before? It seems to start happening after my PW3 upgrade. I've had no problems with this module on PW 2.8.x. mPDF error: Some data has already been output to browser, can't send PDF file Update: It seems like we need to use an updated version of mpdf? https://stackoverflow.com/questions/46865306/mpdf-error-some-data-has-already-been-output-to-browser-cant-send-pdf-file-wh Update 2 : The error went away when I turned off debug in config.php
  7. Hi, I was wondering if anyone knew what this did? If so, do you know what modules it actually impacts? Is there another log that lists the action it took? I'm having some weird problems with PHP duplicate declaration per link below, since this module was run.
  8. I've just come across this issue whilst debugging a bug on our site. It seems strange as it's only happening when I try to debug 1 particular php file, but not others. I'm getting the error Compile Error: Cannot redeclare getTopUrls() (previously declared in /xxxx/xxxx/site/templates/php/lib/Lib.php:12) (line 57 of /xxxx/xxxx/site/assets/cache/FileCompiler/site/templates/php/lib/Lib.php) I've tried adding @abdus ' suggestion to no avail. How can I stop the FileCompiler from compiling? Update : 1) I've realised it's not a template file it's compiling, it's a library file with common functions that is referenced by many other modules. Other modules that reference this lib file can be compiled & debugged fine. 2) I've tried to change from require_once to include_once with no effect. Update 2: 3) I've tried setting the filecompileroptions in config but it didn't work. Perhaps I set it incorrectly? $config->fileCompilerOptions = array( 'siteOnly' => false, // only allow compilation of files in /site/ directory 'showNotices' => true, // show notices about compiled files to superuser when logged in 'logNotices' => true, // log notices about compiled files and maintenance to file-compiler.txt log. 'chmodFile' => '', // mode to use for created files, i.e. "0644" 'chmodDir' => '', // mode to use for created directories, i.e. "0755" 'exclusions' => array('lib','Lib','/../lib','lib.php','Lib.php'), // exclude filenames or paths that start with any of these 'extensions' => array('php', 'module', 'inc'), // file extensions we compile 'cachePath' => $config->paths->cache . 'FileCompiler/', // path where compiled files are stored ); Update 3: Changed all require_once to include_once (extended the scope of change) Tried Installing PW 3.0.84 (latest dev) but didn't work.
  9. Perhaps no one has come up with a good way to monetising this. And with internet speeds getting faster and more people having bigger data allowances, the use case for offline viewing diminishes over time IMHO. Also I've never seen a mobile app that had a satisfying way of managing their user files, and I'm guessing it might be due to the restrictive nature of file access in mobiles. I can only speak about my IOS experience, so I don't know if Android handles it better.
  10. So sounds like you need to convert the PDFs to some mobile friendly format and make that available for offline viewing? The best example of this that I've seen is the Pocket App, but I assume that doesn't work because you don't want to store the files on their servers. It seems all of the github projects for pdf -> xxx format hasn't been worked on for years. This seems to be best of the bunch where the main project lists several other projects you could possibly investigate for your needs? https://github.com/nvdnkpr/PHP-Digital-Format-Convert-Epub-Mobi-PDF
  11. If the main objective of this project is to view PDF files/manuals offline, then do you need to build an app for viewing PDFs? Perhaps there's some security requirement we're not aware of. If not, can you not use off-the-shelf solutions/apps like Adobe/Fox It etc to view and use Dropbox/OneDrive/Some Cloud Storage to sync?
  12. Just logged in to our Test site Admin area using a Windows VM Chrome Browser. Everything seems fine to me? I'm running PW 3.0.62
  13. From my personal experience, the language syntax is a real bug bear for me. You seem to have type more to express the same thing in other languages. And as a result, readability is not the best, at least in my eyes. My personal (hopeful) wish is that they revise their syntax one day and adopt a more modern, concise syntax to bring it inline with their modern peers. Maybe the Internet will break if this happens haha. Otherwise, as a whole I think PHP is pretty to good at trying to incorporate best practices / bits from other languages. They're a step or two behind, but they do seem to get there. And every language has some sort of issues / shortcomings. It's how a programmer deals with it and what practices he/she adopts (e.g. Design Patterns, Defensive Programming, Automated Testing etc etc ) that will ultimately determine how good/bad your program is.
  14. I've tested PW2/3 with PHP 7/7.1 All issues I've had were to do with Namespaces of the Processwire objects (e.g. wire , NullPage)
  15. Does anyone here use a LINQ derivative / port for their projects? Coming from the .NET World, this is one of the things I miss the most when developing in PHP. Then I came across these 2 projects. For PHP : https://github.com/Athari/YaLinqo For JS: https://github.com/mihaifm/linq Why I chose those 2 over others : https://stackoverflow.com/questions/5792388/is-there-something-in-php-equivalent-to-linq-in-c I was wondering if anyone had experience using either one of them AND LINQ in .NET and could share their experiences? You might wonder why you would use LINQ ? The main benefits are better code readability (doing away with if -> then statements), a unified way of querying data in front and backend (Syntax is SQL derived) and applying paradigms from functional programming (See doing away with if->thens) // linq.js - anonymous function Enumerable.Range(1, 10) .where(function(i) { return i % 3 == 0; }) .select(function(i) { return i * 10; }); // Alternative shorter syntax using default variable names $result2 = from($categories) ->orderBy('$v["name"]') ->groupJoin( from($products) ->where('$v["quantity"] > 0') ->orderByDescending('$v["quantity"]') ->thenBy('$v["name"]'), '$v["id"]', '$v["catId"]', 'array( "name" => $v["name"], "products" => $e )' );
  16. There's a version 3 out there, but my O/S isn't supported. Was quite surprised to find v2 was free
  17. For those who find the Finder app quite limiting, I highly recommend this program. And it's free now to boot! https://itunes.apple.com/us/app/forklift-file-manager-and-ftp-sftp-webdav-amazon-s3-client/id412448059?mt=12
  18. Update : Early days and take it with a slight pinch of salt, but we've seen some positive uptick in our behavioural stats. Session duration up 5.3% vs previous month, Pages per session up 9.6%
  19. Has any one used this tool before to extract out their critical path css? https://github.com/addyosmani/critical If so, I was wondering how did you get it to work in relation to a PW site? If for example you wanted to optimize the Homepage, is it matter a saving the (generated) html file from the browser and putting it on /site/templates/ and calling the critical exe with the correct parameters?
  20. Has anyone come across this issue where Amazon Cloudfront seems to refuse to cache a certain small number of static objects? I've tried invaliding the cache (root path) several times to no avail. I had a look at the file permissions of the objects in question, and they seemed all ok. I've also gone into the Amazon Console and there are no errors logged. You can see more details of this here : http://www.webpagetest.org/performance_optimization.php?test=171106_A4_be80c122489ae6fabf5e2caadcac8123&run=1#use_of_cdn I recently upgraded this test site to PW 3.062 from PW 2.8.x and noticed this was happening. I'm also running the latest version of Procache on this site.
  21. Thanks for your advice. I will do as suggested. Never expected a simple syntax idiosyncrasy like that would completely catch me out.
  22. Hi there, A colleague of mine is trying to get our site running on his local Ubuntu LAMP Setup (Ubuntu 17.10, Apache 2.4.27, PW 3.0.62, PHP 7.1.11) When he types in the Homepage URL, he's getting code outputted instead of being executed. Does any one know why? Update : Just Figured it out. Apparently, it's a new PHP7 security feature that disables from code executing if the code module starts with <? instead of <php I'm using MAMP locally so I'm guessing MAMP is somehow circumventing this but LAMP isn't. I'm posting this so people can save themselves hours pulling their hair out.
  23. I've just upgraded to PW 3 (3.0.62) and I'm seeing minor speed improvements on our Test Server. Before : 3.9s for full document load After : 3.7s for full document load Edit : I was on PW 2.8.x previously
  • Create New...