Jump to content

Pete

Administrators
  • Posts

    3,994
  • Joined

  • Last visited

  • Days Won

    64

Everything posted by Pete

  1. Maybe this is fixed in SMF v2? Not that that would be a good enough reason for upgrading - other than this the forums work as intended from what I can tell.
  2. I'd forgotten about this topic since I've not got around to the file uploader part of my project yet, but I know when I went from jQuery 1.3.x to the latest on another project a few weeks back it didn't break anything at all. I love jQuery for that. They may eventually drop support for deprecated functions, but for now they're keeping upgrading very simple indeed. Slightly off topic but I've been meaning to say it anyway - the level of helpfulness around here reminds me of jQuery as well. You can always find someone to help you out on the jQuery forums - something that made me ditch MooTools very early on as you'd often get scolded there for asking a simple question - yes stuff might be in the documentation, but as documentation grows it's harder to find an answer for your specific needs - especially when you're not used to the terminology - and the forums at jQuery and here at PW are great because everyone's really helpful. Not trying to suck up or anything, just saying it's the best way to grow a community and the project it's attached to so keep up the good work guys.
  3. Unless you have a laptop and you really want to But no, seriously, have a good break from it all.
  4. Hmmm... hadn't noticed to be honest, but that's probably because my way of reading forums is to click "Show undread posts since last visit" and then open each thread in a new tab.
  5. Awesome stuff ryan - works a treat
  6. Hi folks What I'd like to do is grab a random image to display. It's not as simple as grabbing a random image from a specific page though - I've created a Page Headers page with each child page being a specific category which contains multiple images for that category (Natures, Movies etc.). Therefore what I need to do is pick a random image based on a template - in this case it's called page-headers. This is pseudo-code, but how I'd imagine it working is something like $pages->find("template=page-headers")->images->getRandom(); Is it possible to do it that way or would I have to grab every page, iterate through them building a list of all images and pick one from random from that list?
  7. Good point - it would also be useful to be able to have versioning of modules, and comments with an option to have a comment be for a specific version. So if someone's commenting about something in a specific version that doesn't apply to later versions, then comments specific to an old version could be hidden (I'm thinking if someone commented about a bug then it wouldn't be relevant in a later version), and similarly it would be nice to have an overall rating for a module as well as ratings for the current version (I'm thinking Apple's app store here - things get low ratings but the things people have rated it low on are often fixed in later versions). And all these are things that are relatively simple to do in PW too I reckon
  8. Another useful example there - thanks ryan. In no particular order: Designer, developer, composer, movie star
  9. I think it would be useful, although potentially impossible if the number of contributions is too high, if there were moderators who checked out modules as they are submitted to ensure they work at least, and maybe have a sufficient level of documentation if it requires any. This could even go a bit further and module code could be checked over, but it's time-consuming and I think it would annoy contributors (just bringing it up for discussuon - I'm not suggesting it as an option I'd like to see personally). Probably a better way to do this would be what we have now in the forums - people who have questions or are writing modules are coming to the forums and getting help and feedback with their modules - I know I am - which leads to better modules as a result instead of folks like me struggling along, not asking questions and making badly-coded modules So yeah, if the community here is very welcoming, as it is now, then I think module authors will come here to ask questions and test out ideas before releasing modules. Forum bridges are hard work. I've dabbled with creating some basic bridging before and the biggest issue is that you're trying to work with two moving targets - every version of a CMS (not necessarily PW) that comes out can have an affect on your bridge as can every new version of forum software, and forum software tends to have a lot more frequent restructuring to the codebase in my experience. As an example, I'm currently working with PW and IPB and have some fancy things working already, however nothing that would constitute a bridge - I'm purposely not importing users into PW or anything like that and keeping them separate to avoid lots of re-coding further down the line, but rather pulling user info from the forums only and checking some permissions based solely from forum user groups - it's easy enough to do this in each PW template and basically decide which forum groups can then access which sections rather than try to synchronise the two. Sorry, got a bit off-topic there...
  10. Whilst I understand why licenses are there and a lot of OS stuff is GNU-licensed, I think what it all boils down to at the end of the day is what the project author wants you to be able to do with their software. I think that even if it were left as GNU, which as you mentioned Adam is untested in a court of law, if the author of a particular piece of software said "I'm happy for you to sell it on if you like, modified or not" (unlikely scenario) then that would overrule whatever's written in the license from a legal standpoint (in fact, isn't a common theme in most licenses the phrase "without the author's express permission"?). What I mean is, the authors of OS software should license their software, yes, but also have a page on their website in plain English (other languages are welcome of course) explaining how they wish it to be interpreted. That way there's no room for speculation. As long as the license fits what they want as closely as possible and covers them if they do need to go to court, then I don't see the need for split licensing. That's just my view and I'm not a lawyer, but I've seen so many threads on OS software forums asking what the GNU license means in terms of what people can do with software that I think spelling it out is very important. Just checked the site and it currenlty reads: ProcessWire is licensed under the GNU GPL v2 - maybe this could be expanded in future with "...which means you have the author's permission to..." or something like that.
  11. The screenshot showing IE8 in standards-compliance mode sounds like it might be running in the "compatibility view" setting. I've had mixed results with that if I'm honest - in IE8, compat view was supposed to make it render like IE7, but for me it broke stuff that looked fine in real IE7. You could try adding this header to the page and see if it fixes anything relating to IE - it just basically forces IE not to use compatibility mode even if the user sets it in their browser: header('X-UA-Compatible: IE=edge); Unfortunately I've only got FF5 installed at present so can't test the FF side of things other than to say it looks fine in FF5.
  12. I think that now I've re-read the article the main area it saves on overhead is retrieving a large tree from the database, and unless you're insane you're not going to have a sitemap for users that lists every page for an x-thousand page site anyway. And then, as you say, you're back to excluding hooks from running at that point.
  13. I was about to say we'd then need to start thinking about a platform to build the marketplace on but then I remembered PW can do all that. Maybe we need t-shirts with slogans like "PW can do all that". But maybe someone else should come up with the slogans
  14. Yup - admittedly in the scenarios I was thinking of when I was worrying at the beginning of this thread were actually for pages in a category sorted by date, descending, so there was no need to be worrying about that really. I think you're right - it's going to be very rare that that's an issue, so it's lower priority. There is a more efficient way of storing, retrieving and updating "tree" data though, but every time I've looked at it in the last few years it messes with my head: http://www.sitepoint.com/hierarchical-data-database-2/
  15. Hehe, I knew it would be a simple answer and it works perfectly - thanks
  16. Oh yes - nice link! Especially as I hadn't even thought about things like different languages for buttons and messages etc. Thanks for that!
  17. I'm not sure how you would do this, but the other way would be to have the URL be yoursite.com/language/page-name which is something you see on other websites. I guess in that case you could just have the languages as pages under the site root, then have fields so that when you create a page in a specific language you can pick the corresponding page from the other language sections. You could then even run a custom module on page save so that it updates those pages in other languages to make sure they also associate with the page you're editing as well. That would then be a pretty easy way to check if there is a page for a given language as well, and also gives you the option of having language-specific page URLs, titles and content. Just another suggestion for a way of doing it, though this suggestion would require some additional coding in order to work. I do like the way that with only a few minutes thought about it I know that what I've just written is both possible in PW and also technically not very difficult to do
  18. Hi guys This may be one that only ryan can answer, but I'll ask you all just in case I've been working on a module that hooks into the page save function to add/update a forum topic associated with a news article on my site. It works fine for the most part, and I've been able to debug it using Firebug (useful as dragging items to trash and moving pages to another parent from the main pages list in the admin is done via AJAX). It does seem to work very happily now, however I noticed something a little unexpected. When I drag an item out of the trash and into the site root for example, my AJAX debugging (basically echoing "hi" on page save) seems to suggest that it saves the page twice (in Firebug this echos "hihi" to the console ). Every other way of moving it only saves the page once. Is there any reason why it saves the page twice when it's moved out of the trash? As a side effect, my code doesn't like that (not that that's a problem with your code by any means, just that my code for some reason loves moving anywhere else but out of the trash because of the two page saves for some reason). If there was a way once a page is moved from the trash to only run the hook ONCE then that would also be a good way, but as I don't know what it's doing the second time around it's hard to solve.
  19. Just a quick one on whether modules and templates etc would be open source or commercial - I'd suggest having both. The big issue you run into with commercial modules is that if someone's charging for something before the end-user can download the code and it doesn't work or it's just an empty file or something silly like that, and the modules are being offered through processwire.com then ryan's going to be the one who ends up with the complaints. Not that I always think of the worst case scenario... Or you could have a team of helpers test each commercial module/template etc before approving them for people to buy. Maybe offer open source modules and "official" commercial modules (if there will be any) on this site and let others who want to sell modules do so on their own sites? It's a big discussion, so probably a good idea to start it early, but I guess a lot of what I'm talking about above would come down to ryan's preferences.
  20. Cheers ryan - I'll do some more tinkering, but it sounds like these should work if I can get my code working. The code you just posted to detect previous parent - is the previous parent saved somewhere in the db then after a page is moved, or is this info available just before the page is saved? Just curious.
  21. The functions in wire/core/Pages.php are: find save saveField trash restore delete So I guess Restore is going to be the one used when moving a page out of the trash - that's one thing potentially solved at least.
  22. Hehe, now I have the problem of when a page is moved to trash in the main Pages list rather than via the page editor itself my module won't run. Same problem if I empty the trash from that main page list. I'll have a look for hooks for those later on
  23. Just a quick question - would this even affect your SEO? I would have thought that either way either link would take you to the same place so it shouldn't affect SEO. I might be wrong though - entirely possible
  24. Oops - it's an obvious issue in my code that I worked out this morning before I even switched my PC on. More late night tiredness getting in the way If it's in the trash, it's no longer relevant to check the page's parent - it's no longer under the news page instead I really should be checking for the page template ('news' in this case) so it doesn't matter where the page is on the site. I'm getting there and learning the system as I go. Hopefully tonight I'll have a more comprehensive module because of this.
  25. Just for info I've got this all working now. The process goes something like this: 1) Before a page is saved, we check if it's published using if ($page->status >= Page::statusUnpublished) { 2) If not, then we don't need to create a news topic in the forums as the page is obviously brand new and not visible on the site yet, but we should update the forum topic if there is one (checks hidden news_topic_id field in the template, then updates the forum topic if there is an ID in that field) 2) If page is published, check there's a topic id in the news_topic_id field - if not, create one and if there is update the topic 3) If a page is deleted (to the trash) then remove the forum topic if there is one Now, I ended up using the trash function instead of the delete function purely because I couldn't figure out how to run my module when the trash is emptied. Any suggestions on how I might convert this to run the module and execute the code below when the trash is emptied instead of a page being moved to the trash? Here's my hook for when a page is saved and it's moved to the trash: $this->pages->addHookBefore('trash', $this, 'deleteNewsTopic'); and here's my function that that calls: public function deleteNewsTopic($event) { $page = $event->arguments[0]; // Check it's a news article if ($page->parent_id == 5831) { require_once('IPBWI/ipbwi.inc.php'); if (!empty($page->news_topic)) { $ipbwi->topic->delete($page->news_topic); } } } There's other code in there too, but this is just the few snippets for this particular part I tried changing 'trash' to 'delete' in the hook, but that doesn't work - probably because you're not viewing a page when you empty the trash... but I'm not sure how you would add a hook to the actual act of emptying the trash (and presumably then there would have to be code iterating through the pages being deleted, checking the parent ID for the relevant page parent (5831 above is a page called "news" and I bet there's an easier way to do that than remembering the page ID ), then checking the news_topic_id field and deleting topics from the forums as necessary. Other than that the complete module I've got works perfectly and with so few lines of code too!
×
×
  • Create New...