-
Posts
16,772 -
Joined
-
Last visited
-
Days Won
1,530
Everything posted by ryan
-
I think that the error is here: $p = $pages->get("/buchhaltung/buchungen/")->children("title=$c"); $p->delete(); $p is a PageArray (the return value of the children() method), not a Page, and there is no delete() method on a PageArray. What I think you want is the child() method (which returns 1 page) rather than the children() method: $c = $sanitizer->selectorValue($input->post->delpage); $p = $pages->get("/buchhaltung/buchungen/")->child("title=$c"); if($p->id) $p->delete(); Also, you might want to use the 'name' or 'id' property rather than the title. The reason for that is that 'title' is not guaranteed to be unique, whereas 'id' is guaranteed to be unique system-wide, and 'name' is guaranteed to be unique for all children of a given parent. $name = $sanitizer->pageName($input->post->delpage); if(strlen($name)) { $p = $pages->get("/buchhaltung/buchungen/")->child("name=$name"); if($p->id) $p->delete(); }
-
Antti, it looks like this is a result of output formatting being on, so it's doing a string comparison rather than a time comparison. This is not intended and not a detail people should not have to account for, so I'd consider it a bug. Thanks for tracking it down. The bug is only for in-memory finds on date fields, not database finds, as it's working how it should there already. I've put a fix in the latest commit to the dev branch of you want to try it out. It shows two files updated, but the only one that matters here is /wire/core/Array.php https://github.com/ryancramerdesign/ProcessWire/commit/393e420fc8ab60670dc4c874dd8436789be2897c
-
Clouds move for me (chrome in OS x, and safari on iPhone). Though Soma is very good with details and its possible he's got the quantity and speed of clouds hooked in to your local weather conditions.
-
I think you can just replace the module.
-
Another factor is that I don't think the MapMarker works when placed in other tabs. I think gmaps probably just needs to be visible when the editor is rendered in order for everything to work optimally.
-
To test if cache is working put a sleep(5); in your template. View the page--should take 5 seconds. View it again and it should be instant, as that sleep never gets executed. Again, make sure you are logged out. Don't bother with FieldtypeCache. That's only useful in specific situations, and they are pretty rare. I will probably remove that module from the core at some point.
-
A cache file is locked until completed being written. I'm guessing the requests are coming at it before it can complete the cache. That might explain the longer time it takes here, as you might have a few requests trying to both generate and cache the page. Though double check that it has permission to create the cache file in site/assets/cache/Page/. Does your page being rendered save or delete any pages? Also note that a cached page is not the same as a static page. All hooks still get executed, permissions checked and such. Just the template output is cached. That can help a lot in some instances. But if your template isn't doing anything time consuming, then it won't make any difference--no reason to use cache in such an instance.
-
Btw, you mentioned the "cache module", and I think you must mean MarkupCache? This is for partials rather than entire pages and it's something different from template cache.
-
Make sure you are logged out too. Pages aren't cached for you when you are logged in. There are other factors that can disable the cache, but most under the template settings. And of course a page is only cached once the cache has been generated, so if you are hitting a bunch of pages for the first time in an hour then it's likely none of them were cached. In general, cache is only used for the 'guest' user. I am working on a so called super cache module that bypasses both MySQL and PHP. It uses the apache rewrite engine to pull cached urls directly from static files.
-
Module Stable version: The ACE Editor, your new favorite Inputfield
ryan replied to Adam Kiss's topic in Modules/Plugins
Nice job Adam!! Please add this to the modules directory when you get the chance. Also, I suggest removing the "permanent=true" from your getModuleInfo() because otherwise it is uninstallable. -
Find child pages with $page->children but prohibit access via their URL
ryan replied to bytesource's topic in API & Templates
There isn't a setting to do that, but you can accomplish it pretty easily from a selector: $page->children("template!=some_template"); $pages->find("template!=some_template|some_other_template"); Or, even better, specify the template you want: $pages->find("template=good_template"); -
Most of the web servers I use don't actually have git, so I'm usually just doing this: mv wire wire.old mv wire.new wire When a server does have Git, I'll usually keep the repository somewhere outside of the webroot. Then I'll basically do the above, replacing the wire directory with the new one, after a git pull. But my repository will live in a 'src' directory off of my [non web accessible] home directory. I keep it non web-accessible so that there isn't an extra uninstalled copy of PW lying around the server (which wouldn't be safe). Perhaps there's a better way to go about this, but since most upgrades only involve replacing the /wire/ directory, I don't usually find it necessary to have the live core files themselves version controlled. Sometimes the /index.php and /.htaccess file will also need to be replaced, but that's fairly rare.
-
Looks okay to me. You might want to account for other possibilities too, like https, etc. $url = preg_replace('{^.+://}', '', $dealer-website);
-
I'm really happy with the new site too. I wish I could take credit for some part of it, but didn't have anything to do with the design or development (other than some last minute tweaks before launch). It was designed and developed by the forum community here. The designer asked not to be named yet until the site is fully done (we consider the current one a 'soft launch', and some changes are yet in store). Though I think he should take credit, because the site looks great. Antti and Soma did most of the primary development, and I think Teppo did too? Most of the development took place awhile ago, so please let me know if I'm forgetting anyone. Several of us also participated by offering feedback through the process. These guys did all this months ago, and they were patiently waiting on me to take care of a couple thing and launch it, which I finally did last week. In addition to viewing this site on the computer, I'm loving how it works on the iPhone and iPad. Antti initiated use of the Goldilocks approach in the development, which seems like the best responsive way to go. Something that I think still needs some work on the homepage is the screenshots. I'd like to setup a few different sets of screenshots that can appear there, where what you see now is just one example. If anyone has any good screenshots they think would work there, please send them over and we can test them out. I agree about the headline so went ahead and changed it after a couple comments here mentioned it. Since we're already showing the sky, we probably don't need to literally say "the sky". I think the headline still speaks well if you think of it in relation to skyscrapers, but the current headline (build bigger, faster, stronger, easier) probably has better substance, especially when combined with the new look. But keep thinking of new ideas too, we may be able to find something even better.
-
Looks great Nico. Just a couple small suggestions: 1. Rather than using $_POST, it's better to use $this->input->post or wire('input')->post, because it's always possible that $_POST could be affected by the server's magic_quotes setting. 2. When loading or writing to a file, add some extra validation so that someone can't hack through it and start viewing and modifying other files on the server. Example of one way you could do it: $name = $this->config->paths->templates . $this->sanitizer->name(basename($this->input->get->file)); if(!is_file($name)) throw new WireException("Template file not found"); 3. Your execute() method returns a form witha 'delete' action, but I can't see any implementation of that?
-
I'm really not sure what to think about the PHP 5.4 error message. If inheritance is no longer fully working in 5.4, it seems like we'd have problems all over the place. This really rings of a PHP 5.4 bug. But it's easy enough for me to duplicate those __get() and __set() methods back into the class directly in the SessionHandlerDB module, so I went ahead and did that (and it's now on GitHub). Hopefully we can remove this duplication later, but it'll be easy enough for us to work around for now.
-
Thanks for the introduction Casey and welcome to the forums. Glad you are enjoying ProcessWire and we look forward to seeing more of you around here.
-
I just submitted a pull request to Antti that makes it work with 2.3 (2.2.10). Also updated it so that it deletes the thumbnails when you delete the parent image. My updates are here: https://github.com/ryancramerdesign/Thumbnails
-
Looking in the ProcessCropImage code, I think I see the problem. It is constructing image URLs manually rather than asking the page for the images path. This was perfectly fine up until we introduced the secured images option (on the dev branch) which uses a different path for secured images. But this wil not work with 2.3. I'll attempt to submit a pull request for this module.
-
Marc, let me know what you find. I just need some way to reproduce it, but once I can do that I can fix it quickly. If I can't reproduce it here, and you don't mind giving me access to troubleshoot your install, I'll be glad to do that.
-
Glad you found it. Eventually I think we'll have to add a 'default sort' option for repeaters, so that they automatically sort by some field present in the repeater.
-
Sure! You just need to know the name of the field (usually the same as the 'name' attribute) and then you can grab it directly from the Field object. Writing in browser here, but think it should work. It assumes you are somewhere in an Inputfield. $field = wire('fields')->get($this->attr('name')); if($field->textformatters) foreach($field->textformatters as $className) { echo "Name: $className"; } Many Inputfield functions already receive a copy of the $field, in which case you can just use that ($field->textformatters) rather than figuring it out yourself. Only text fields will have a 'textformatters' array, and you'd want to double check that it's actually present before using it.
-
70% is a seriously large quantity of mobile traffic. I agree, if that's what your analytics tell you then mobile first all the way. Most of the sites I work with have mobile traffic at a similar level to IE6 traffic. Which is to say, not much. But the trends are always increasing (unlike IE6).
-
The simplest way would be just to post-filter them after your search. Meaning, whatever code you have outputting the found pages would just check the status and skip over any that had unpublished parents. foreach($items as $item) { $skip = false; foreach($item->parents as $parent) if($parent->is(Page::statusUnpublished)) $skip = true; if($skip) continue; // otherwise item is good to output echo "<li>$item->title</li>"; } But if you are also working with pagination, then you kind of need to have these things filtered ahead of time. In that case, I think Soma's method would be good. The hope is that you don't have too many unpublished pages to be found, that could slow the query. One way to further optimize that would be to find only unpublished pages that have children. $up_pages = $pages->find("status=unpublished, numChildren>0");
-
Once you've got your form, I think it'll be fairly easy to develop this. But your date fields are the only thing that's going to need a little extra work. Since you are asking for just month and year (no day) you'll want to qualify that to the beginning of the first month and the end of the second month. Finding the beginning of the first month is easy since all months start at day 1. There are various ways to find the end of the second month, but there's one way in my example below. Here's how I might perform the query from the API side (written in the browser so may contain typos): // where we will store our $pages->find selector $selector = array(); // add the search query if present if($input->get->search) { $search = $sanitizer->selectorValue($input->get->search); $selector[] = "title|body~=$search"; } if($input->get->yearFrom && $input->get->monthFrom) { // construct date like 2012-12-02 and convert to timestamp $dateFrom = strtotime("{$input->get->yearFrom}-{$input->get->monthFrom}-01 00:00:00"); if($dateFrom) $selector[] = "date>=$dateFrom"; } if($input->get->yearTo && $input->get->monthTo) { // do the same for month-to, but find the beginning $dateTo = strtotime("{$input->get->yearTo}-{$input->get->monthTo}-01 00:00:00"); // now find the end of dateTo month by adding 1 month and subtracting 1 second if($dateTo) $dateTo = strtotime("+1 MONTH", $dateTo) - 1; if($dateTo) $selector[] = "date<=$dateTo"; } // determine and validate the max records to show $limit = (int) $input->get->limit; if($limit > 50 || $limit < 1) $limit = 10; $selector[] = "limit=$limit"; // specify the template we are limiting the search to $selector[] = "template=article"; if(count($selector)) { // perform the search $selectorString = implode(', ', $selector); $articles = $pages->find($selectorString); echo "<h2>Found " . $articles->getTotal() . " articles matching your query.</h2>"; echo $articles->render(); // or however you want to output them } else { echo "<p>No search specified.</p>"; }