-
Posts
11,096 -
Joined
-
Last visited
-
Days Won
365
Everything posted by adrian
-
Ok, the latest version now correctly modifies the editor path to the file in the errors panel, as well as dump() and barDump(). Thanks again @szabesz for helping so much to figure this out - sorry we got so sidetracked along the way
-
Great - thanks for confirming that the paths are correct for dump() and barDump() The class not found error will be because of the template being the ProcessWire namespace. If you are doing that, then you'll need prepend a "\" to your calls, eg: \Tracy\Debugger::dump('Test \Tracy\Debugger::dump'); \TD::dump('Test \TD::dump'); and then they'll work fine.
-
Oh, I see - I have been running in StrictMode, so haven't been noticing that - there is another location that I need to add that hack to change the path. I'll get that fix committed shortly. @tpr - is this the case for you also? Do the links from dump() and barDump() calls get converted properly?
-
Thanks! I am wondering what links are actually showing the compiled file? Can you show a screenshot of the link you are trying to click on? Here are some examples showing it working as expected: Link from a dump() Link from a barDump() I am starting to think you are talking about other links, but I am not sure what!
-
Is $loc always 0 ? If so, then that's the problem. I get it 0 sometimes - when the first result of findLocation() is a module file. But when it's a template file, $loc returns 7 At least from this: [0] => .../site/assets/cache/FileCompiler/site/modules/TracyDebugger/ProcesswireInfoPanel.inc I can see that the path in $file is matching something that the next line can remove the "/site/assets/cache/FileCompiler" component to make it the path to the original file. Can you please clarify that $loc is always 0? What if you force it to 7 on line 100? Thanks again for your help with this!
-
list() populates the $file variable from the result of findLocation(), or NULL if $loc returns false. I am not sure what's going on, but if your edit links are to the compiled file, then it would suggest that $file is being populated. Could you maybe check the value of $loc and self::findLocation() before that list() call please?
-
Hey guys, I am not sure what is going on. To make this work I have made a small tweak to the Tracy core (hopefully only temporary as I have asked them about a way to publicly modify the filepath) - you can see it here: https://github.com/adrianbj/TracyDebugger/blob/master/tracy/src/Tracy/Dumper.php#L111 Would you mind taking a look at that and debugging why it might not be working - just find out what $file contains before and after that str_replace I can imagine on Windows I probably need to replace all the "/" with DIRECTORY_SEPARATOR but it sounds like @szabesz is on a Mac so what I have should work? Thanks to both of you for helping out with this.
-
You can now click on the text of any entry in the PW and Tracy log panels to open the file in your code editor to the line number of the clicked entry. Of course for this to work, you need to have properly configured your editor protocol handler. Not really worthy of a screenshot, but still a very handy shortcut that I hope you'll find useful for when you have an log entry that has been truncated because it's too long for the built-in viewer.
-
#7 of 50: http://dailycodex.com/top-content-management-systems/ http://www.queness.com/post/14579/6-lightweight-flexible-php-cms/page/1 http://preludi.fi/blog/processwire-julkaisujarjestelma-6-syyta-valintaan
-
Processwire 3 - using the API in Open Cart - wee hitch
adrian replied to icreation's topic in API & Templates
Nice one bernhard - I totally missed the line in the OP noting that PW was being bootstrapped -
Nice one Jan Romero - I hadn't seen the use of the Selectors class and PageFinder like that. Putting it all together: $selectors = new Selectors("template=basic-page"); $pagefinder = new PageFinder(); $sql = $pagefinder->getQuery($selectors->getArray(), array("returnVerbose" => false))->getQuery(); $result = $database->query("SELECT SUM(data) AS sum_amount FROM field_amount WHERE pages_id IN ($sql)"); $sum = $result->fetch(PDO::FETCH_COLUMN); echo $sum; Note that I had an SQL error regarding "SQL_CALC_FOUND_ROWS" when I included a limit in the selector. If I removed the SQL_CALC_FOUND_ROWS then it complained of not allowing limit in IN. Remove the limit from the selector and things work just fine. Also, note that you need to specify "returnVerbose" => false - otherwise you get a php NOTICE: https://github.com/ryancramerdesign/ProcessWire/issues/1734
-
Not necessarily the answer you are looking for, but searching on Github is often very enlightening: https://github.com/ryancramerdesign/ProcessWire/search?utf8=%E2%9C%93&q=%22%24field-%3Eattr%22
-
If you didn't have so many pages I would say go for something like this where you populate the pageids from your selector in the IN clause. SELECT SUM(data) AS sum FROM `field_amount` WHERE pages_id IN ( 1234, 2412, 1234 ) But with 1 million page ids in your "IN", that's not going to work What about this: SELECT SUM(data) AS sum FROM `field_amount` INNER JOIN `pages` ON `field_amount`.`pages_id` = `pages`.`id` WHERE `pages`.`templates_id` = 29 The problem with this is that you need to reproduce your initial pages selector - in my example I am just limiting to a template. Do you think you could make this work? What is your actual selector?
-
Processwire 3 - using the API in Open Cart - wee hitch
adrian replied to icreation's topic in API & Templates
Sounds like output formatting may be off, or you have changed the Formatted Value for the field - what is that set at? Also, try this just before outputting the image and let me know what it returns. echo $page->of(); -
Processwire 3 - using the API in Open Cart - wee hitch
adrian replied to icreation's topic in API & Templates
Looks like the homeboximage field is not set to "1" for the Max Files Allowed setting. Either change that, or do: echo $homebox->homeboximage->first()->url; -
Hi everyone, Thanks to a request from @Ralf, this module now also works on the front-end. If you have setup your own login form and profile editing forms you can enable this for the front-end and specify a URL to redirect to for the user to change their password.
-
This tutorial from soma might also be useful: https://processwire.com/talk/topic/4602-flexible-downloads-using-pages/ Also, if you're working with SVG files, these two modules might be of interest: http://modules.processwire.com/modules/image-rasterizer/ http://modules.processwire.com/modules/file-validator-svg-sanitizer/
-
Pagination and filter pages with pages->find doesnt work properly
adrian replied to Juergen's topic in General Support
I think what you are looking for is whitelist: $input->whitelist($name, $value) Read about it under the getVars section on this page: https://processwire.com/api/modules/markup-pager-nav/ -
New public method: TD::templateVars() templateVars() tv() Basically what this does is strip any system PW variables and returns just those that you have defined in your template file. It replicates what is output on the "Variables" panel, but lets you dump, barDump, fireLog, or log at whatever points you want throughout the execution of your template file script. Obviously if you are only interested in the changes to one variable there is no point in using this, but if you want to see how they all change, this is a nice shortcut. It is really only designed to work with PHP's get_defined_vars() Here's an example output via barDump: bd() $i=0; $x=10; bd(tv(get_defined_vars()), 'breakpoint one'); $i++; $x--; bd(tv(get_defined_vars()), 'breakpoint two'); This results in: Without tv() in there it would include all PW variables/objects and it would be difficult to see the variables you are interested in. Note that the templateVars() and tv() shortcuts/aliases may need to be turned on in the config settings if you are upgrading.
-
Small update that enhances links from the PW Info panel Summary section - now you can have shortcuts to either view (page name) or edit (page id) each of the linked pages that are related to the current page. The children item now has: an "open tree" link (opens this page in the page tree expanded to show all children) an "edit" link (opens this page to the Children tab, which is particularly useful if you have Batch Child Editor installed). The template filename in the Template Info section uses the defined editor protocol handler to open the file directly in your code editor. Hopefully you'll all find these nice little time/click savers And page edit and template file edit buttons are also in the footer of this panel for instant access:
-
Why did you have to comment those things out?
-
Hi Esther, I have just been acquainting myself with Unbounce. It doesn't look like they offer a way to export their pages as HTML (https://community.unbounce.com/unbounce/topics/can_i_put_the_html_from_unbounce_onto_my_website). Sure you could view source, or use a browser downloader so that it grabs all javascript and css files as well, but it will be a but fiddly. It sounds like the correct way to go is to use CNAME records to handle serving of your landing pages that are hosted on the unbounce servers so they appear as part of your site. I'd still need to do a little more research to figure out exactly what is needed and what the options are, but it might be best to just go with what they recommend. Do you know what approach your web guy normally uses when hosting/serving unbounce pages.
-
The init.php file needs to be: /site/init.php Have a read about this here: https://processwire.com/blog/posts/processwire-2.6.7-core-updates-and-more/#new-core-files-for-site-hooks PS - the hook would also work in /site/templates/admin if you only want to prevent the view link in the admin. If you want to prevent separate viewing on the front-end of the site as well, then it should be in /site/init.php
-
Another approach would be a hook in your init.php $this->addHookAfter('Page::viewable', function($event) { if(strpos($event->object->template, 'section-') !== false) { $event->return = false; } });
-
How to get array of page ids by selector if there are 10000+ pages?
adrian replied to valan's topic in API & Templates
I thought I remembered there being something like that, but couldn't find it. Thanks for the reminder! PS And of course findIDs makes much more sense than my suggest getIds