Jump to content

Pete

Administrators
  • Posts

    4,046
  • Joined

  • Last visited

  • Days Won

    67

Everything posted by Pete

  1. It literally runs your code before that process - saving the page in your case.
  2. I think I encountered this one a while ago when I was writing a module that wasn't as optimised as I'd thought at first. Did you install any modules around the same time? Of course, xdebug might be complaining if multiple pages are saved at the same time, as is the case if you re-order pages for example (I think every page on the same level has to have it's position saved so the same functions will be called then and that could be what it's complaining about). I ended up not using xdebug as it was more hassle than it was worth and turned on proper PHP error reporting and put PW into advanced mode in the config to get detailed error messages that way.
  3. Yup - you may well face-palm when you see the copy function ryan posted, but I tend to get confused with this at times too, especially with form input (move_uploaded_file in that case, but you can also use copy in that case as well which confuses me more, even after reading PHP's notes on the move_uploaded_file function).
  4. Just a guess, but do the other fields it's nor parsing contain a colon as well?
  5. No worries - to be honest I didn't even realise it was a GIF until I uploaded it and I'll probably just convert it to a PNG anyway. I think in my code in the past to get around potential headaches with grainy thumbnailed GIFs I saved them as JPEGs instead to get better compression, but that's not always going to be the desired way to do it.
  6. Hi I think there might be a problem when showing thumbnails in the page editor if they have transparent backgrounds (see attached image). Basically when an image is resized I don't think it's storing the transparency data. It's been a while since I looked at thumbnailing in PHP and I think you can save that data when thumbnailing gifs, but an easy solution here would be to set the canvas background to be white instead of black (which I seem to recall is the default) since the page background is normally white in the PW backend. Obviously saving the transparency would be the favourite solution as I know we have one dark admin theme already. Possible solution here: http://www.php.net/manual/en/function.imagecopyresized.php#104556 Not sure if there would be similar issues with PNGs?
  7. It's actually really useful seeing this piece of code develop as I keep forgetting you can chain multiple things together like this. The beauty of this jQuery-inspired way of doing it is that it still remains readable afterwards too
  8. Congratulations on releasing another very useful module so quickly I like this one especially as it's somewhat similar to various forum software solutions for styling post content, but it actually teaches people some HTML instead of dumbing things down, whilst just making some things quicker for the rest of us.
  9. I was thinking that if you have a "Tags" field then it will search all Tags fields on all pages where the field is used and suggest tags as you type as it does on some of the examples on his site. I know it's not particularly simple, but on a per-field basis where you would use this it would be neat to have the ability to tick a box to enable this as I can see places where it would be handy and places where you might not want it. In the tags example it might stop someone adding a tag that's spelled slightly differently by accident or something like that. That's not normally a problem with one author, but could be in a multi-author environment.
  10. Holy crap, this is great and would come in very handy for blogs (which I would guess is what you're using it on ) - does it have an auto-complete option like on Guillermo Rauch's site?
  11. Very nice site! Loads pretty quickly for me too, but if there are complaints about speed you could always look into PW's caching options (if you haven't already). Love the page showing the monthly post stats and the tag cloud as well - I was thinking a few weeks ago how to do a tag cloud and it was pretty easy but I've just not had the need to implement one yet. As with most things in PW it's a case of working out how to do something not if you can do it which is the beauty of the platform. I'm also converting a site from Wordpress to PW but it was only because WP was used for the original site (which isn't actually a blog site), and now the client is happy to move to PW to get away from the seemingly-regular security updates in WP. WP is a well-established platform, don't get me wrong, but surely there can't be that many security issues left to fix by now?
  12. Cool card I too will likely be on and off the computer throughout the holidays so I'll give it a spin as well.
  13. Happy Christmas guys and have a great new year
  14. If there's only one bkgimage for a page you could do something like this: <?php echo $page->bkgimage->first()->url; // or $home = $pages->get("/") ; echo $home->bkgimage->first()->url; ?> Bit simpler. Or if you want to upload multiple images for each page and pick one from random on each page load you can do this: <?php echo $page->bkgimage->getRandom()->url; // or $home = $pages->get("/") ; echo $home->bkgimage->getRandom()->url; ?> For an idea of things you might combine to achieve different results, the Cheatsheet is definitely worth a look if you've not seen it already: http://processwire.com/api/cheatsheet/
  15. Just a guess, but shouldn't it be this for the parent image URL? $page->parent->bkgimage->url As far as I'm aware yoyu can't use $parent - the easiest way to think about it is everything is in relation to the current page you're on, so parent is $page->parent and children are $page->children and the value you're looking for gets appended on the end, so $page->parent->bkimage->url or $page->children->first()->url as a few examples.
  16. Pete

    newbie

    What would you like it to do? This page contains a lot of information on the subject here: http://processwire.com/api/templates/ And there's an excellent tutorial by ryan here: http://processwire.com/talk/index.php/topic,755.0.html EDIT: forgot to mention that the files themselves are in the site/templates folder for the default template - you would be looking to work with head.inc, foot.inc, home.php and basic_page.php as your most common files to begin with. Hopefully a combination of the above information will give you a good start
  17. That's the way I'd suggest doing it too - much tidier
  18. Here's my script. I looked through it and it was showing it's age a bit in terms of how scrappy the code was (and the email bit in particular is unnecessarily repeated) but it works and I've commented various lines and made it slightly less horrendous to follow. You'll have to look at the various vars like the paths and database login details and adjust them to suit your site. I then created /home/mysite/backups and inside that backups folder I put the script and folders called "site" and "db". These are all required steps. I keep it outside of the public_html folder - the cron job runs it just fine there and there's no danger of someone being able to download your backups You would then simply set a cron job to run daily at a sensible time to kick off the backup. The script is adapted only slightly from techniques on this very useful website: www.tips-scripts.com To actually get the backups from the server to your PC on a regular basis, I use this program: http://2brightsparks.com/syncback/sbpro-features.html . It's reasonably-priced and you can schedule backups from FTP which does the job. Granted you could also achieve the same in Windows with a .bat file and Windows Scheduler (and I have done in the past) but since I also use this backup program for other stuff (mirroring external hard drives etc) I just do it this way. EDIT: I know there's a bunch of repeated code in there, and thinking about it I've just thought of an excellent way to do this on my VPS so that from the root account it goes through each website in sequence so I only need one copy of the script, but it does give you an idea of what you can do with a few lines of code and the right privileges on your server cronbackup.zip
  19. There will be a way to do it, but I thought I'd just weigh in with the note that if you keep moving published content, you'll hurt your search engine rankings, especially if it's a page that's been indexed for a while. The best thing to do is stick to a structure and not be tempted to move stuff about. That said, if you're only going to move a page once maybe, then a 301 is the best way to go as ryan says. You could even write a little module to edit your .htaccess file and have it append moved pages to the end whenever you move one theoretically, but that's a bit overkill as you shouldn't be moving that many pages that often anyway
  20. I've got a situation where I've got a "request a callback" type form on every page, and a normal contact form on the contact page for a website. I noticed that if you re-use fields and don't fill the name out on the Contact form, it displays the errors on BOTH forms. I then changed the fields so they each had their own fields, and then when you submit an empty contact form it correctly displays the errors for the contact form, but the other form is replaced by the "Thanks you, your submission has been sent" message. So... there are some issues with multiple forms on the same page Is there any easy way to tweak the code so that it handles multiple forms correctly? I was thinking the easiest might be to pass the template name as a hidden field and also use it as the ID for the form - that way some checking could be made which then correctly processes only the one form (I'm assuming it processing any forms it finds at present?).
  21. (Got sidetracked porting 3 sites to PW, but they're all nearly done now so I'm hoping to find time to look at this again this week).
  22. PHPMyAdmin would be my preferred choice. Unless you have literally hundreds of thousands of pages, the single-file dump that it creates is fine, and you can also specify that it be zipped prior to download. On a slightly related note (that doesn't help you unfortunately ) I have some excellent backup scripts that run via cron jobs that back up site and database information that I'll have to post here at some point. They use system commands that I imagine you wouldn't be able to run on your hosting, but might be useful for others.
  23. On IIS7 you don't even need ISAPI URL Rewriter from what I remember when tinkering with our server at work - if you go to Microsoft and download the IIS version of PHP from there there's a tool that actually converts the htaccess directives to something native that IIS can use. They're actually getting better at native support of PHP. Not that that helps if you're not using IIS7 or don't have control over the server, which I imagine maybe you wouldn't on shared Windows hosting
  24. Pete

    For Antti

    Looks like a pirate's cutlass to me. Either way he's a special little lion who's had his front paw replaced with a human arm and stabbed himself accidentally through the head so we'll let him off
  25. Pete

    For Antti

    I only just realised he has a human hand too Forwarded this to one of my friends who's from Sweden and he found it very amusing
×
×
  • Create New...