-
Posts
4,055 -
Joined
-
Last visited
-
Days Won
67
Everything posted by Pete
-
But you then end up with another problem - I've had dealings with a multi-lingual site before and the company who owned it decided to have most site pages translated but with news being specific to their dealings in each country, so you can't in that situation have it creating a new page in each language for every page. The way I've seen of doing this in another CMS was that once you had set up the module that tells the CMS to expect multi-language content and you've set up the root pages for each language, when you add a page to a section there are links at the top of that page to create the same page in one of the other languages or, if it's already linked to another page then you can switch across to that other page easily without having to go back to the page list. I think this was the best solution I saw as rather than creating new pages in every language automatically it just made it easier to create and switch to the alternative pages instead. In theory a module could be written to handle this, but it's something that's a bit beyond my level of knowledge in PW at the moment.
-
Looking at the function getRandom() this should work: $rndm = $pages->find('template=xxx, limit=40, sort=-created')->getRandom(4); 4 in this case being the number of random results you want to return, and note the minus before created else you'll be getting the first 40 created pages for the template instead of the last 40. The actual getRandom function is on line 368 of wire/core/Array.php EDIT: Just tested it on my install and it does work, pulling 4 random pages from the last 6 in my case (easier to debug as I can remember the last 6 I added ). The full code I used was this (my template was game in this case): $rndm = $pages->find('template=game, limit=6, sort=-created')->getRandom(4); foreach ($rndm as $pg) { echo $pg->title . "<br />"; }
-
This thread discusses a couple of approaches - not sure if it's of any help to you though: http://processwire.com/talk/index.php/topic,311.0.html
-
Good points there - for me, I just renamed the Pages page to Home as it made more sense to me (used to seeing the tree on the admin homepage in MODx), but you're right that it's a little tricky to add things the way it is as there's only one template file you can edit. It's not hard to check if we're viewing the Pages page and running code if we are but gets a little messy after a while. Not directly related, but as I was adding content to a section yesterday I was looking through the PW source code to change the site tree so pagination kicks in at 30 pages rather than 50 and I've got to give credit to ryan's code commenting which told me I can just to it in the module settings - awesome stuff as I didn't realise modules had settings (not really looked into them in detail) and probably would have hacked it otherwise. Hooray for good code commenting
-
Just for info, attached is what I came up with. First screenshot shows the PW admin page with the last 10 press emails on the right and the second screenshot shows the first email in the list open in a modal window (the 1 of 10 and Next links at the bottom are both part of the modal script I used - it'll basically load the next email in the list as I set those links to be part of a group). The modal window uses a slightly modified version of Shadowbox - purely because I'm used to it and know all the config options. If I was feeling less lazy I could just have easily took some time to use the modal script used by PW. Also, I renamed the Pages page to Home (again, just personal preference) and put a header at the top of the page list and the email list. I'll almost certainly be tweaking the admin style at some point as I'd really like to spend a bit of time making it feel like the rest of the site - not that I've got anything against the pink mind you! Again, no particular reason for re-theming the admin area, just thought it would be good to get to know the CSS and the template. Anyway, for now I've got to put aside these nice distractions and get on with copying the site content over this weekend. It's going to take me a while so best get started! EDIT: Sorry, you'll have to scroll to the bottom of the attached images and scroll right to view them properly. Not sure why attached images get inserted into the forums this way...
-
I'm thinking of perhaps taking it one step further and if someone emails us with news - a games developer for example - it could take the contents of the email and set up an unpublished page in our news section at the click of a button that then we can edit and publish. These are all very fancy things that we don't really need, but sometimes it's nice to see what you can do with software Off topic - we could probably do with a form for general coding talk when you're back ryan - no rush
-
Ah well it was all plain sailing until I had to create a wrapper so that it didn't interfere with Processwire and also I had to change the class as it retrieved emails oldest to newest with no option of doing newest to oldest (which you would think would be the default). I submitted some code changes over on their site and I'll post my little wrapper script here in case anyone needs to use Flourish and PW together in future - no point anyone else scratching their heads as much as I was yesterday, though I'm sure someone with better OO PHP skills would have worked it out quicker. Still, I now have the latest 10 emails pulled into my PW admin page and can click on the titles to open up the contents in a modal window so I'm happy despite the learning curve The idea of all of this is it's for my gaming site and we have several editors who post news to the site and the emails are from publishers who send news to our press email account so it'a just a neat way of having everything in one place. I'm also intending to pull in information submitted through the site's contact form, so eventually the site admin page will be a hub of useful information for editors to dig into and update the site with.
-
Oh, and I should probably say that if anyone has found or used a more compact email class/library for reading mailboxes and emails then please share as it's one of these niche situations that comes up every so often.
-
I had need (or rather the desire) of a decent class to read and manipulate an IMAP mailbox and do some other functions, and whilst you can do this with PHP's built-in IMAP library it's impossible to do something as simple as fetch the last 10 emails for example - bizarrely you can only go for other filters such as unread, or a date range etc. There are also other things that I thought should be far easier than they were so I started looking for alternative solutions. I went trawling through Google results until I found, or rather rediscovered, Flourish: http://flourishlib.com/ . It seems to have an excellent mail class to do everything I want and more and what is even better is that on the jQuery-like advanced download page you can click on the class you want (in my case fMailbox) and it selects other dependent classes. It comes out a bit weighty with those other classes at over 129kb compressed, but to be honest the features I'm going to code with it are only for staff users on a website so I'm not too bothered about a little bit of overhead. Anyway, it's not something that's competition to ProcessWire, as Flourish is a library and not a CMS or specific framweork, but I thought it was worth mentioning because it looks quite handy in specific situations such as this where you want to code something that would be fairly complicated if done from scratch and you don't want to reinvent the wheel. It's also something I've searched for dozens of times before without actually successfully finding a satisfactory solution that looked well-coded or that didn't make the page it was used on slow to a crawl. I'll let you know how I get on with it anyway if you're interested
-
One thing I've seen on another CMS' website (MODx's forums actually) is a jobs board. What you might get is someone who likes the look of a CMS but can't develop the site or a specific feature themselves, or you might get a customer whose developer has vanished and needs someone to take over maintenance of a site, or maybe just some lucky web design company has too much work on and is looking to outsource. Some form of job listing would be a fantastic addition, perhaps with an option to list budget (though the majority of people will probably be asking for private quotes). Just a thought, and it's one of those things that doesn't sound like it would get used much but you'd be surprised - the on on the MODx forums has a steady stream of requests coming in.
-
Going to be without internet access for a few days
Pete replied to ryan's topic in News & Announcements
Just don't think about the motion of the ocean and you'll be fine. You get used to it after a while and then it's land sickness you have to worry about when you get back ashore Have fun! -
I think that for the jCrop type implementation you are giving the user the ability to set what gets cropped (which has already been said earlier) - by default it just goes of whether it hits the width or height of the original image first whereas what jCrop lets you do is select part of an image (and you can set fixed dimensions too so users are forced to drag a rectangle at 16:9 ratio for example) which then tied in better with thumbnailing on the front-end. For now it works fine and on the site I'm building I'm very impressed with it, but with some optional jCrop functionality it would be amazing Looking back at that, I'm just reiterating what others have said here, but fixed aspect ratio is a good thing to be able to set as well I reckon.
-
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.
-
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.
-
Going to be without internet access for a few days
Pete replied to ryan's topic in News & Announcements
Unless you have a laptop and you really want to But no, seriously, have a good break from it all. -
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.
-
Awesome stuff ryan - works a treat
-
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?
-
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
-
Another useful example there - thanks ryan. In no particular order: Designer, developer, composer, movie star
-
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...
-
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.
-
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.
-
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.
-
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