Jump to content

Pete

Administrators
  • Posts

    4,054
  • Joined

  • Last visited

  • Days Won

    67

Everything posted by Pete

  1. Thanks ryan - just two things: addPageAfter <- I didn't get that bit - do you mean addHookAfter? Also, I'm trying to display the message in both the admin and live side of things. My thinking was that sometimes if you're logged in as an admin and you're previewing changes to pages on your site there's the possibility you could forget it's in maintenance mode, so a message in both places would be good. For that reason I'd probably go with your first suggestion in this case as both the admin and page templates are likely to have <body> tags (though I realise I'll have to do some extra regexp in case anyone's modified the body tag in a template file).
  2. I'm creating a "maintenance mode" module and the somewhat-basic version 1 is almost complete. What I'm trying to do now is display a message for logged-in superusers that the site is in maintenance mode and add it to the top of the page. This will appear on all pages in the admin and front-end. What I would like to know is if there is any way to add code just after the opening body tag? I would assume that since every template is different, what I would need to do is do some sort of regexp to find the opening body tag and slot my code in just after it. Any ideas how I can access the page output before it gets outputted? My module is hooking into Page::render like so: $this->session->addHookBefore('Page::render', $this, 'maintenanceCheck');
  3. Cheers ryan, bizarrely it was still doing it this morning before using the updated code so my test server on my laptop had been restarted. Once I updated the code to the version you updated the issue went away. Very strange, but fixed now
  4. If I'm understanding you right, you could create a template called "language_root" and set it's "Allowed template(s) for parents" status to "Home" (or whatever the template of the homepage is on your particular site). That setting is under the Family tab when editing a template anyway. Whilst it doesn't prevent someone from reordering the pages at that level, I think that would lock those pages in place though I've not actually tested it.
  5. Hmm, that's weird as all I was doing was clicking on New from the admin homepage to create a new page. I'll try the updated code thus morning.
  6. I just downloaded the very latest build as I hadn't done in a while and I'm getting an error message when adding new pages - it says "Unexpected input". I switched developer mode on and here's the full output: TemplateFile: Unexpected input #0 C:\xampp\htdocs\sc11\wire\modules\Process\ProcessPageAdd\ProcessPageAdd.module(80): ProcessPageAdd->processInput(Object(InputfieldForm)) #1 [internal function]: ProcessPageAdd->___execute() #2 C:\xampp\htdocs\sc11\wire\core\Wire.php(267): call_user_func_array(Array, Array) #3 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('execute', Array) #4 C:\xampp\htdocs\sc11\wire\core\ProcessController.php(194): Wire->__call('execute', Array) #5 C:\xampp\htdocs\sc11\wire\core\ProcessController.php(194): ProcessPageAdd->execute() #6 [internal function]: ProcessController->___execute() #7 C:\xampp\htdocs\sc11\wire\core\Wire.php(267): call_user_func_array(Array, Array) #8 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('execute', Array) #9 C:\xampp\htdocs\sc11\wire\core\admin.php(42): Wire->__call('execute', Array) #10 C:\xampp\htdocs\sc11\wire\core\admin.php(42): ProcessController->execute() #11 C:\xampp\htdocs\sc11\site\templates-admin\controller.php(13): require('C:\xampp\htdocs...') #12 C:\xampp\htdocs\sc11\site\templates\admin.php(13): require('C:\xampp\htdocs...') #13 C:\xampp\htdocs\sc11\wire\core\TemplateFile.php(88): require('C:\xampp\htdocs...') #14 [internal function]: TemplateFile->___render() #15 C:\xampp\htdocs\sc11\wire\core\Wire.php(267): call_user_func_array(Array, Array) #16 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('render', Array) #17 C:\xampp\htdocs\sc11\wire\modules\PageRender.module(194): Wire->__call('render', Array) #18 C:\xampp\htdocs\sc11\wire\modules\PageRender.module(194): TemplateFile->render() #19 [internal function]: PageRender->___renderPage(Object(HookEvent)) #20 C:\xampp\htdocs\sc11\wire\core\Wire.php(267): call_user_func_array(Array, Array) #21 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('renderPage', Array) #22 C:\xampp\htdocs\sc11\wire\core\Wire.php(289): Wire->__call('renderPage', Array) #23 C:\xampp\htdocs\sc11\wire\core\Wire.php(289): PageRender->renderPage(Object(HookEvent)) #24 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('render', Array) #25 C:\xampp\htdocs\sc11\wire\modules\Process\ProcessPageView.module(73): Wire->__call('render', Array) #26 C:\xampp\htdocs\sc11\wire\modules\Process\ProcessPageView.module(73): Page->render() #27 [internal function]: ProcessPageView->___execute() #28 C:\xampp\htdocs\sc11\wire\core\Wire.php(267): call_user_func_array(Array, Array) #29 C:\xampp\htdocs\sc11\wire\core\Wire.php(229): Wire->runHooks('execute', Array) #30 C:\xampp\htdocs\sc11\index.php(170): Wire->__call('execute', Array) #31 C:\xampp\htdocs\sc11\index.php(170): ProcessPageView->execute() #32 {main} Any ideas?
  7. Essentially in the backend templates are just "forms", but I was less confused about template files and admin templates personally because they're directly related. That might be my brain just being able to work that out easier.
  8. Glad it's not just me going crazy Perhaps some cached JS?
  9. Cheers ryan, that makes sense. I keep forgetting pages aren't really pages in the conventional sense and that having lots of them doesn't mean it's a bad thing. EDIT: In fact, as there will only be one main gallery on this particular site and it would only be users adding images, I suspect the easiest thing to do would be to simply add an Images field to the Users template and do it that way.
  10. Makes sense - once a site is built the client isn't generally going to need all the extra options to just edit pages and add the odd one or two.
  11. The ListAfterSave module by adamkiss saved me lots of time yesterday when importing some very basic pages where it was quicker to do it manually than write an importer - very handy module. One thing I would say about this whole area of what to do when a page is saved is that I think it could do with being improved in the core itself. There are a few extra options I've used in MODx in terms of page saving that I think would be beneficial here, as in some cases when I save a page I will want to return to the page list, in other cases I'll want to immediately add another page to the same section and in some cases I'll want to save and stay editing the same page. Below is MODx's solution - a drop-down that remembers which selection you've made, presumably by way of a session variable as there's no need to remember it for more than the current browser session. The ListAfterSave module does get me part way there if I want to add a new page quicker, but there's still an additional click to be made and, multiplied over many iterations when you're copying in text for a client for example it would be handy if there was a quicker method such as this. Additionally, that toolbar in the image below scrolls down the page with you as well which I found a bit neat - handier on long pages where you're making a tweak to one field halfway down a long list of fields and you just click Save rather than scrolling up/down to save. Not at all necessary, but I like nice UI features like that.
  12. You don't have to apologise for having a life ryan I think I probably spend an unhealthy amount of time in front of a computer, but since I might have an additional family member next year at some point I'm kind of determined to get some things done website-wise whilst I still have a chance to throw some extra time at them!
  13. Just a quick one here - I think when you then go to add a child page, the template list should reflect the order you have them in when specifying possible templates. I've got a slight issue where there are 3 possible child templates, gallery_home, gallery and page, and page would be the most commonly used child template, yet the list is in alphabetical order no matter what order I drag those fields into when specifying the choice of templates. I guess in many situations it would make sense to have it alphabetical if you're specifying a lot of child templates, so perhaps have a checkbox when specifying child templates to allow the admin to specify that the list should appear alphabetically instead of the order they are in the list, or vice-versa if you think alphabetical ordering should be the default?
  14. This is in Firefox 6 (these version numbers with Mozilla are getting silly now!). I'm using the latest build again downloaded half an hour ago and still see the issue. Same issue occurs in IE9 though so don't think the browser is the issue unfortunately.
  15. Hi guys I'm reasonably sure that PW doesn't store this at present, but I just had someone ask me if I could build a website (yes) with a central gallery (yes) and the option of user galleries (yes, all easy enough). What I did think of though was that it would be nice to have the option of creating a simpler user gallery - in this case the client would be happy enough if everyone simply uploaded images to the central gallery and the individual user galleries were just based off photos uploaded by particular users to the central gallery. The only issue is that PW doesn't appear to track who's uploaded an image. Is it possible to add the user id to image and file fields in a future release and have it as a searchable field as well? I was also thinking with my admin hat on for a second, and thought that if you have a collaborative team working on a website and someone gets a bit disgruntled and starts uploading nasty images or files etc then it would also be very useful to be able to find out who'd done it, otherwise you could have a real headache tracking down the culprit. 99% of the time this would never happen on a collaborative website and I've not come across it before, but might be worth adding anyway just in case. Much less likely in business situations and organised clubs/groups, but still a possibility. It's not about not trusting the people you work with, but having the tools necessary to resolve a potential issue quickly
  16. I've only got one install running at the mo, using the latest code as of an hour or so ago. It's consistent though - definitely not a one-off.
  17. It's only a very slight issue, and I hesitate to call it a bug as nothing's actually broken, but when creating some fields of the Page variety, I seem to be seeing double - see attached image. I'd have put it in the tracker but you can't upload images there. Nothing too major, but this seems to have crept in with a recent update. Unless of course you're planning on being able to select pages from multiple parents just for fun ryan?
  18. And this is why I love ProcessWire Cool stuff!
  19. Hi guys I do like the ability to be able to set the choice of child template for children of a given page based on the parent template (hope you're still with me), however I've had a couple of occasions where I would have liked to be able to set the option for more than one choice of template for a set of child pages but not necessarily the whole list of templates (I have lots of templates). Would it be possible in a future version to be able to select more than one template for child pages of a given page's template, and if so it would also be nice - but not essential - if you could still set a default from that list.
  20. Pete

    Hard Drive Died

    Cheers guys. Yeah ryan, I'll give the freezer trick a go as I'm reasonably sure that if it doesn't work and I return it to the manufacturer they'll not be able to tell that I've tried it. The biggest issue is that I can't run any recovery tool until I find a machine that can actually see the drive. Thus far I've had no luck, but I've only been trying it on a few modern Windows 7 machines. I can't think that trying it on an older box with an older motherboard and XP would help but it's worth a shot as well. If all else fails I'll just have to re-do the work I've lost, which I'm beginning to do today anyway. I'm definitely not doing anything though until I've got things backed up this time! Thing is if you read the manufacturer's info about SSDs they're supposed to have somewhere between 1-2 million hours of use - that's their mean time before failure anyway (not sure how they come up with these figures as a million hours is a long time!). The thing to remember about MTBF though is that on average that's ho long they live, and it certainly doesn't mean they can't die inside 3 months like this one did. Still, it's not done as badly as an enterprise-class DELL hard drive we had in a server that lasted less than a week, and that was an old-school hard drive, not a solid state. Fortunately the servers are in RAID so it wasn't a problem - just swapped it out for a new one - but it does make you wonder. In fact, with the small number of drives I've seen fail at work in the last year (there are a lot of drives, so more are likely to fail) you'd think I'd have learned by now...
  21. Just a quick one as I know 2.1 is nearly here - is there any chance that we can have one of the things mentioned here applied to the functionality when you're adding an uploaded image to an RTE field? Whilst it's useful to be able to drag an image down to size to create a thumbnail, it's a bit fiddly to get it to a precise size each time. There are a few pages where I want to dot pictures throughout an article but want the thumbnails to be consistently the same width. The solution in another CMS is having two fields where you can enter width and height, and a checkbox that's checked by default that constrains the proportions (see attached image). Can something like this be added easily enough? I think it would just make it a bit easier to use.
  22. Pete

    Hard Drive Died

    Just taking a few minutes out of my evening to lament the loss of my laptop hard drive. It was an SSD and, as such, I'd thought it would be more robust than normal hard drives. Still, after 3 months use it's gone to hard drive heaven and I've lost a month's work that I won't get back. Fortunately I have two drives in my laptop and all of the design work goes on the other drive (a larger normal hard drive), but everything I've coded recently is gone Still, there's nothing too major lost here, despite my lack of regular backups - just one website template I'd started that can be re-done again from the Photoshop file and a lot of evenings' work on my gaming site that I was porting over to ProcessWire. The other bonus is that everything else I'd completed recently code-wise that did get uploaded to my web server can obviously been downloaded again so the only thing I've really lost is a lot of work on one site. It was good that I had a backup even though it was a bit old so at least all I had to do was replace the drive, run a few windows updates and that was it - no headache of an OS reinstall or anything. So I'm being optimistic in that all the stuff I've learned using ProcessWire means I can do it all again but quicker, and I've also really learned my lesson with hard drives now - back up daily, especially when you've got the luxury of two drives - I could have easily had all my website work backed up to the other drive... Oh well!
  23. The second way is how it works in MODx - well, their older branch at least. I do agree that it could do with a template-based option as well as a lot of the time it is only a few pages that might change as you guys say.
  24. Does the mySQL user for your database have permissions to create/update/delete tables? It needs to be able to. That's all I can think of right now.
  25. 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.
×
×
  • Create New...