Leaderboard
Popular Content
Showing content with the highest reputation on 12/12/2012 in all areas
-
Another one from gadgetopia, and this time is about all of us http://gadgetopia.com/post/82865 points
-
// output the 5 authors with the most posts sorted by post count $authors = $pages->find("template=author,posts.count>0")->sort("-posts.count")->find("limit=5"); foreach($authors as $a){ echo "<p>$a->url $a->title ({$a->selec_page_image->count()})</p>"; } This seems to work, but only if you make the sort and limit after the find. I'm not sure what exactly happens, but if you put sort inside first find it will throw error, now it works if added afterwards. The last find is to limit it to 5. Note limiting has to be after the sort, otherwise you get a mixed result obviously.4 points
-
It seems that "$=ie/die" issue has to do with several things. Buggish behaviour, I'd say. I'll try to explain some of the things that are happening with operators ^=, $= and *= inside the core and database as well. MySQL fulltext searches are able to match either whole words or word beginnings - so no way to match a word ending with a fulltext search only. PW tries to anchor search term to the beginning/end of the field value by adding a RLIKE with some regex magic. While this works nicely in the beginning on the value, it quite often fails when matching end part. Actually, when it doesn't fail, is only when searching for complete words (the very meaning in the first place I suppose) OR the search term is a predefined stopword. Yes, this does sound a bit backwards, but that's how it's implemented at the moment. Stopwords ("ie" being one!) are filtered out by PW, thus leaving only that RLIKE - which matches on its own (this is why $=ie matches "Élodie"). Additionally PW forces the search term to exists (by adding a '+' operator to the beginning) and tries to find partial matches (by adding a '*' operator to the end). This is problematic because the wildcard operator only matches word beginnings and that will never happen for a word ending shorter than the whole word (this is why $=die does not match "Élodie"). And as MySQL doesn't include short words in the fulltext index at all, there's no way those searches will ever match even a whole word if it's short enough (using "^=Le" doesn't match "Le p'tit"). Well, I guess here's enough explanation for Ryan to get a hold of this when he has time. Hope I got all of the above right... But as I said before, when using fulltext searches, it's all about whole words (mostly at least). And words long enough. And not in the stopword list.4 points
-
I recall reading (can't remember where, sadly) that the best way to deal with this in SEO terms is to leave the page published, but change the content after the event has happened - ie explain on the page that the event was in the past and include a short report on how it went. The reasoning behind this is that a page about a popular event can generate incoming links (traditional links or social mentions) in a short time, so there's no point wasting them. You can also add a comments box on the page and ask attendees how the event went, generating a bit of UGC as well. You can also link to upcoming similar events and pass a bit of Googlejuice on.4 points
-
still developing but here is a little preview of the accounting and the system settings module. sorry for the bad quality, first time screenrecording on the mac. the videos show the actual frontend, every data is generated from there. my aim is to use the backend from PW as a maintenance system. in the settings module video you could see me creating "mitarbeiter" (employees) , they are created as $user, so every employee got his own login data and you could assign the supposed role according to what he is allowed to do and see in the system. enough words. Part 1: the settings module https://youtu.be/dMhri_H3UXY Part 2: the account module https://youtu.be/sds9kNcFp7s3 points
-
Feel free to take it and improve it. Make it your own whatever and be sure to submit it to modulers page. You're welcome. Glad if it helps people.2 points
-
Nice idea, I was also thinking about some time ago. One way is to not extend the InputfieldTextarea, and make a new Inputfield type, but Hook into the necessary methods to extend the config and rendering. Since this made me wonder how it would go, I gave it a try. It's a nice example showing how to archive it using hooks only. It will give you a extra Input setting "Max length" in the field setup. And a counter for all InputfieldTextarea (not tinymce fields) and add a attribute "data-maxlength" to the one that have a max length value. I had to use "maxchars" as the setting field name as there's already this attribute, but not used in the context of page edit. The script js is also added via a hook, and is a basic example of the script that counts backward while typing. Since I was already that far it was easy to add, but you might want to modify it and add features if you like. This took me roughly 30min, and little more to add the js. I think a year ago I wouldn't knew how and would have taken ages to figure out. But it grows on you after so many modules and insight. This module shows you some good practices and maybe helps understanding modules. If you have questions please bring them in. Module code: https://gist.github.com/4252958 JScript code: https://gist.github.com/4252962 Put them in a folder /site/modules/TextAreaCounter/.. Install, enjoy. Edit: just found an issue... will take a look again2 points
-
Hi there, I just recently discovered ProcessWire and am still pretty exited about it and the ways it enables you to do anything. Thanks a lot to Ryan and everything who created it! What I was missing (or just overlooking?) recently, was some kind of char counter for textual input fields. Just an (en-/disable-able) are that shows, how many chars have been typed in. If you have some char limit defined for the field, it should show you, how many chars are left. Just think of the twitter online interface for writing new tweets. So, did I miss something here and this is already existing? If not, I think that this would make a nice addition to the backend modules. I'd give a try to develop it, if it doesn't exist, but since I'm quite new to the PW world, I haven't ever developed a module before and it will probably take some time. Please just let me know what you think of it. With kind regards, Marc Edit: Thanks so Soma, there is some Code there already. While still rough around the edges, it's definitely usable: https://github.com/boundaryfunctions/TextareaCounter1 point
-
Hi PW Fans, I´m developing a little webapp in cooperation with an local tax consultant. Not really styled so far, the focus in this moment is setting up the functions and logics. General needs: - accounting - rudimentary client organization - invoice management - creating invoices - multi user possibility with different page-permissions Done so far: - accounting The app meets the needs of german bookkeeping for small business. Also it could be used for the so called "Kleinunternehmer" by just setting a checkbox. Well, the next thing to be done is a export function for "Datev" a german tax software. If somebody is interested to beta test the suite just put your hand up and I will send a copy (Attention: no multilanguage. Everything is in german). Some screenshots:1 point
-
Perhaps some kind of gallery for admin themes & predefined profiles?1 point
-
Sorry my fault. I haven't read careful and assumed from your selector that you have authors with a page field "posts" to reference all posts. It's the other way round then. But having it the way I assumed would result in having a simpler code Don't worry, you could either change it if you like it or use this with current (like nico but little improved I think) $authors = $pages->find("template=authors"); // create empty page array $res = new PageArray(); foreach($authors as $a) { // temporarely add postscount property to author $a->postcount = $pages->count("template=posts, author=$a"); $res->add($a); } foreach($res->filter("sort=-postcount, limit=5") as $a){ echo "<p>$a->title ($a->postcount)</p>"; } Let me know if it works for you.1 point
-
Install NetTuts Fetch plugin. Use super+shift+p and find "Package Control: Install Package" enter and search for "Fetch", select and hit enter to install it. Tutorial here: http://net.tutsplus....-nettuts-fetch/ Use http://gist.github.com to post snippets and load them in when needed. Very handy. I often use the module template I created here: https://gist.github.com/2732707 Just enter it as for example "PW Module Template" to the config of the Fetch package, open command console super+shift+p and enter "fetch", you'll find 3 commands, select "Fetch: file" and select the entry from the list hit enter and it loads the code into the caret position. Start coding your module.1 point
-
Well that would depend on your time, but what sounds silly to me is porting it all to ProcessWire as an "alpha" which would work perfectly well, then translating all that to an entirely different programming language which presents different problems - you're essentially first building it on a framework that helps you in certain ways, then throwing it all away and writing it from scratch, including all of the user and page management features etc that ProcessWire gives you out of the box. The short version of all the above posts is: You will likely need to rewrite most of the code in these modules You will need to know how to do this yourself (i.e. have a decent grasp of PHP) You will need plenty of time to do it all in - I say a year as if this was me working on this for myself and not for a client I have time constraints during the day and less time during my evenings and weekends that I would be working on it. Either way it's no small task you're embarking upon and there's no easy shortcuts to getting there, but ProcessWire is a good system to build many web applications in Doing this all and porting it over to Ruby as a version 2 sounds silly. Stick with one or the other from the start. EDIT: In fact your last question is worrying - combine ProcessWire's flexibility and UI with Wordpress? That is also frankly silly. At one level they are both CMS' (Content Management Systems) and duplicate each others' work, though ProcessWire is arguably the better choice, certainly to those of us who use it. What you are suggesting now in terms of a car analogy would be called a "cut 'n shut" in the UK (and probably elsewhere) - taking two halves of different cars and welding them together. It's possible (illegal in the case of cars ), but... why?1 point
-
Greetings, Well, what do you know. I was wondering about a counter for my textarea fields, and there it is. THANK YOU SOMA FOR CREATING THIS! I've not only installed it, but studied it. I like how clean this code is and how easy it is to understand what it does. That says a lot about Soma's ability to create modules, and also about ProcessWire's module-building system. Has this been entered into the official ProcessWire module listing? Thanks again, Matthew EDIT: Thank you boundaryfunctions for running further with this! I can do some documentation for this, if you need me to.1 point
-
1 point
-
Tricky one... let me think... second problem is easy: foreach($pages->find("template=author") as $a){ echo count($pages->find("template=post, author=$a)); } and the first problem... hm, how about this? $authors = $pages->find("template = author"); $authorsPosts = array(); foreach($authors as $a){ $authorsPosts[] = array("count" => count($pages->find("template=post, author=$a")), "author" => $a); } sort($authorsPosts); $authorsPosts = array_slice($authorsPosts, 0, 5); //added this line to limit to 5 foreach($authorsPosts as $p){ echo $p["author"]->title . " wrote " . $p["count"] . " posts<br>"; } edit: i forgot about the limit of 5... already edited the code:1 point
-
Yes, DaveP has the right of it. Apart from being courteous and helpful by replacing the content with "This content is no longer available, however, you may be interested in these related articles ..." or something along those line, you can also leverage the visitor who, after all, has landed at your site. You should do something with them! This is good marketing practice dating back long before the internet. When readers would write to Magazines or Publishers asking for an old article that was no longer available, the standard practice was to send them an apology and enclose a recent copy of the magazine as a consolation. One new reader and satisfied customer. This response felt personal and direct - it felt much more than some automated reply (even if, in reality it was not far off being automated for the day). Modern internet publishing has huge amounts to learn from the print publishing industry. Joss1 point
-
Joss that's a nice list of states, just create them using page field reference and you can have as much as you want. But you'd also have to fill them with functionality or they will be just skinned cats1 point
-
Template Decorator, it only works in php 5.3 and latest jquery > 1.8 I think "on" was introduced. I have a legacy version of it for my installs.1 point
-
There's currently no option for that as far as I know. But I think it would be possible to implement. For now you could add something like this to your inputfields.js of the admin theme, "teasers" being the field name of the repeater. $('#wrap_Inputfield_teasers ul.Inputfields.ui-sortable > li').addClass("InputfieldStateCollapsed");1 point
-
You have to go to those fields settings, and in the tab INPUT, set their visibility to "Always collapsed, requiring a click to open". You can also do it only in the context of the repeater by clicking on the field name on the reapeater DETAILS area. edit: hm... that was for the fields, not the repeater itself. Ignore it.1 point
-
@Soma I want collapse both text-area-elements. (Textarea #1 and Textarea #2) And they should be always collapsed. First when i click on an element I see the the fields in there.1 point
-
Wouldn't it be better to make it with normal pages instead? I don't think repeaters are the ideal for lots of info.1 point
-
JJS, I think what others are trying to say is that you can't take the code from Wordpress plugins and easily integrate it into PW. If you want to use PW then you need to use PW framework and forget about Wordpress. Wordpress' PHP does not work with PW. They are two completely different systems. There are some PW modules created by the community that will work with what you are desiring, like putting the site into maintenance mode or language translations or tagging. But for other features, like a members only section, you are going to have to dig into the forums and learn how others have implemented into their sites. Just ask very specific questions and you will get the answers. Break your project down into what you need and ask away!1 point
-
1 point
-
I personally think the Cheatsheet should be made into a nice tea-towel that I can frame on the wall. Just a bit on docs - the ideal (for me, at any rate) would be to have the cheat sheet, complete with its short hand explanations (which are good!) and then a link to a longer explanation and real-world example or two. If anyone ever writes one anything for any of the items on the Cheatsheet, stick it on the wiki, or send it to me and I will stick it on. That must have been fun! (And potentially a bit of a shock for the unwitting....) Joss1 point
-
Hi, just wanted to let you know, that I started another gist for this here: https://gist.github.com/4258927 I added the word count thingy and some smaller tweaks, but I'm definitely going to add the rest (particularly proper documentation), when I find time for it. Thanks, Soma, for kickstarting me on this! Ah, and another question for everyone: Would it be more elegant to integrate the functionality for plain text inputfields in this module or would you prefer to have it as a seperate one?1 point
-
We've encountered a problem with Blowfish-hashed passwords when using PW 2.3-to-be (dev-branch). Setting or changing a password breaks it so that the user is unable to login - not even right after otherwise successful installation. I've done a fair amount of reading, digging around and testing various things trying to understand this - and yet I'm not quite sure whether it's a PW bug that needs to be fixed (and how) or a PHP bug in certain versions that some of just have to get around in a way or another. My apologies for the way too long post - just wanted to give all the information to whoever is able to grab this thing and check the facts for real. Let's get to the details. What I found the problem to be is that PHP crypt() requires for the Blowfish salt to be at least 22 digits from the given set, but only when PHP version is around 5.3.2. As 5.3.0 introduced internal Blowfish implementation in the first place and 5.3.7 fixed a security bug in it, I'm assuming this could be the version range affected. PW 2.3 creates salt for Blowfish by using only 21 digits + a '$', which seems to be just fine in most cases. However, according to http://php.net/manual/en/function.crypt.php, there should be one more digit from the given alphabet: Then again, the answer at http://stackoverflow.com/questions/4683350/blowfish-salt-length-for-the-crypt-function does state that salt should be 21 chars + the trailing $ as currently implemented in PW 2.3. Dollar sign seems to be commonly used separator/terminator for salt strings in *NIX at least, but that PHP.net article doesn't say it should be used. I'm nowhere close to an expert on this, but according to my tests the $-terminator is not required. Here's some more information on the matter to digest (feel free to dive in, but don't blame me if your brain melts during the process): http://stackoverflow.com/questions/2225720/why-does-crypt-blowfish-generate-the-same-hash-with-two-different-salts Here's a little script I used to check for PHP version differences: #!/usr/bin/php <?php $salt20 = '12345678901234567890'; $pw = 'test'; // see if Blowfish hashing is possible var_dump(CRYPT_BLOWFISH); echo "Hash with salt20: " . crypt($pw, '$2a$11$' . $salt20) . "\n"; echo "Hash with salt21: " . crypt($pw, '$2a$11$x' . $salt20) . "\n"; echo "Hash with salt22: " . crypt($pw, '$2a$11$xy' . $salt20) . "\n"; echo "Hash with salt23: " . crypt($pw, '$2a$11$xyz' . $salt20) . "\n"; And here are the results for the few PHP versions I was able to test this on: PHP 5.2 had no Blowfish support. PHP 5.3.14+ (at least) pads under 22 digit salt with extra $'s or takes the first 22 digits from a longer salt string. PHP 5.3.2 does the same for longer strings but fails to return any valid hash for salt with less than 22 digits (this being the very problem we encountered). Here are the changes I made to get things working for us. Generate 22 digits instead of 21 and separate 7 ($2a$11$) + 22 (random salt) = 29 digits of salt instead of 28 (29th would be the trailing $) from the resulting hash. $ git diff wire/core/Password.php diff --git a/wire/core/Password.php b/wire/core/Password.php index 5ae8668..96a019d 100644 --- a/wire/core/Password.php +++ b/wire/core/Password.php @@ -103,7 +103,7 @@ class Password extends Wire { // if it's a blowfish hash, separate the salt from the hash if($this->isBlowfish($hash)) { - $this->data['salt'] = substr($hash, 0, 28); + $this->data['salt'] = substr($hash, 0, 29); $this->data['hash'] = substr($hash, 29); } else { $this->data['hash'] = $hash; @@ -134,7 +134,7 @@ class Password extends Wire { $len = strlen($chars)-1; // generate a 21 character random blowfish salt - for($n = 0; $n < 21; $n++) $salt .= $chars[mt_rand(0, $len)]; + for($n = 0; $n < 22; $n++) $salt .= $chars[mt_rand(0, $len)]; $salt .= '$'; // plus trailing $ return $salt; The trailing $ doesn't seem to be required but does no harm either. The nasty thing here is that anyone having let the current version write Blowfish hashes to the database would be left with broken passwords if the salt generation was changed like this now. We decided to fall back to old hashes until this has been solved properly (- make supportsBlowfish() return always false to have it this way). Better way for us would be updating PHP to a more recent version, but we're still using Ubuntu 10.04 LTS which only has PHP 5.3.2 by default. So we'd have to either upgrade the OS or tweak a little to get the current one running with PHP 5.3.10 for example. Another associated thing with Blowfish crypted and salted passwords if that if one sets up a site using current PW 2.3 with PHP 5.3.0-5.3.6 installed, all the passwords will be corrupted when updating PHP to version 5.3.7 or above. See http://php.net/security/crypt_blowfish.php for details. The passwords can be fixed by replacing $2a$ with $2x$ for the old hashes, but there's no bullet-proof way for PW to correct this on its own. And there shouldn't be as those old hashes are a security risk after all. Newly created passwords would work perfectly though, so instructing users to request a new password might be one way to get over this scenario. Phew. Over and out.1 point
-
1 point
-
Hi, and welcome to the forums! Not exactly what you are asking, but there is a TinyMCE plugin for wordcount. To enable it in any TinyMCE field go to the edit field "input settings", and in "TinyMCE configuration options" add "wordcount" to the plugins list and "theme : advanced" and "mode : textareas" in two different lines to "Aditional TinyMCE settings"1 point
-
this version will validate the current fieldset before moving on to the next slide using jquery validation plugin. Must initiallize with: $("#formID").formToWizard(); $("#formID").validate({ ignore: ".ignore" }); PWformToWizard-validate.js EDIT: must also include the validation plugin from http://bassistance.de/jquery-plugins/jquery-plugin-validation/1 point
-
Not exactly. It was coincidence that the very same day the award was announced. I was invited to the show to talk about PW and one of the residents brought up an example why he is disappointed by MODX lately. I use PW since april exclusively and talk about the reasons why. Exactly. I think everyone signs that This was a question of the resident. I said you'll never know but from the general architecture point of view I doubt it will take the same road. yes, the audience of that podcast is more tech orientated, they usually talk about cutting edge web technology like recently implemented APIs from the browser vendors. The show is recorded weekly, so it is quite up to date. I didn't say that What I meant is that from the first view one is perhaps missing a "sexy" template language. But is even more sexy once you understood the API, its power and flexibility. No doubt that PW is more sexy than all the others out there! It is the most heard german web technology podcast with 500-1000 listeners every week, which is not great but also not that unimportant Thanks Christoph for the summary!1 point