-
Posts
11,185 -
Joined
-
Last visited
-
Days Won
372
Everything posted by adrian
-
Take a look at: https://processwire.com/talk/topic/8410-module-toolkit/ - among other things, it lets you export a module along with all its settings and install again, already configured. It is still alpha/early beta for some features, but I do hope to get it finalized soon. Back to Tracy: I have a question for you guys. With Tracy Debugger, PW's debug mode doesn't really change error reporting anymore. It is controlled by this module and is currently restricted to superusers. So I am thinking of the need to sometimes debug when logged in as a non-superuser/guest. So should I make the module work for non-superusers when PW's debug mode is on? Or maybe a separate setting altogether than turns it on for non-superusers? Or should there be a separate config setting for enabling certain users or roles to have Tracy enabled for? Would really appreciate your thoughts on this - thanks!
-
Sorry - I didn't check non-superusers after the recent change to the Show Debugger Bar settings. The latest version (just committed) should fix that new error! PS, I'll be adding this to the modules directory in the next couple of days, so updates will be easy via the PW Upgrade module (http://modules.processwire.com/modules/process-wire-upgrade/).
-
Sorry about that - it was due to the change in that setting from being a single checkbox to an array with two options. The error should go away after saving the config settings again, but to ease the update, I have added a check that will prevent the error.
-
Sorry, I still really don't get the point. Using number_format to round a value with less than 4 decimal places ends up displaying blank/non significant zeros, eg: echo number_format(0.12, 4) results in: 0.1200 Why do you want to display the extra zeros? I still don't see why "round" isn't working for you. I think this is a very useful addition - stay tuned - hopefully coming soon! It doesn't allow for breakpoints and step-throughs. Its features are: Logging dump() to DOM barDump() to the debugger bar log() to file fireLog() to the console (both Chrome and Firefox) objects and arrays are presented in a fully expandable tree interface Error reporting Visualization of errors, exceptions, warning, notices etc with a full expandable and linked Call stack, which I find incredibly helpful in isolating the source of the error. Can be to DOM or debugger bar Automatic emailing of errors in production mode Timing Total execution time Logging of custom calls for sections of code System Info Details on php and apache versions Max memory allocation for the page Number of includes files, classes and traits ProcessWire Information Access to all the info from the Debug Mode Tools on the front-end via the PW panel in the debugger bar Extra sections to the PW panel with details of the current page, its template, the fields of this template Debug Mode indicator - nice reminder/warning in case you forget to turn it off once the site is live Links to various context relevant places in the admin, as well as general admin links Hope that helps to answer your question. I am looking for feature suggestions, like @matjazp's idea for showing all available variables. I will probably also add functions and classes too. I am also looking to include some other Tracy plugins, like performance monitoring panels. I haven't seen that issue with the bar taking up more than one line. I have tested in Chrome, Firefox, and Safari. What browser are you using? Can you show me the dom of the bar so I can see what might be causing that? I have added the option to disable the bar on the backend. I went with just two checkboxes, one for the frontend, and one for the backend. I think this works well and I agree, the module is often not needed in the backend, although I am really enjoying using it for module development - it's so nice to be able to dump variables to the debugger bar, or console when it would otherwise be impossible to get them to display without logging to a log file. I have changed the description for the email address - thanks for picking that up. I have also added options to disable the Methods Info panel and the DebugMode Indicator - users upgrading will need to revisit your config settings to enable these.
-
@pkmarkosarnych - thanks for your input, but the software you are suggesting is not useful in this situation as the OP is trying to link to map file with many URL parameters and without an image file extension.
-
Hey teppo - I like Google's translation of your role on the board of directors of Street Workout Pori ry. How do you look in a maid's uniform? PS No sexual stereotyping intended - just a lame attempt at humor PPS Maybe that translation is legitimate - just sounds strange to an English speaker as it's not a term we would use for a role on a board of directors.
-
Hi @Spica, Interesting that no-one has reported that until now Anyway, it should be fixed in the latest version. Please let me know how it goes for you and thanks for the report. BTW - I made it so that only the "number" portion of the field is considered for the required check.
-
A quick update - I have added a row of buttons to various parts of the PW admin at the bottom of the PW panel. The big news though is that I found out the FireLog() actually works with Chrome too. You just need this browser extension: https://github.com/MattSkala/chrome-firelogger https://chrome.google.com/webstore/detail/firelogger-for-chrome/hmagilfopmdjkeomnjpchokglfdfjfeh This is awesome for debugging AJAX calls.
-
I understand that round() converts a number to a float before rounding, but I don't understand how you are getting a rounded result of: 1.0 for the Tracy timer - what actual value would ever get rounded to 1.0 - it should remove the decimal place completely and leave just: 1 - shouldn't it? I feel like I am missing the problem here somehow - sorry for being dumb. Do you have any suggestions on how to fix what you are seeing?
-
Just a quick comment as there has already been lots of great info offered up. SVGs are an amazing way to make interactive data visualizations, whether you use charts, maps, or colored icons, or diagrams. They are especially cool if you using data binding techniques via something like Angular, Meteor, or React, or one of a gazillion other new JS frameworks
-
@matjazp - can you please see what happens if you specify different sleep intervals. I am occasionally getting 1.0 etc, but changing the sleep value usually results in something with 4 decimal places. @Ipa - I expect you might have debug mode turned off. That feature currently needs it turned on, although I'll see if it makes sense (or is possible) to get that to work without it on. On another note, the current version has a new debug mode badge which I think is a very useful reminder: Also, I have dealt with the issue of incorrect location reporting when calling the TD:: or shortcut/alias methods, so location reporting is now on by default. I think it's a handy addition. For those of you who are updating, you'll need to set this manually, so check the "Show Location" checkboxes in the module config settings. This means that there is really no reason to ever call the native Tracy methods, so I have removed that info from the first post and the Github ReadMe.
-
Hi @jrtderonde and welcome to the forums. The first thing I notice is that you are uploading the file directly to the assets/files/page_id/ location. You should upload to a temp directory first, then $new->image->add('full_temp_path'), and then unlink from that temp location.
- 4 replies
-
- 2
-
-
- wireupload
- page
-
(and 2 more)
Tagged with:
-
New "Method Info" panel to give a quick rundown of each method and their available aliases/shortcuts:
-
Right - it comes down to when your version is initially defined vs the one in this module. When I tested re-defining one of these shortcut methods, it was in a template file, which is after this module, which is why I added the option to disable these as needed.
-
Thanks @tpr for the confirmation of decimal places. So am I right in assuming that you unchecked "t" from the Enabled Shortcut Methods setting and it worked as expected? Of course I could add a TD::t() option, but I feel like I might have already gone overboard here Thanks - corrected now!
-
Weird - I am not seeing that at all - could you please post exactly how you are calling this? Also, how many times have you reloaded the page. As you can image if the result was 3.100000000 it would round to be 3.1, rather than 3.1000, although it seems unlikely that the result would only have 2 significant figures. I am wondering what might be different on your setup. I don't see why PHP version would matter and can't think of anything else. Anyone else out there seeing only one decimal place?
-
That's weird - it was actually a git issue - I had already changed the filename locally to match the require statement, but git didn't update it when syncing. Looks to be fixed now.
-
I just added the fireLog method: TD::fireLog() fireLog() fl() To make this work you need to have added these extensions: Chrome: https://github.com/MattSkala/chrome-firelogger Firefox: http://www.getfirebug.com/ http://firelogger.binaryage.com/
-
Sure, it is now rounded to 4 decimal places. This matches the precision of PW's built in Debug::timer() which of course you could also use and dump or bardump to Tracy. Is that what you were getting at? I have also added the name of the timer to the output - if you specify it like: t('first'); sleep(1); bd(t('first')); t('second'); sleep(2); bd(t('second')); This way you can have multiple timers and output them at once, and know which value responds to which timer. Please let me know if that is better for you, or if you have any more specific suggestions.
-
I think that sounds like a decent approach, so I just implemented it. Now there is no need to worry if for some reason you want to make direct calls via (Tracy\Debugger::method()) on a live site as non-superusers will just get the dummy methods which return nothing. I also just implemented the TD::timer() method, along with timer() and t() shortcut aliases. With timer() you can do: t(); // insert resource intensive code here bd(t()); to dump the results of the time to the debug bar.
-
Add field to specific position in existing template
adrian replied to didhavn's topic in API & Templates
I don't understand why you can't get a list of templates via wire('templates'). foreach(wire('templates') as $t) { echo $t->name . '<br />'; } will give you a list of template names. As for adding the field to the template of a different page, this works - just watch $this vs wire() depending on your module setup. $f = new Field();$f->type = $this->modules->get("FieldtypeRangeSlider"); $f->name = 'servicetype_' . $page->name; $f->label = 'Service-Type ' . $page->get('title')->getDefaultValue(); $f->set('suffix','%'); $f->set('tags','servicetype'); $f->set('icon','fa-sliders'); $f->save(); $template = $this->templates->get("name_of_other_template"); $existingField = $template->fieldgroup->fields->get("body"); $template->fieldgroup->insertBefore($f, $existingField); $template->fieldgroup->save(); Maybe we need to see some more of your module code to help with the $event and getting the template from that? -
In followup to that last post, I decided to add an option to load the Tracy library for non-superusers. This will NOT show errors or the debug bar for non-superusers. It just loads the Tracy library so that you can call Tracy methods directly, eg. Tracy\Debugger::dump() without non-superusers getting a "Fatal error: Class \'Tracy\Debugger\' not found" fatal error. The downside to this setting is that the library is loaded for everyone - while it may not be a significant increase in resources, it is still something, so in general I recommend leaving this unchecked.
-
Just been playing around with shortcuts to the various dump/log methods. TD::dump() TD::barDump() TD::log() TD::fireLog() TD::timer() You can now also use these shortcuts/aliases: TD::dump($var) dump() d() TD::barDump($var, $title) barDump() bd() TD::log($message) l() Just in case you are wondering, log() is already defined in PW, which is why it is not included here. TD::fireLog($message) fireLog() fl() TD:timer($name) timer() t() These aliases/shortcuts can be disabled in the module config setting, either altogether, or individually, just in case you have functions with the same names defined them elsewhere on your site and are getting a "previously declared" error. I'd really appreciate any feedback on these shortcuts/aliases - I think they make dumping/logging substantially quicker, but I am definitely open to suggestion/criticisms to this approach.
-
Try "lng" instead of "long"