-
Posts
17,234 -
Joined
-
Days Won
1,700
Everything posted by ryan
-
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;
-
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");
-
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.
-
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().
-
@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.
-
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.
-
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.
-
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.
-
@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.
-
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.
-
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?
-
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
-
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
-
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!
-
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.
-
Extending the ImageField with a watermark option
ryan replied to formmailer's topic in Module/Plugin Development
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. -
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.
-
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.
-
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();
-
Nico, sorry about that. Can you tell me the module title and class name, exactly as entered? [edit] so far tried lots of things, but can't duplicate a 404. I have a feeling it's tied to class name or title, but can't tell for sure. Let me know how to duplicate when you get a chance.
-
I was supposed to have jury duty today, and they didn't need me. Since I'd already rescheduled today's client work, I decided it was a good time to finally get a start on the PW modules directory. Here it is: http://modules.processwire.com I just added that DNS host so may not be active everywhere yet. There are only a few of my own modules and a couple admin themes in there at present. I need your help populating it (see below). This is just a start, and I've only had a day to work on it. I've got plenty more planned for it and appreciate any feedback you have. How to add your modules For those that have created modules, admin themes or language packs, I need your help populating the directory. When you get to the directory, you can click "Add New Module" in the sidebar and it will take you to a screen where you can add it. You assign an email and password with each module you add so that you can return to make updates as often as you'd like. When you add a module, it puts it in a pending state just so that I can keep out the spam. It emails me when you add a new one, so I'll approve any modules you add asap. Though you view your own module page and continue to make as many edits as you want to regardless of whether it's approved. Nikola and Soma: I put in one each of your admin themes for testing purposes. I've associated these with your email accounts. To modify your admin theme pages in the modules directory, click "edit" on it and scroll to the bottom in "Authentication" and click the link to retrieve your password. Enter your email address and it'll send it to you.
-
We already have Markdown and Textile text formatters, so I thought we should have BBCode too. BBCode is a good text formatter to use when you'll be outputting untrusted user-supplied input. I think it's also a little simpler and more widely understood than Markdown and Textile, since it is used by many forums (including the ProcessWire forum, before we switched to IP.Board). More about the BBCode format can be found here: http://en.wikipedia.org/wiki/BBCode This module uses the NBBC Library to handle BBCode parsing. I selected this one because it seems to be really well documented and also includes it's own set of smileys, for those that like that sort of thing. To install, clone it from the TextformatterBBCode GitHub page or download the ZIP file.
-
You don't necessarily need to create a separate Process module if you don't want to. Though there's nothing wrong with doing it that way, and it may make sense for a separation of powers deal. If you take that approach, your render() function can simply return the content to be output and ProcessWire will take care of the output for you (it outputs only your returned output, without any template output, when the request is ajax). But there are other ways of handling it within your existing module. 1. If you are retrieving pages, ProcessWire already has an Ajax-API built in for you to use. This is what the Autocomplete inputfield uses, for example. It'll let you query and retrieve just about anything that you could from a native PW API call. See here for more info. This at least answers 90% of the AJAX needs I have in ProcessWire. 2. If either your Fieldtype or Inputfield is autoload, you can have it listen for your ajax request in the module's init(): public function init() { // look for ajax request and some variable you've set as your landmark to look for if($this->config->ajax && $this->input->post->rob == 'rob' && !$this->user->isGuest()) { // do your thing, outputting your JSON/XML or whatever exit(); } } In the above scenario, you could ping literally any page and so long as the request came from ajax and $_POST['rob'] == 'rob', your bit of code would get executed. You might also be able to get away with doing this in your $inputfield->init() (non-autoload) function, which would prevent you from having to check for access, and would ensure the execution is limited to when your module comes into play. However, I haven't tried that to confirm.
-
I'm always willing to take a fresh look at tools other people like. There was no VIM mode back when I used PhpStorm, so that sounds interesting from that aspect (as does the sublime vintage mode). But should qualify that I'm not naive about this, have spent a lot of time in IDEs, and used dozens of different editing environments over the years. Back when I was a C++ programmer working for another company, I didn't have a choice. I also used PhpStorm for a couple weeks when it was new (with ProcessWire), as well as Zend's IDE for some time. I even grew up in Turbo Pascal and Borland C++ IDEs, using them for years. But my mind always ends up more in the editor than in the code. For me, less has always been more. It's not about what's practical, easy or fast. VIM takes me to a place where I can think, and it took me years to find it. I lose creativity and enjoyment when you take away the minimalism. Coding becomes about work rather than code. I lose track of stuff when something is keeping track of it for me. What can I say, this is how I am about all my tools except maybe Photoshop. No doubt IDEs can be time savers when it comes to certain tasks, but I've not found it worth the tradeoff. (Though TextWrangler is my go-to for anything involving regex search/replaces across mass amounts of files). I will keep trying out tools that other people like and recommend, but I think most of the time we're looking for different things. I'm not trying to sway anyone towards using what I use. It's not practical, and it's slightly insane. In fact, I would say you should avoid the likes of VIM if you enjoy using an IDE. This is all beside the point on PSR-0 changes to the core. I can put up with more files, as the inconvenience is relatively minor. But I thought it was worth asking if there were any compliant conventions for including a similarly-named group of classes in one file. For instance, a file named Selector_.php might include classes beginning with the word "Selector", which are already grouped together in a file by intention and design.
-
I thought I fixed this one last week, but turns out I got the /markup-cache/ URL and not the /markupcache/ one. Not sure how I ended up with both, got to be user error on my part. Anyway both should work now. Thanks for finding it.