Jump to content

szabesz

Members
  • Posts

    2,959
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by szabesz

  1. Hi, First time I have installed it, mainly to see what the button "Debugmode" does. It does not do anything: href='javascript:;' Am I missing something?
  2. Maybe it is those "running one or two vm's at the same time" which are the resource hoggers? I sometimes run PhpStorm, Photoshop, Illustrator, InDesign and many others parallel on a 4GB ram + SSD Air without running into performance problems. Sure, the number of running VMs is zero in my case
  3. @tpr Good point! The same is true in my case. It is gently leading me to the right direction. I could not ask for more in this regard
  4. Brackets is fantastic when working with its live preview feature, so I use it when working on JavaScript based prototypes. That way I do not have to refresh anything. However, Brackets is an editor not an IDE and live preview cannot be used with php generated output.
  5. Well, I do not want to praise PhpStorm too much, and it is certainly true that I can get lost in the preferences panel, since there are thousands of settings in it. But the preferences panel has its own search feature that helps sometimes (when one knows what that thingy is called). Still, if you spend the time to set it up, you can adjust it to your likings. It's main interface is clean. Just by clicking on the sidebars or using the equivalent keyboard shortcuts (Project, Structure, etc) and using shortcuts for everything else, one can quickly perform any action easily. Being a Java application it takes some time to boot up: a few secs (v10 has improvements in this area too), but if you launch it in the morning and quit it in the evening than it does not make a difference, it is an IDE after all. Afterwards it is a speedy beast. It is _not_ Eclipse, Eclipse is the worst IDE I have ever used, so I do not even want to compare them I also like its history feature which is quite useful even when also using git at the same time. When experimenting with code, it is handy that one can revert back to (or copy form) any previous saved state of a file. And yes, BBEdit is super cool, which is my primary code editor when not working on the files of a PhpStorm project. And even if I'm in a PhpStorm project I sometimes also use BBEdit to perform specific tasks. Why not use both if possible?
  6. PhpStorm is the best The current version's code-completion is super intelligent, I have never been able to type code this fast with any other IDE or editor. Finding your way around in the code is well supported too. Search is powerful, it helps a lot when you have to dig in code not written by you. At least, PhpStorm is worth a look at https://www.jetbrains.com/phpstorm/
  7. @Tom: Thank you for the effort! I hope that your ideas and work will pay off and they will be picked up by the community so that we can have an even better admin in the future. The general issue is that the admin interface is used for both development (by the devs, of course) and for content management (by site administrators). When developers try to mix the two, they will most certainly design something that is more for development then for content management as this is the case with ProcessWire. Do not get me wrong, I think ProcessWire has a nice admin interface, but there is a lot of room for improvement regarding content management. (And regarding the aid of development too, see for example Soma's HelperFieldLinks module, but that is a bit off topic here.)
  8. Thank you for sharing! It would be nice to have this feature built in.
  9. But that's not realy cool cause the user will not see his exact name.. Why is it a problem if a user does not know how her name is stored in the database? Or am I missing something?
  10. Using your own two or three character prefix (plus _ or -) to name identifiers can be of help no matter what system we use (css, php, js, etc...). This way it is also easy to tell what belongs to your code and what not. It helps in this issue, but also helps others dealing with your code. Sure, the practice of prefixing is not a bulletproof solution, but it is unlikely that one runs into this issue when sticking to it.
  11. In the case of PhpStorm 10 there is noticeable improvement regarding startup time, an projects open up faster too. However, being a Java application, there are limitations I think. PhpStorm is a really good IDE, but it is rather project centric so one do not want to use it just to open up files not in a project but somewhere else on your disk just to inspect them.
  12. Sure, but horst's idea does not rule it out. If you process the image right after the upload, you (the admin user) need to wait for the resizing process, but what if you change your mind before checking the related page on the frontend and decide to re-upload the image? In that case you need to wait twice, or more (depending on how many times you have changed your mind). So the answer to this question is not as straightforward as it might seem at first.
  13. What might really expose ProcessWire is a book on packtpub.com. These books really helped me to jump start website development about five years ago: http://www.amazon.com/SilverStripe-The-Complete-Guide-Development/dp/0470681837 https://www.packtpub.com/web-development/silverstripe-24-module-extension-themes-and-widgets-beginners-guide I especially liked the first one (The Complete Guide to CMS Development). Nowadays ProcessWire is a lot more beginner friendly then SilverStripe (for example) except that there isn't a well organized book/tutorial for beginners. Such a tutorial should not just scratch the basics, but give an example of how to develop a somewhat complex, database driven website. The above mentioned books did achieve that. (They are outdated and have never been updated, but still good examples.) And I agree that upgrading the cheatsheets with lots of examples is a good idea. I spent 7 years developing Flash/ActionScript games and websites, and I loved the docs Adobe created for ActionScript. It was packet with lots-and-lots of code snippets, most methods had one ore two (or even more) examples, one just had to copy+paste them and tweak them to their liking. Php.net's idea of utilizing the developers to add notes and code snippets is one way to do it, so besides adding "official" snippets, commenters should be able to add their own too. The new WordPress docs site does the same.
  14. I guess you have an up-to-date version of MAMP (which I do not have at the moment since I do not upgrade MAMP too often) https://www.mamp.info/en/downloads/ And reading the sidebar, it ships with PHP 7.0.0 too. Do you happen to use it? I run ProcessWire 3.0.5 on PHP 5.6 and do not have any "deprecated notices". Anyway, since it is just a "deprecated notice", it should not be the cause of a 500 Internal Server error, but you might want to try switching to PHP 5.6. Have you tried to install ProcessWire from scratch, so that you can see if that works? Edit: PHP 7 maybe just an optional addon, and it does not yet ship with it.
  15. The docs says: $page->of(false); // outputFormatting must be OFF https://processwire.com/api/multi-language-support/multi-language-fields/#getting-and-setting "The value of a multi-language or language-alternate field is affected by the "outputFormatting" setting of a page. On the front-end of your site, outputFormatting is always turned on, unless you've turned it off." "When outputFormatting is ON, the value of a multi-language field is a string (as it shows in most examples on this page). That string reflects the value from the current user's language. If the value is blank in the current user's language, the value from the default language will be there instead. However, when outputFormatting is OFF, the value of a multi-language field (like $page->body) will instead return an object of type LanguagesPageFieldValue, rather than a string. That object contains all of the translations available for the given field." I'm not sure that this solves anything, I'm just guessing. Sorry if I'm mistaken.
  16. What sort of errors are you getting? You can find the log files here: /Applications/MAMP/logs/apache_error.log /Applications/MAMP/logs/mysql_error.log /Applications/MAMP/logs/php_error.log or just use MAMP's Log menu.
  17. Thank you again Ryan! May I ask a couple of feature related questions? I have just tried out this module for the first time and noticed the following: 1) It is not possible to exclude modules. Admin related modules are not needed in many cases (such as ProcessDatabaseBackups, ProcessWireUpgrade, ProcessExportProfile, etc...) and it would be nice to be able to optionally exclude them. 2) Custom folders? Since I followed what is recommended here: https://processwire-recipes.com/recipes/best-way-to-implement-a-global-helper-function/ I already have one custom folder called "lib" in my /site folder and my template files use its content. However, the exporter ignored this custom folder. Did I overlook something or is it really the case and I have to manually copy "such things" over? 3) Extra lines inserted into the end of config.php? I also have extra lines inserted into the end of config.php. It would be nice, if it was possible to optionally inject these extra lines of code to the end of config.php, so that the ProcessWire installer uses the "core config.php" file, but modifies it by adding extra lines to it, lines that are required by the Profile. I have a require_once(dirname(__FILE__).'/lib/Flog.php'); piece of code, and although it is possible to include config.php in the Profile itself, being able to automatically "extend" config.php during the installation process seems to be a better solution. Or maybe I am just overlooking something Sorry if it is just a silly request and there is already a proper way of doing this, of which I know nothing about. Edit: maybe it is not just config.php but .htaccess too that we should be able to extend the above described (or similar) way.
  18. There is an article about the role of Page in the old Wiki. It is still a good starting point, even though it is a bit hard to understand this article without some actual experience with Pages: http://wiki.processwire.com/index.php/Pages_Overview What I would find useful is the addition of schematic diagrams that help beginners picture the concept. Trying to explain it by using only words resulted in this sort of convoluted article. A picture is worth a thousands words Not to mention lots of simple examples, that help explain different scenarios in which Page is used.
  19. This one is also worth reading: URL Segments in category tree example: http://wiki.processwire.com/index.php/URL_Segments_in_category_tree_example
  20. @benbyf You might find this class useful if you want to introduce the classic way of php debugging: https://processwire.com/talk/topic/4550-debugging-tips/?p=110290 Another thing that might be of interest is a short introduction to the main components of ProcessWire. What important building blocks are used in the CMS/framework, what they are for, how they work together, and which ones should be further studied as starting points, how modularity is implemented (CMS vs CMF). Such as: message system, logging system, 3.x compilation, wire calls, etc... Something similar: cms architecture diagram And links to Ryan's blogpost or other related doc pages for further study. I have not found anything similar so far, and it would help me a lot, I'm sure
  21. szabesz

    Debugging tips

    I have further refined this class. For instructions, you can read the comments in the code, or this: https://processwire.com/talk/topic/11782-pw-tuts-elsewhere-on-the-web/?p=110131 <?php namespace ProcessWire; /** * Flog.php: Can be used to inspect variables for debugging purposes. * * Example usage: * - If NOT running ProcessWire 3.x or higher, remove namespace ProcessWire; * - Create a directory called lib in your /site directory and put Flog.php into it. * - Insert this line into config.php: require_once(dirname(__FILE__).'/lib/Flog.php'); * - In the case of frontend debugging, start the rendering of the output * by calling Flog::init() before your code does anything else (for example * it could be the first line in your _init.php). * * - example log entry for PHP 5.5.x and below: Flog::log($page->children(), 0, 'kids', __FILE__, __LINE__); * - example log entry for PHP 5.6.x and above: Flog::log($page->children(), 2, 'kids', __FILE__, __LINE__); * * TIP: Use a shortcut to insert this code snippet into your code: Flog::log($var, 0, '', __FILE__, __LINE__); * then edit the first three parameters accordingly. Read all the other notes below for more information. * */ class Flog { protected static $name = 'flog'; // name of the log file protected static $firstSave = true; // no variables have been logged so far? /** * Initializes the class. Call it once before you start calling Flog::log() * The log file can be found in /site/assets/logs/flog.txt (assuming $name = 'flog') * */ public static function init() { if(!file_exists(self::filename())) { self::log('f-log debug file created...'); } @ini_set('error_log', self::filename()); // so that the same file is used for runtime errors as well } /** * Call Flog::log($my_variable) to log a variable. * * NOTE: the Wire class customizes the output of print_r (__debugInfo) when running on PHP 5.6+, so the $print_r * parameter can be used to output objects this way. * * @param mixed $var Any variable or expression to be logged. * @param 0|1|2 $print_r 0: print_r is not used, 1: print_r's output in one line, 2: formatted print_r output. * @param string $info Any string that helps identify the output, such as a variable name. * @param string $file Should be __FILE__ to identify the caller. * @param string $line Should be __LINE__ to identify the caller's line. * */ public static function log($var, $print_r = 0, $info = '', $file = '', $line = '' ) { $type = ''; $pretty = false; $php56plus = version_compare(PHP_VERSION, '5.6.0') >= 0; if (gettype($var) != "object") { $type = "[".gettype($var)."]"; } else { $print_r >= 1 && $php56plus ? $type ='' : $type = "[".get_class($var)."]"; } if (is_array($var)) { $var = json_encode($var); } elseif ($print_r >= 1 && is_object($var) && $php56plus) { if ($print_r == 1) { $var = print_r($var, true); // reformat whitespaces: $var = preg_replace('/\s+/s', ' ', $var); $var = str_replace(" => ", '=>', $var); } else { $pretty = true; } } if (self::$firstSave) { self::$firstSave = false; wire('log')->save(self::$name, "________________________ Flog.php _______________________"); } if ($file) { $file = basename($file, '.php'); } if ($pretty) { error_log(print_r($var,true)); // works in PHP 5.6.x and higher } else { wire('log')->save(self::$name, "$file $line $info $type $var"); } } public static function filename() { return wire('log')->getFilename(self::$name); } public static function name() { return self::$name; } }
  22. Edit: an updated version of the the following class can be found here: https://processwire....-tips/?p=110290 <?php namespace ProcessWire; /** * Helps with the debugging log */ class Flog { protected static $name = 'flog'; protected static $firstSave = true; public static function init() { if(!file_exists(self::filename())) { self::log('f-log debug file created...'); } } public static function log($param, $file = '', $line = '') { $prepend = ''; if (gettype($param) != "object") { $prepend = gettype($param); } else { $prepend = get_class($param); } if (is_array($param)) { $param = json_encode($param); } if (self::$firstSave) { self::$firstSave = false; wire('log')->save(self::$name, "________________________ Flog log _______________________"); } if ($file) { $file = basename($file, '.php'); $line = $line . ' '; } wire('log')->save(self::$name, "$file $line"."[$prepend] $param"); } public static function filename() { return wire('log')->getFilename(self::$name); } public static function name() { return self::$name; } } The original class was dubbed Debug, which is used in the ProcessWire namespace, so I had to rename it. The "Flog log" line helps me quickly identify the various "logging sessions". File and line number can be used to identify the states of the same variable and later on to clean up (delete) all the temporary log method calls. I use a shortcut to quickly insert Flog::log($var, __FILE__, __LINE__); into the code, I just have to overwrite the variable name, and save+refresh the browser (using a shortcut in this case too). A code editor is used to keep the log file(s) open, which refreshes the open files whenever they change. I can delete lines from the log at will, since it is an actual editor. Simple but effective, I got used to this a debug workflow, since it can be used in any environment.
  23. One more thing to add. Yesterday I decided to utilize clsource's class: https://processwire.com/talk/topic/4550-debugging-tips/?p=108300 I added namespace ProcessWire; to it and modified it a tiny bit so that I can also log the class/type name of the logged variable, and the file and line number of the caller. Recommending an easy to use method for debugging (that even works in production, on whatever server this site might be running) seems to be a good idea to include.
  24. I think clsource and rick are right; even a tutorial for those new to ProcessWire should assume a general understanding of entity relationships, procedural programming, html and css, and it should concentrate on the methods and design patterns that beginners can easily implement to craft a site with typical components such as general pages, blog posts with categories and tags, a simple contact form and maybe a simple user management to protect a given page (and its children) on the frontend ("customer area"). By choosing a css framework, you can skip the design process altogether.
×
×
  • Create New...