Jump to content

bfncs

Members
  • Posts

    133
  • Joined

  • Last visited

Everything posted by bfncs

  1. 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?
  2. Thanks for pointing this out, Soma. The cheatsheet is already constantly open as a pinned tab in my browser since I startet working with Pw. Really helpful stuff! I did get that the statuses are bit fields and this also makes a lot of sense since they are performant and saving memory. There are good explanations on how this works on Wikpedia: Bit field Bit mask In practice this just works like having an array of bool vars for all of the possible statuses, so you're right, it's impossible to have it hidden and not hidden at the same time. A bool is excatly one bit of information, but because it's not efficient to adress your memory bitwise, it will take up a lot more bits in the computer memory (just looked it up: this is actually defined by your PHP source and usually one byte). The bitfield works like an array so you can stuff multiple single bits of information in the space that one integer value takes in memory and to evaluate single bits of information from it, you use the bitwise AND operator with a bitmask to select it.
  3. Hi apeisa, thanks for the quick answer! The hint with $page->viewable() is very much appreciated, I didn't think of using it for this because I thought, it was only concerned with access rights management and not with the page status itself. Very good to know for a lot of use cases. Still, this doesn't really cover my use case, because I want to explicitly echo both statusses for unpublished and hidden. I'm just going with something like this now: echo $page->is(Page::statusHidden) ? 'hidden' : 'not hidden'; echo $page->is(Page::statusUnpublished) ? 'not published' : 'published'; I'm totally fine with it. I just had it with $page->isHidden() before which looked strange and made me feel like I missed something at some point. So, not really a need to change, just a little incoherence here. On the other hand, to make it coherent it would need to either provice a convenience method for all statuses (which seems a little over the top) or to omit them all (which breaks backwards compability). It seems the best way would be to leave everything as it is.
  4. Hello everyone, looking at the API docs I just noticed, that in the class Page there is a method isHidden() but no method isPublished(). As I understand it, the proper way to to get the published status would be: $isPublished = !($page->is(Page::statusUnpublished)); Since I'm ok with that, I think it is a little incoherent to have a convenience method for the first but not for the latter. Or did I miss something here? P.S.: What I want to do is to show some infos in the frontend to the content editors like whether the page is hidden or published. Just looked strange in my code so far.
  5. Soma, this is so great, thanks a lot for your good (and amazingly quick!) work! This works like a charm and the best thing is, that you can literally read through the code and grasp anything that is done there. Not that I would have been able to do it like this, especially not in that amount of time. This really shows how much thought was put into the PW API. Are you going to submit this to the official module repo? There's are still possibilities for improvement, like but not limited to: apply to flat textfields as well, making it count words, and preventing the user from typing more than allowed in a more drastic way. With your foundation, I will definitely be able to implement this. By the way, did I thank you already?
  6. Wow, this sounds perfect, thanks a lot! I'll definitely give it a try and will come back here, if it works out. Might take some time though...
  7. Hello diogo, thanks a lot for pointing this out, as I wasn't aware of it! This will definitely be useful for a lot of content editing. Still, what I was thinking about were more the text-only fields without any WYSIWYG editor or any tags. I was thinking about adding the charcounter for the meta description field, to give the content editor some immediate feedback on how much chars where used. It would also be great to have a word counter (and maybe a comma-seperated items counter). Also, I usually like to give the content editors as few as possible opportunities to make something wrong, avoiding WYSIWYG as much as possible. So even parts of the content may be written as plain text in the backend and all converting to beautiful HTML (if any) is done in the template. For me this has lead to much less errors and more stable sites. Still I would like to give the editors feedback on char count (and even better optional/additional word count). Because I'm still new to ProcessWire and module development for it in particular, maybe someone can give some pointers on what would be the best route to make a module for this functionality. What would be the best place to hook in to inject the JS? Can I add this to the standard text/textarea Inputfield modules without problems (which would be the more elegant solution imho) or would it be better to use the original modules as a starting point and make my own module from there (which should require a lot less work)? With kind regards, Marc
  8. 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/TextareaCounter
×
×
  • Create New...