-
Posts
16,793 -
Joined
-
Last visited
-
Days Won
1,539
Everything posted by ryan
-
Roope, PW's sanitizer functions are intentionally aggressive as they are aimed at dealing with user input situations. But you don't have to use them if they don't fit your need. In fact, if this is not something dealing with user input, then I would just not worry about the sanitizer and just wrap your values in quotes (unless your values also need to match quotes).
-
Actually it should be http://processwire.com (without the www).
-
Another option is that you could go for one of the scalable cloud hosting services (for example), letting the hosting side scale as you need it.
- 4 replies
-
- scalability
- load balancing
-
(and 1 more)
Tagged with:
-
2.4 has been out for a couple days now as the current stable version, so you don't even have to use dev if you don't want to.
-
How about this: for($size = 4, $n = 0; $n < count($images); $n += $size) { foreach($images->slice($n, $size) as $img) { echo $img->url; } }
-
Admin Page - "Recently Edited Articles" Link
ryan replied to Peter Falkenberg Brown's topic in Wishlist & Roadmap
Kongondo, great video and module! I hope you'll add this one to the modules directory when ready. Also for those above, wanted to mention that Teppo's Changelog module is also a good way to look at what's been edited recently. In terms of having a list of "recent edits" display in the default admin theme, that kind of goes against the desire to keep the admin theme as minimal as possible. I don't disagree on the usefulness of it, just think it doesn't belong in the default admin theme. I'd rather leave that to other admin themes, or support such features in the future with theme-specific 3rd party installable modules or widgets (this could be fun). -
Events Fieldtype & Inputfield (How to make a table Fieldtype/Inputfield)
ryan replied to ryan's topic in Modules/Plugins
That universal module is called ProcessWire. In all seriousness, I understand what you are saying. This Events fieldtype isn't particularly useful in it's standard state. It is meant purely for you to take and extend it to do what you want with it. It might also be useful as a starting point for someone wanting to make a fully configurable version of it. But as to how "much work" it would take, it would not be a small project. -
I'm unclear about why you are using Hanna code for this. I might not be understanding the question, but it sounds like something that maybe you should just be using pages for. For instance, you could have a page called /tools/rental-prices/, and output that: echo $pages->get('/tools/rental-prices/')->body; If you had various different options for rental prices, then you could create a 'page reference' field called rental_prices, and make it select from one of the many pages living under /tools/rental-prices/, like /tools/rental-prices/summer/ and what not. Then you'd output it like this: echo $page->rental_prices->body;
-
You are right that repeaters add overhead. Think of it this way: each repeater item is itself a page. So if you are loading 1 page that has 5 repeater items, then you are actually loading 6 pages. ProcessWire can deal with lots of pages no problem, but if you start dealing with lots and lots of pages with lots and lots of repeaters, then it's good to be aware of potential overhead. Autojoining your repeater won't help, but autojoining the fields in the repeater can help.
-
Multi-page tree approach or multi-language fields?
ryan replied to alicemccarthy's topic in Multi-Language Support
Yes, links generated by $page->url type calls are updated automatically according to the language. I'm not opposed to having other dedicated language boards here. But there would have to be adequate demand for such a thing. I'm not aware of there being sufficient demand for it at this point. As good as Google translate is, it's not great. For instance, Google Translate taking a German page to English is barely intelligible. Not to mention, code examples rarely survives Google Translate. If we were ever to have any other language boards here in the future, I don't think we'd be wanting a translate button. Having the same page URL respond to a user's accept-language browser setting is frowned upon by google. For that matter, having the same page URL display different content based on the value of any header, geo location, referrer or user agent is frowned upon by google. This is not considered a good practice. If building a multi-language website you'd want to use an obvious language switcher of some sort and be sure your multi-language content is separated by URL or hostname so as not to confuse the search engines. -
I think underk hasn't seen your message yet, so I went ahead and updated the project URL / download link to point to the GitHub repo.
-
When I need a calculated field that will be used for sorting, I like to add a hidden (or regular, doesn't matter) field to the template to store the calculated value. The value gets automatically calculated on page save. A hook like this in your /site/templates/admin.php can do the work for you: $pages->addHook('saveReady', function($event) { $pages = $event->object; $page = $event->arguments(0); if($page->template == 'rider') { $miles = 0; foreach($page->rides as $ride) { $miles += $ride->miles; } $page->miles_ridden = $miles; } }); Then when it comes to sorting, you just sort on your calculated field: miles_ridden. If you are adding this to an existing PW installation, then you'd need to establish the initial values for each rider's miles_ridden. This could be done with a quick bootstrapped script: /setup-riders.php <pre><?php include("./index.php"); foreach(wire("pages")->find("template=rider") as $rider) { $rider->save(); echo "$rider->name: $rider->miles_ridden miles ridden\n"; } Then you'd just load domain.com/setup-riders.php in your web browser, and then delete the file when done.
- 2 replies
-
- 10
-
You can make up your own users system, and sometimes it's the simplest route to achieve something. But I would try to get it done with regular PW users first. You can always map fictional page names to usernames via URL segments. For instance, if you had a template called 'riders' and you enabled 'URL segments' in the 'URLs' tab of your template, then your /site/templates/riders.php file could have code like this: if($input->urlSegment1) { $rider = $users->get("name=$input->urlSegment1"); if(!$rider->id || !$rider->hasRole("rider")) throw new Wire404Exception("Unknown rider"); // display rider echo "<h1>$rider->name</h1>"; echo $rider->body; // ...or whatever fields you wanted to output } else { // display list of riders foreach($users as $rider) { if(!$rider->hasRole("rider")) continue; echo "<li><a href='./$rider->name/'>$rider->name</a></li>"; } }
-
Regarding the first part of your question: if you want PW to run from the root of your domain, it's best to install it in the root so that you have /index.php, /wire/ and /site/, and not /subfolder/index.php, /subfolder/wire/, and /subfolder/site/. I'm glad you found a rewrite rule that works in your case, but I'm not confident that PW will be totally happy with it as it does consider various server variables to determine the installed path–page URLs might still reflect the subfolder. I don't totally understand the question. But if you need to ZIP up a copy of a site, then you only need to create a ZIP of the /site/ folder. Everything else (which is just index.php, .htaccess, and /wire/) can be obtained with a fresh copy of PW. When I'm backing up sites, I usually just backup the /site/ folder since I know everything else can be easily obtained.
-
Landitus, you and Soma are talking about two different issues. The issue you mentioned, about the description (alt tag) disappearing after editing an image, is one that I can't duplicate here (just tried). You may want to upgrade your site to PW 2.4 just in case the version you have had some issue in that regard. The issue that Soma mentioned is an expected one, because when you use the link or image dialogs, it is writing out a new <a> or <img> tag when you click the "insert link" or "insert image" button. Since a 'class' attribute is not used by the link dialog, it writes out a new <a> tag with no class attribute.
-
Joe, to re-create PW's javascript 'config' variable on your front end, you could just duplicate what's being output by this function. There's not much to it. To ensure that all the right JS and CSS files get loaded you only need to do this: foreach(wire('config')->styles as $url) echo "<link rel='stylesheet' type='text/css' href='$url' />"; foreach(wire('config')->scripts as $url) echo "<script src='$url'></script>"; Also for anyone else reading, this has nothing to do with CKEditor. This is just generally how you'd duplicate PW's admin vars/styles/scripts on the front end.
-
I don't think it matters. I've had similar situations in the past but never had issues. I've even had tables that were the wrong character set, but storing UTF8 (a long time ago) and it didn't become a problem until I needed to export and import somewhere else. But if your tables are already the right character set, then I don't think you've got anything to worry about (someone correct me if I'm wrong). You might notice that PW uses the ASCII character set in MySQL for some fields (like those storing 'name' format data, where nothing beyond ASCII is needed).
- 4 replies
-
- 1
-
- utf-8
- PW installation
-
(and 1 more)
Tagged with:
-
Good point Adrian. I've added 2.4, and also updated all the modules that are compatible with 2.3 to also indicate compatibility with 2.4. I think this is reasonably safe to assume (I haven't yet found any modules that aren't compatible with 2.4). I made a little bootstrapped script to do it for me… these are always fun ways to feel like you got some work done in 5 mins. include('./index.php'); $v24 = wire('pages')->get('/versions/2.4/'); foreach(wire('pages')->find("pw_versions=/versions/2.3/") as $item) { $item->pw_versions->add($v24); $item->save('pw_versions', array('quiet' => true)); echo $item->title . "<br>"; } If anyone comes across any modules that they find not to be compatible with 2.4, please let me know so that I can update the directory.
-
Thanks ceberlin! This is just a soft launch of 2.4, as I've still got some items to cover before telling everyone about it. However, I was feeling that 2.4 is already a lot better and more stable than 2.3, and that there's just no reason to have people download 2.3 anymore. So 2.4 is now the stable version, but it will still be getting some minor incremental updates for a little while. For those upgrading, be sure to read the upgrade instructions and additional upgrade notes.
-
No requirment for db password while installion
ryan replied to Nico Knoll's topic in Wishlist & Roadmap
ProcessWire dev has no DB password requirement, and hasn't for months. Can you post a screenshot or paste in the error that you got? Also adding novalidate as an attribute won't help on the dev installer because the field has no required attribute. -
There shouldn't be any deprecated warnings about mysqli at least. We don't plan on dropping that database driver anytime soon, just will encourage people to standardize on PDO in the future after 2.4+ is well established. But I don't really see a reason why we'd ever need to remove the mysqli driver, as some sites may need it for legacy use, even after all modules are using PDO. InputfieldButton only has about 50 lines in it, so not sure about line 253. @ceberlin can you post in a screenshot or copy/paste the exact errors you saw both for the deprecated warning and the InputfieldButton?
-
I could be wrong but I think those are carried over from the social network votes. Meaning, those 620 votes are probably their combined Facebook, g+1 and Twitter votes, which maybe are allowed to accumulate across contests? There clearly wasn't any gaming going on there though, because they started with 620 votes immediately the first second the contest began. All the other big players there also started with certain quantities before anyone had voted. That's why I think it's carried over from social networks. We do have 1-click module installing already. But we'll setup whatever else they need. I agree, thanks Darren for getting this started! There are a lot of other thanks to go around here too. I for one had kind of given up yesterday when it seemed like there was no legitimate way to win. Then Joss's dog started tweeting and he and others started asking for help from big players like @smashingmag, @modx, etc., and some of us found it very inspiring, among all the other things people were doing. Seeing people work so hard on something becomes contagious. The entire ProcessWire community got involved yesterday, which was fantastic to see whether we won or lost. I looked into their voting system in more detail yesterday after folks had expressed concerns (and after I'd sent that tweet). What I found was that whoever put it together knows what they are doing, unlike most similar voting systems. Their voting system is protected from iframe and/or ajax manipulation, meaning it's unlikely an exploit could take advantage of other users IP addresses without their knowledge (which was the problem with the opensourcecms.com voting system). The only exception would be users on old browsers like IE6 and IE7, but they may be accounting for that in some way I don't know about too. So while you can't accurately log these kinds of exploits, that point may not matter if the exploits are blocked in the first place. Regarding the 50 votes in a minute we may have seen from Ametys, I think the only thing that could produce that kind of result in this case would be if they sent a bulk-mailing to a big list. Social networks would be another way, but they don't have the social network reach to account for those numbers (unless they got a mention from someone else that does). It seems unlikely to me that 50 votes could be faked in a minute in this particular contest. Where the voting system does seem potentially problematic is when it comes to anonymizers (anonymous proxy servers). These are the kinds of services one uses if they might otherwise be blocked from a site due to geography, government, etc. These proxy server sites enable you to browse anonymously, automatically clear cookies, randomize the user agent, change the "location" (and thus IP) you are coming from, sometimes among hundreds or thousands of choices. They mask the identity of the original requester, as they don't pass through the usual headers that would lead you to the original IP. So as someone that has written voting systems similar to Bitnami's, these anonymizers scare me. I personally don't know of any way to account for or log that type of manipulation to votes. Though perhaps they do. The only silver lining in that I'd assume it takes real time, effort and money to use an anonymizer in this way–it's still manual labor, not a script, and probably not worth the effort for someone that wants to make a big dent (not a good way to get 50 votes in a minute). I'm assuming the previously mentioned Tor browser is a front-end to anonymous proxy servers, which falls in a similar scope. I think that a more accurate voting system would use a 1-to-1 mapping system between votes and social accounts from Facebook, g+1 and Twitter. But even that could be manipulated, as users might create numerous social network accounts. However, that's where it starts to take a whole lot more effort from that folks wishing to manipulate results (creating and validating accounts one after the other), increasing the odds of an accurate vote. The downside is that social-network oriented vote competitions are completely dependent upon social networks and it simply doesn't look as good as hosting your own. Not to mention, a certain percentage of very legitimate users avoid these social networks (our social network is our forum, after all). And philosophically, do we really want to hand any more of our keys and responsibilities over to these giant social networks? I prefer to get along without them intruding on everything in the web business. When it gets down to it, there really is no perfect way to handle an online voting system. So I think we need to cut the Bitnami folks some slack, as it does look like they are accounting for everything they can in the environment they have to work with (which is a lot more than most do). While I'd rather they just included the best software and avoided the whole contest thing in the first place... I'm sure the marketing folks want a contest (it's good for business). And if there has to be a contest, then at least they are taking the vote quality seriously.
- 191 replies
-
- 3
-
- bitnami
- installation
-
(and 2 more)
Tagged with:
-
Congratulations to everyone! We have now officially won as seen on the Bitnami contest page. Thanks for everyone's efforts for this, as this should be a great thing for the ProcessWire project. I'll follow up with more later, but just wanted to thank and congratulate everyone for this community led effort.
- 191 replies
-
- 13
-
- bitnami
- installation
-
(and 2 more)
Tagged with:
-
Well they said midnight CET. But the votes are still coming in. Hopefully they didn't mean midnight CST.
- 191 replies
-
- bitnami
- installation
-
(and 2 more)
Tagged with:
-
For you guys in Europe waiting up, word is that the contest ends at midnight CET (10 minutes!)
- 191 replies
-
- bitnami
- installation
-
(and 2 more)
Tagged with: