Jump to content

ryan

Administrators
  • Posts

    16,715
  • Joined

  • Last visited

  • Days Won

    1,517

Everything posted by ryan

  1. It looks to me like that may be a different kind of feed than what the MarkupTwitterFeed module was designed to use. This particular feed is putting HTML inside of RSS, whereas the Twitter Feeds I've worked with were consistent with the text of the actual tweets (no HTML added to them). I would guess that the tweets with links are failing because of the extra HTML added to the links. I am also guessing that this particular RSS feed was designed for a front-end AJAX search function. Maybe there is a GET variable that can be specified to have them turn off the HTML they are adding to it? If not, it might be better not to use this particular feed, since it doesn't seems to be setup for another purpose. One other thing you could try would be to specify "false" for the linkUrls option to the module: $t = $modules->get('MarkupTwitterFeed'); $t->linkUrls = false;
  2. MarionRaven I think you are right about the reason why it's not working, because of the find(). Though not positive why it would work in the include & bootstrap context you mentioned. But I think it may be as simple as updating the two find() calls in RunSchedulePages() to have an "include=all" added to their selectors, i.e. $unpublished = wire("pages")->find("status=unpublished, publish_from<$time, include=all"); $published = wire("pages")->find("status=published, publish_until>0, include=all"); If you test it out, let us know. My only concern would be that "include=all" may override the "status=", but hopefully not. If it does, try instead to add "check_access=0" rather than the "include=all".
  3. There's nothing wrong with your code, but just a difference of context here. The issue is that a few of the in-memory selectors sometimes aren't as smart as the DB-driven ones. Your code quoted above is an in-memory find() provided by the WireArray class. It is used throughout the system, and it performs literal string comparisons. Whereas the DB-driven one is sending out queries to be answered by MySQL, often with a lot more context than string comparison. Most of the time, the two should perform the same, so this is one instance where they don't. It may be something I can account for. I hadn't noticed this before because it's somewhat rare to do this type of in-memory find() where you are finding/filtering pages based on pages within pages. In-memory finds and filters aren't ideal because it usually means that more pages have been loaded into memory than were actually needed. So it's preferable to avoid situations that result in post-filtering or post-finding, when possible. In your case, it sounds like you are going to use all the pages, but just using find() to group them differently. If you want to stick with that route, I would do this: $the_list = new PageArray(); foreach($the_articles as $a) { if($a->article_categories->has($the_cat)) $the_list->add($a); } The above also reveals the technical reason why the in memory find failed. The string value of $article_categories and $the_cat won't match unless $article_categories only has 1 category and it is $the_cat. That's why we had to use has() to compare them, which is something that WireArray::find has no contextual awareness of. I'm going to see if there is some way to make them work the same. Thanks for bringing it up.
  4. 1. Field names 'start' and 'end' are reserved words in ProcessWire selectors, so probably not good to use as field names. Actually I'm surprised it let you create fields with those names (I need to fix that, if those are real field names you put in here?). Still, I'm not sure if that would necessarily be a problem in your code example working, but it's worth renaming those fields to save any potential issues. 2. I don't see anything here that checks if the form was submitted, so it looks to me like this block of code would blank out everything on the $r page every time the form is viewed. The only time it would populate data is when it was submitted. But of course, as soon as it's viewed again, it would make it blank. So I think you need something like this, immediately after the code that displays the form: if(!$input->post->submit) continue; That would prevent it from executing all the code that populates the page below it, unless the form was actually submitted. 3. If there is more than 1 item in $hahfmember or $h, then they are all going to end up with the same values after the form is submitted. That's because you are repeating the same field names in your form, with no way to differentiate them, so they are basically overwriting each other. I recommend doing something like this: foreach($h->rp as $r) { // not that $r in a string resolves to the id, so it's the same as $r->id echo "<input type='text' name='cost_$r' value='{$r->cost}' />"; // and do the same with your other fields if(!$input->post->submit) continue; // if form isn't submitted, this skips everything below $r->of(false); // turn off output formatting $r->cost = $input->post("cost_$r"); // and do the same with your other fields } 4. I think it's always good to sanitize any input, whether using PW's $sanitizer or something else. While it's true that setting values to a page also sanitizes them automatically for most fields, I think it's always good to do your own sanitization specific to the needs of your context. I don't know what your field types are so can't say exactly what to do. So here's a few examples: // if cost is an integer $r->cost = (int) $input->post("cost_$r"); // or this to ensure it's a positive integer $r->cost = abs($input->post("cost_$r"); // or this if cost is a text field $r->cost = $sanitizer->text($input->post("cost_$r")); // or this if it's a textarea field $r->cost = $sanitizer->textarea($input->post("cost_$r)); You could go even further and validate that the values were within expected ranges, etc. 5. If you don't have something like an entities output formatter defined for all your fields that are getting populated in the form, you probably want to encode them with htmlentities() before outputting each in the form. This ensures that a quote character like " or ' wouldn't break the output. And of course ensures your field doesn't get used for malicious purposes: echo "<input type='text' name='cost_$r' value='" . htmlentities($r->cost, ENT_QUOTES, 'UTF-8') . "' />"; If it's an integer fieldtype, or a text field with a textformatter on it that already does this, then you don't need it (as it would double encode it).
  5. One of my clients specializes in putting on conferences/summits around the world, primarily focused on architecture and sustainable design. I mentioned to them how some users here (starting with Netcarver) had expressed interest in a ProcessWire meetup or conference in the UK. This client does conferences in the UK every year and they are extremely enthusiastic about ProcessWire and interested in helping us to put on a conference by letting us collaborate with their conference and share the same venues and accommodations. This would help us benefit from their expertise in putting on conferences (which they've done for more than a decade), as well as help [significantly] on costs in reserving the venues, food, hotels. I have worked with this client since 1994 (18 years), so have a very high level of trust with them. The conference would be in August 2013 and be 1.5 days in London at a major ad agency, then we'd step on a train for an hour or so and do the rest of the conference in Cambridge at Kings College for another 1.5 days (total 3 days). This would be a small but relatively formal conference with presentations and workshops covering everything ProcessWire, design and web development. We'd cover topics at a higher level than you'd find anywhere else in the world. I don't yet have an idea on costs except to say that we'd find a way to make it accessible to as large of an audience as possible, and it would be completely non profit, food and accommodations (for those that wanted it) included. Yet, it'd still be higher class and more personal than any other webdev conference. This is about a year out, so I'm interested in finding out who'd be interested in this. Please 'like' or reply to this post if you would be interested in attending (or presenting) at this conference.
  6. I should probably make the module 'add' page use an integer rather than a string. But the two can be translated to/from each other (integer -> string). 1 = 0.0.1 10 = 0.1.0 100 = 1.0.0 111 = 1.1.1 I will plan to add this clarification to the module add form.
  7. I agree with everything Pete said! Tested out here and worked beautifully. Such an easy way to install modules. Great work Soma! I was actually experimenting with something similar here this morning before work. But my version was limited to pasting in the ZIP file URL and having it install from that. Yours is so much farther along. So let me know what I can do to assist or collaborate here. I agree that it would make sense to have this buit in as a core functionality once stable. A few minor things to mention: 1. It installed under /processwire/modules/modulesmanager/ rather than /processwire/setup/modulesmanager/. So I moved it to Setup. Your instructions mentioned it would install on Setup, so just wanted to mention this in case anyone else tries it and can't find the Modules Manager. 2. Your uninstall function is named "deinstall" rather than "uninstall". As a result, it won't get executed when the module is uninstalled. 3. Rather than using mkdir() and $this->config->chmodDir, you can use the wireMkdir() function if you want to (which pulls from $config->chmodDir on it's own). 4. There are some chmod(0777)s in there. Should this use $config->chmodDir instead? 5. For lines like this (below), I'd suggest comparing the page name rather than the title, just because I can see tweaking headlines, but not changing page names. Though what we'll probably do is just setup the web service to have an option to exclude modules that aren't auto-installable, so that you don't have to perform the check at all. if(in_array('Language Packs',$categories)) continue; if(in_array('Admin Themes',$categories)) continue;
  8. Welcome to the forums er314. I think what you want may be this: $the_cat = $pages->get("template=one-category, title=cat1"); $the_list = $pages->find("template=one-article, article_categories=$the_cat"); It sounds like you might be performing this from your one-category template, so in that case you could just do this: $the_list = $pages->find("template=one-article, article_categories=$page"); In addition to the above, you might want to specify a "sort" in your selector, like "sort=date" (if you have a field called that) or "sort=title" or something like that. Though if you change your call to something like this, then it would automatically sort by whatever is defined with the /articles/ page: $the_list = $pages->get("/articles/")->children("article_categories=$page");
  9. Nico, have you had a chance to try adding modules to the directory again? We've had a lot of stuff added, but I don't think any of yours are in there yet. Let me know if you are still running into any issues with the add module page.
  10. I love the way this question is worded, but I don't understand it? Can you expand on the question? Just in case it's related, want to mention that ProcessWire already does cache any image sizes you create with $image->size(), $image->width() or $image->height().
  11. @SiNNuT: That distraction free mode looks nice. The giant left margin is a little unusual, but the result here is pretty great. Thanks for the screenshot. @mindplay.dk: I'm going to merge your changes, but on a more manual basis so I can go through each file one at a time and think through any possible hiccups or optimizations in the right context as I go through it. I have a week off coming up in August, so planning to do it then along with some other updates. Though if I get another unexpected free day off work like I did earlier this week, I'm going to get started with the PSR-0 changes earlier. Thanks again for your help with these changes.
  12. When I'm motivated, I can develop stuff in PW pretty quickly. Other stuff, not so quickly. I'm sure I have just as many personal projects in the planning stages, though almost all are at least PW-related. The advantage of the GitHub download URL is that it never changes. So the same URL always points to the latest stable version. Linking to files in the forum is more tricky, because the author may have uploaded another and forgot to update the module listing, or may have simply posted another file, etc. That's pretty much right. If we went towards an auto-installer, it would know to create a directory called /site/modules/[class-name]/ and unzip the files into that directory. The other part of it is that the class name is used as the module's URL name in the directory (after being converted from camelCase to not-camel-case). This ensures no two modules exist in the directory that have the same class name.
  13. Function param hints I can also do without, though certainly understand why people like them. I've got major ADD and anything popping up when I'm typing and thinking is a huge distraction (even if the intention is to help). But so long as everything can be disabled, and I can have my black background, all is good. I've already been using doc-blocks forever, though my to-do list has expansion of the doc blocks to include @property, @internal and others, which I've not used, so it actually would be helpful to have an editor that recognizes these things. I'm not too worried about inconsistency of code formatting, as I've stuck to the same format for years. But I can see this being helpful for the times when doing my manual pull-requests that might include copy/paste, like we talked about before. Sounds like I need to try both PhpStorm and Sublime.
  14. Thanks for adding your modules Pete! I agree I'd like to add this eventually, but really only had a day of time to put towards the directory, so decided to leave that out. I think it's adequate that users can link to their image in the forum or GitHub with the BBCode tag. When I get more time, I'll add file uploads in the directory. This one should be relatively easy with the new TextformatterVideoEmbed module. Though I think I need to modify it a bit to recognize videos in BBCode, since BBCode seems to be using double <br> tags rather than paragraphs. I'd like to do this with a little javascript attached to the <a>, so as to avoid routing the file download through any passthru scripts, especially since we aren't hosting the downloads. But we can only count the downloads that originate from people clicking our download button. We can't track git clones or downloads from there, which I'm guessing would be a significant amount. Still, that may be okay as download quantity probably is still a good factor to judge relative popularity among modules. One cool thing to consider: since we are now requiring a download URL to a ZIP file, and we're providing a web service of the data, we now have the prerequisites for automatic 1-click-installation directly in ProcessWire. It's cool to dream about anyway.
  15. @Sinnut thanks! you are way too kind. @Pete we should still be able to read from the same dir even if they aren't on the same account -- just a unix permissions adjustment which I'm sure I can figure out. @Soma Here's a web service: http://modules.processwire.com/export-json/ Use API key: pw223 Let me know if there's anything else I can add to it.
  16. Just to make sure I understand, are you asking for the modules directory to publish a JSON/XML feed, or import from one? I know you said "receive", which makes me think import, but you mentioned a modules manager (sounds awesome!) which makes me think you need a feed to read from. But the answer either way is yes. However, I could setup the directory to export/publish it's data to a feed a lot quicker than I could set it up to import it's data from another feed. If you need a feed to read from, I may even be able to get it going later today.
  17. Btw, I just wanted to mention to everyone that I would add your modules to the directory myself if I could. But currently it authenticates with the creator, so anything that I add, the author wouldn't be able to edit. I just didn't want anyone to think I didn't value a module because I didn't post it in the directory. The reality is that I can only post my own modules, Soma can only post his own modules, etc. This is the only way I know of to give each module author control over their own listings. @Pete: Regarding IPBoard, is it a problem that modules.processwire.com is running on a separate account and IP address? It's still running on the same server, but I've jailed it into it's own account, separate from the main PW site, just as a matter of good security practice. Does this create any challenges?
  18. Authors of existing modules Please post existing modules to the new modules directory as soon as you are able to. I would add all them myself except that each module gets authenticated with the author. This ensures you are able to make future edits to it. If I went and added all the modules (or imported from that spreadsheet we made awhile back), you wouldn't be able to edit your listing. This is the only reason why I haven't added/imported anyone's modules except my own. Authors of new modules In addition to creating a thread here, please post your module at the new modules directory. You might want to create the thread here first since you'll be asked for the URL when creating your entry in the directory. Add your module to the directory
  19. Thanks, I agree and am looking forward to working with you on this. I've been hoping to get some kind of forum integration into modules.processwire.com so that it can authenticate them automatically. Ideally, I'd just like some way to do this: $username = ipboard_username(); if($username) { // user is logged into IPBoard and we let them edit any modules // that were created by the same username } else { // user is not logged into ipboard // so we don't let them add/edit modules } Right now the 'add module' form collects their IPBoard username but they have to type it in. I figured we could use this for building more IPBoard->Modules site integration in the future. This week I would like to be able to link to their IPBoard profile, if it's possible. So far I can't figure out how to do it, as IPBoard apparently requires not just the username but a numeric ID in a profile's URL? LIke this: http://processwire.com/talk/user/2-ryan/ (note the /2-ryan/). Are you aware of any way to link to a user profile when all we have is the user name? Thanks, Ryan
  20. Thanks all for the feedback! These have been added, along with some other updates. Thanks, this helped me to pinpoint and fix the problem. It just occurred when the first submission resulted in a validation error. Then the next submission would to go a 404. This has now been fixed!
  21. You can adjust the length issue in your MySQL settings (search forum for ft_min_word_len). But unless you are dealing with a really large site, you might just want to use the %= version, which uses MySQL LIKE. This will also solve the stopwords issue. It's supposed to be a whole lot slower, but you likely won't be able to tell any difference in speed until you get into tens of thousands of searchable records.
  22. I'm not aware of any watermark modules that exist yet. Though I think that the code formmailer posted would be a good alternative for handling specific cases. I've also had good luck creating watermarks with ImageMagick, which is a unix command line util already present on most web servers. You simply exec() to it from PHP in 1 line.
  23. I'm not 100% sure I understand the question, so let me know if I'm answering the wrong thing. The behavior here depends on how you've defined your selectable pages, as well as what inputfield you've selected. The PageList inputfields will sort in the same way your page tree does. Whereas the others will sort according to the selectable pages definition. If you chose a parent for the selectable pages, then they should sort according to the parent's sort setting (on it's children menu). If you are using some other criteria to find selectable pages (like template, by itself), you may want to instead use the "custom selector to find selectable pages", and specify the "sort=field" right there, i.e. template=something, sort=title When you add a page to a multi-page selection, where it goes in that selection depends on what inputfield you are using. If using asmSelect, PageAutocomplete, or PageListSelectMultiple, new selections are appended to your list and you can drag-n-drop them wherever you want them to be. If using checkboxes or regular select multiple, then the selection should stay consistent with the source.
  24. That's cool to hear we have similar roots! I trust what you are saying and will certainly give PhpStorm another try. Though I have to admit, I can't get enough of VIM. It really is one of my favorite tools. The only reason I don't tout it more here is that I recognize it's quite difficult to use until you get used to it. Though once you get used to it, it's difficult to use anything else. But I try and keep an open mind about trying new editors. If PhpStorm will let me use a VIM key set and not annoy me with lots of menus, autosuggestions, autoindenting, code collapsing, etc., then that'll go a long way.
  25. This is certainly possible. Unless I'm overlooking something, you should be able to do this now by adding the 'process' field to your template. If you prefer, you can always create your own field like 'process', which is just a field of FieldtypeModule. But might as well just use the one that's already there unless you have a need to make it different. The 'process' field is considered a system field, so the admin UI may not let you add it to a template unless you have $config->advanced=true; in your /site/config.php. However, if you are doing this from the API, it shouldn't matter. ProcessWire 'admin' executes the Process modules by including /wire/core/admin.php. You could setup your own template to do the same thing, by including that file. Though you can also have your template execute the Process on your own too. Here's how you do it: $controller = new ProcessController(); $controller->setProcessName($page->process); $output = $controller->execute();
×
×
  • Create New...