-
Posts
17,109 -
Joined
-
Days Won
1,649
Everything posted by ryan
-
I had to click like because this all sounds pretty cool. But you also lost me after "A couple of random ideas and hocus-pocus off the top of my head". Perhaps it's because I don't use an IDE, or maybe because it's the end of the day here… but other than parsing PHPDoc and traits, I have no idea what any of this is. I still need to try PhpStorm (and SlimeText)… but too much work going through the studio right now to experiment. I'm guessing this would all make sense if I had that same IDE context. Anyway, nice for some cool sounding stuff regardless. I'm hoping someone else here knows what you are talking about better than me and can chime in.
-
When you are in TinyMCE full screen mode, you are fully in TinyMCE and no part of ProcessWire is visible at that point. I'm guessing that there's a good chance it would be possible to add a save button to that full screen mode somehow using the TinyMCE API, but don't currently know how.
-
This is a good question. Both would give you a new instance of InputfieldText. However, for any module, it is preferable to use $modules->get('moduleClass'); because it ensures the module is ready for use. Modules require an init() method, distinct from the __construct(); method. When you instantiate a module on your own using new you bypass the built-in logic that determines when/if a module needs to be initialized based on it's autoload/singular settings. It's also preferable to use $modules->get('...') because new InputfieldText() wouldn't work if the InputfieldText.module file hadn't already been included. Whereas $modules->get() knows when/if to include files.
-
Getting all fields in a list or array from a page.
ryan replied to Harmster's topic in API & Templates
I'm not sure I understand the example. What is NubUsers and NubPages? Also something like $fields->find("page=$r->id"); is completely unfamiliar to me. It seems like there are some parts ProcessWire and some parts something else? Here's a simple example that does exactly that: foreach($page->fields as $field) { echo "<p>"; echo "Field: {$field->name}<br />"; echo "Type: {$field->type}<br />"; echo "Value: " . $page->get($field->name); echo "</p>"; } -
If there are multiple categories/subcategories, would you just use the first one then? Like this: $url = "/" . $article->categories->first()->name . '/' . $article->subcategories->first()->name . '/' . $article->name . '/';
-
Very nice functionality here Nico! This almost begs to be a Textformatter module… But probably makes more sense as a code tool like you have it, since the short codes have to be defined somewhere and are likely to be dynamic. What it probably shouldn't be is a Process module, as it is now. Process modules are meant to be mini admin applications, whereas this is more of a markup tool. As a result, I might suggest naming it MarkupShortcodes, and defining it like this: class MarkupShortcodes extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Short Codes', 'version' => 101, 'summary' => 'Enables WordPress like shortcodes.', 'autoload' => false, 'singular' => true ); } public function init() {} // required by Module interface, but can be blank // ... } I'd also suggest updating your example to use "$modules->get('MarkupShortcodes');" rather than "new MarkupShortcodes();" because the MarkupShortcodes class won't be in scope and in a state where it can be instantiated unless retrieved from $modules. Thanks for your good work in making this module.
-
When a page is saved, there are various things that can happen that can modify what gets submitted. For instance, hooks can modify stuff. So it's important that a fresh copy gets loaded after a save. Maybe not as convenient, but ultimately opens up more flexibility.
-
I think this is the first time I've seen ProcessWire (and the LanguageSupport module) used to deliver content in Chinese. Nice to see.
-
I can reproduce this too. This is a bug, as it should allow a page named "0". Sn4ke I think you are right, that there is likely an empty() check somewhere there should be a !strlen() check. Unfortunately I can't seem to find where it is yet, so going to add this to the issues list until I've got more time to get deeper into it. Btw, the error message you got is actually something different, and I have fixed that. The actual error message is "Can't add because that page already exists."
-
Try outputting this, right before your find() and let me know what it says: echo "<p>Language: $user->language</p>"; What languages do you have installed? (how many?) If you try switching the language, do you get a different error or no error?
-
Definitely -- anytime you need something to be hookable just edit it, precede the function with the 3 underscores (to make sure it does what you want) and then let me know and I'll update the source to have it hookable. This is possible in most cases. Occasionally, there will be function that is used so much that making it hookable would be an overhead concern, but there's very few of those.
-
I would probably be worried about duplicate content with this approach. You could use the rel='canonical' meta like Soma mentioned, but it's still not ideal ... could be an unnecessary headache for redirects and future iterations of the site. Also might add some new challenges to statistics tracking. It's kind of going against the flow of how URLs work, but if you are okay with that you certainly could do it in ProcessWire. Since you are wanting to eliminate /articles/, which is a root level page, your homepage would have to be the one allowing URL segments and detecting when they are present. Your generation of the article URLs you asked about would go something like this: function articleURL(Page $article) { return '/' . $article->category->name . '/' . $article->subcategory->name . '/' . $article->name . '/'; }
-
i agree that you should install the comments manager module. But want to make sure I understand what's not working, as you should be able to edit comments from the page editor. Double check that you are running a newish version (2.2.7?) and maybe check your JS console to see if any JS errors are occurring? Let me know if you think there's a bug in there... I have tweaked a few things in the comments recently.
-
From the caching side, you can always use the MarkupCache module to cache your own stuff. But you just have to be careful so as limit the possible pages that can be rendered. Unbridled caching of pages generated as a result of values in GET vars is a bit of a security hole, as someone could take advantage and make you end up with millions of cache files, potentially filling up the disk or slowing things down. This is the reason why PW doesn't support caching of output generated as a result of URLs with GET variables.
-
Must be another system?
-
These are really awesome Soma! I also think it's priceless that the Swiss guy here is making watches… in javascript.
-
The intention is to keep things in a well known set for security, but also so we have consistency with ProcessWire's pageName filters. GET variables?
-
Have you tried putting in the name attribute as "userfile[]" rather than "userfile" ?
-
I would probably set the visibility of that field to "not shown in editor". Rather than have your hook try to adjust attributes of a field, just have it display a message: if($page->your_checkbox) $this->message("User is logged in"); else $this->message("User is NOT logged in.");
-
Improvements to file uploading when file with same name is uploaded
ryan replied to apeisa's topic in Wishlist & Roadmap
It depends on the file system. In a common ext3 with dir_index file system there is apparently a limit of 32k subdirectories per directory, and no practical limit on quantity of files in a directory. In a common ext4 file system there apparently is no limit on subdirectories or files, but a maximum individual file size of 16 TB, so be careful. -
Adam actually that wouldn't work because find() returns a PageArray, not a Page. So you'd have to do find(...)->first()->id, but a better way would be to just use get() rather than find(): if(wire('users')->get("email=$username")->id) { // ... }
-
None of the Inputfields actually support the disabled attribute. When I use it, it's really only for the visual and nothing more. In this case, you are getting the message because the guest role is required and its just adding it back. It's an unnecessary message, though is revealing exactly what you've mentioned (disabled attribute isn't actually supported). Seems like it would be worthwhile to make all Inputfields support eventually (and probably easy to do), so will add this to my list.
-
Welcome to the forums briangroce. I've begun to understand WillyC's language, but it's taken awhile. I think what he was trying to say is that you need to use $l->files->path(); as a function (method) call, and not as a property. Though that's a good reminder to me that I need to make it work as a property too.
-
Thanks for the interest Marty. It's pretty much ready, so should be next week.
-
Might have just found it: the getVariations() function in /wire/core/Pageimage.php calls setFilename() with a non-normalized path from DirectoryIterator. Though still not clear why the $file->getPathname() from DirectoryIterator would be returning a file in the format with both types of slashes (/path/to/file\file.jpg). But that bit of code in Pageimage.php is a problem either way, as it doesn't consider the slashes and it needs to. Luckily an easy fix.