Monday, September 28, 2009

Wordpress "Cannot modify header information - headers already sent by..." and malicious scripts

Cannot modify header information - headers already sent by...(and its a weird long url that starts above my root folder... whats that about?

UPDATE: This was caused (i think) by having extra whitespace in the function.php file after the last closing php tag. delete all unused lines and spaces in that and you should be fine. good to keep all php files neat and without random whitespaces anyway.

In WP admin panel, on the post page (I think when it autosaves) I get this message. I do not know if it is very bad. Some forums say remove whitespaces after php brackets in functions.php.
I will do that first, because this only began to happen after I began to work on the functions.php file in my child theme folder, and I make messy edits to things, upload to see if it works, and now this error is in the admin panel of my edit post page...
weird, it is either rogue whitespace or something more drastic...
seems to hacve fixed it for now.. havnt got that error in a bit...

IF ITS A MALWARE THING
this details how to remove the problem by reinstalling wordpress, or contacting the webhost

(excerpt, after reinstalling wp folder by folder and checking the actual files on the server...

Check your database for rouge user accounts.

change your admin password for the blog.

check your file and directory permissions

these are all things you need to do.

i think i this link it says what to do like changing the default admin password etc

Sunday, September 27, 2009

Nextgen gallery 1.3.6 and child themes templating solution

I am trying to template my nextgen gallery plugin 1.3.6, so it has custom settings when a gallery is displayed.
I am using wordpress Thematic child theme Monochromatic.

Error message where my gallery should be:
Rendering of template gallery.php failed

After about 3 hours of testing this and that situation I isolated the problem to be CHILD THEMES.
As in it works when i use WP Default theme, or put the required nextgen folder containing my altered templates IN THE THEMATIC FOLDER.

Which, if you follow and use child themes which I am all for right now, means that your child theme structure just started becoming messed up and pointless, impure etc...

but, i see that the developers of Nextgen are hard at work fixing this for the next release,
Changed : Support templates for child themes, use STYLESHEETPATH instead TEMPLATEPATH (THX to Prollius)

As my site needs to be launched like yesterday I cant wait for another release I am currently tossing up 2 options:

1/ alter the TEMPLATEPATH as mentioned above if i can find it in the code (making my nextgen plugin then 'impure' with my customisations) (This could fail if the nextgen next update dosn't end up including the script as i have put it...)
2/ Put my nggallery template folder in BOTH Monchromatic AND Thematic folders, ready for the switch when it comes... (This could fail if thematic is updated BEFORE nextgen is... how likely is that...??) think nextgen is updated more often than thematic...

ok i just did a find on TEMPLATEPATH in the plugins files and realised i dont know how exaclty to do that edit or in which file, i am assuming its more complex than just replacing the word... might try it if i have time, but for now... just bunging it in my thematic folder... this testing out the nextgen plugin to see if it meets my needs stage has ended up taking 3 days...

got to check which is more likely to get an update red flag thing that my client might decide to click and do themselves...
its such a pain this updating thing, like every few weeks something needs updating, how am i meant to hand this over to the client to self manage when all the software constantly needs updating... i can just see now, all these photobased blogs all updating at once and them calling me panicking because their whole site isn't working, (eg, the whole site is a photogallery and something has broken with upgrading... really risky...)

its like i need to have a clone of every site i make, somewhere, and try updating it there before it gets done on live site just to warn them asap not to self update if anything breaks...


Friday, September 18, 2009

wordpress commons faqs

common modifications
http://codex.wordpress.org/FAQ_Layout_and_Design

wordpress maintenance tasks...

read it really good and gives you a yearly schedule...
http://codex.wordpress.org/WordPress_Site_Maintenance

think about site optimisation - speed issues

Thursday, September 17, 2009

Trialing NextGen gallery 1.3.6 for a photographers website

Options > Gallery
the Deactivate gallery page link
options dosn't seem to work switched off... the page just reloads\.
actually correction it does work if you make a page for it, see this link for explaination

and when switched on, it shows the gallerys thumnails, but turns off the images of the other gallery thumbnails, weird... i only know this becaise i ave text on the page, which wont be there.

it loads the galleries/albums IN the page, which means i dont think you can have a different page template for the album and gallery pages...

"breadcrumbs..." i am panicking a bit about how to navigate back from the galleries etc.

Options > Effects set to none turn off the lightbox... i wonder how hard to turn it on only for certain galleries...

Thumbnails...
the only problem, i need 2 different sizes for thumbnails?? one for the album, one for the gallery, which i don't want to be previews but the actual final images, full size.

i think before i go to far i want to try the default wp gallery it might be simpler.. then decided not to... cant remember why... dont think it has albums... ??

"How to properly template Nextgen gallery?" Or
"How to modify Nextgen gallery and not loose your modifications when you update?"
OK i have been looking for 4 hours, madness, and finally i find it on the developers blog. I was really looking generally, for
what is best practice in wordpress world for modifying a wordpress plugin?
I assume it is NOT open the plugins folder, find its css files, edit, be happy for 3 months, then update and spend 2 days re-adding your edits back in... but nowhere on wp forums could i find any info on what is best practice... its so important.

anyway maybe it is down to the individual plugin authors files, and if they provide a way to externally override its settings (child plugin..)

anyway look here

and here is how to remove the gallery linking to a large image, and use the large image instead, you take away the link text and you take away the sizing, i think is what it is saying.
i have it working, but i cant post code it dosnt come out right. anyway, key was to do what that forum mentions, but also change the thumbnailURL to imageURL, obviously, so it displays the image, not the thumbnail... (as the thumbnail is permanently resized, you cant unresize it.)

Nextgen gallery templating and Child Themes
AHA!! the templating works in DEFAULT theme, but not my Thematic child theme... because it cant find the path, you need to put the nggallery folder with your customised gallery.php template in your THEMATIC folder, not your THEMATIC CHILD THEME FOLDER. ill write a separate post about this...

Usability issue of Nextgen gallery templating system for average CMS user
OK so another thing I realised, even if I did manage to get a nextgen gallery to use my custom template for both albums and galleries (no idea how to get INTO the galleries when its posted as an album), the user of the cms needs to every time they add a album to the page, add my custom template shortcode. This I think, to get the user to alter shortcodes, is too much to ask. I want to SET the nextgen gallery to use THIS custom template, always. Im sure thats possible but again i dont want to modify nextgen core files, but keep everything modular. I want the best possible backend experience, otherwise whats the point of having a backend if the user has to custom code things...

Looking for alternative to Nextgen - basically anything with simple Album bulk upload and sorting functions...
OK today is started to test a different approach. NOT using a gallery plugin, which seem unsuited generally, but rather using a post, which has the images posted one at a time, in the post, down the page. These posts are assigned a category, and when you click that category, it lists the excerpts (sort of) of all posts in that category.
ie main menu > fashion > (lists excerpts of fashion posts) > click one to get that post, which is a list of images.
The excerpt, or rather the thing that i have replacing the excerpt, is a thumbnail image manually added via a custom field, which links to its post.

This is actually an almost acceptable result, except for:
1/ Uploading of images for the user, is one at a time for adding to the post, and there is not organisation in WP media library, so its all a bit messy... but, its easy, and so shortcodes need to be used

2/ Thumbnail adding to the post is manual, via a custom field, resizing it yourself, and getting the URL path right. This is OK, but for end client usability I' rather use something like:
Simple Post Thumbnails
which has a lovely little panel at the bottom of your post for wsiwug thumbnails adding.

Tossing up whether to try and figure out how to implement it in the child theme (not as easy as 'find the loop, stick it in') since the loop is buried it needs a function... and to output a link aswell... problem is other plugins also mention stick it in the loop...


Or maybe WP built in gallery has some plugins that modify it to be like I want, basically i want the organisation of using a gallery/album structure, but not use the default gallery display which is columns of thumbnails, which link to their larger sizes, i want NO columns, and those thumbs to be The final size, and linked to from an album thumbnail.

Wednesday, September 16, 2009

CSS vertical centering, Galleria

Going to need a jquery gallery soon that takes different sized images that is embedded in the page, but functions like the lightbox style popups.

Main issue will be centering the image and adding in the next / prev buttons overlaid. Im thinking of using devkicks galleria and modifying to suit.

This article for x browser vertical centering. I have tried the table cell method on galleria and it works, just need to add in hacks for IE6,7 (but table cell works in IE8)
http://www.boutell.com/newfaq/creating/centervertically.html

the other issue is preloading, in the standard galleria, users dont click on a thumbnail until its loaded, which means they usually dot see an image until its loaded, whereas if i remove thumbnails, there will be no indication if an image is loaded or not, and maybe cause problems when user clicks next next next before those have loaded. to get it like lightbox, would also need to add a loading gif..
i wonder if it would be easier to work backwards from lightbox than forwards from galleria. ie take lightbox and modify it to be in the page but with same features...

Tuesday, September 15, 2009

Another reason to not use flash for ANYTHING except animation

PARAGRAPH SPACING: Essential for typography. Unless you just want you letters to fly around, but if you want you letters to actually be read, you'll want to lay them out with good typography, which requires control over things like the space after a paragraph.

I cant find it anywhere in Flash CS3, maybe its in CS4. Not anywhere is the textformat coding options, oh and dont bother linking to an external CSS file so you get get 'margin-bottom:5px' on yours if you even have them, that isn't supported ethier. MADNESS. Flash seems so light on supporting the most basic and common things people would need to do, and especially designers would need to do. Actually it has improved alot with the aliasing, and its still great for having custom fonts and so on... but... it keeps getting me into a tangle over things that should be easy and standard.

Over an hour trying to find a way to do it, here is a hack that will work great if you are bringing in external text HTML or XML, you make the break space a separate paragraph, and format that paragraph class a small font size, eg4px, or whatever space your after.

The problem is, I want this space on a form field input text, so it would have to have a script that says when user enters carriage return, convert it to a new tag, with class 'paragraphspacing'. I'm not familiar with form fields and how to process and convert their input text on the fly, if that is possible even, because it has to happen as they are typing, not after or before. Or maybe there is a way to say "all carriage returns are new

tags with special class applied... but there was some conflict or reason with the text formatting I'm using that couldn't have a CSS file formatting available, something about the fields and focussing. Or some actioscript that says when user press return, insert invisible PNG 5px high.... anyway, over it.

AND weird bugs in text and images via external HTML file dynamic text boxes (Flash CS3-AS2-OSX 10.4.11 FP 8 or 9 (SAFP8 for making a projector on the mac) Building for a CD-ROM, so not browser specific solutions.

(Using dynamic text fields, in 'properties' panel, it's set to multiline, left justified, HTML enabled, embed font with embed button and uppercase, lowercase, punctuation and basic latin, hyperlinks styled via external css file, text and some images come in via HTML external text file. And each text field on the stage has a bold and italic character typed into it.)

FLASH TEXT WRAPPING BUGS: In this project I wanted text never to wrap around images, but start on new lines under each image. Even when I made the image the exact width of the text field, I found images that were linked to in html text pages had to have this hack around them, to stop text wrapping down the side of the image and strange things like that. Its also important to set the hspace and vspace to what you want because it defaults to 3px or something.

Google textformat leading img it if your having text wrapping problems, actually I tried to find my original ref and couldn't so heres the solution. I cant type code on this blog havn't set it up yet, ob means open bracket and cb means close bracket eg. obpcb is a p tag

(adjust this code before using and delete unnessessary blank spaces of course).

obpcb obtextformat leading="197"cb obimg src="yourimgurl" width="400" height="197" hspace="0" vspace="0" /cb ob/textformatcb ob/pcb

basically, use textformat leading to give the image paragraph a height (same height as your image), and this stops the weird text wrapping down the side of the image one letter per line. UPDATE: I read somewhere that it might have something to do with the images being resized by the textfield, although you don't want them to be. They shrink slightly. I might have had something to do with the hspace and vspace not being set, they default to something like 3px. Not sure though because a letter is certainly alot wider than 3px. Anyway the above fixes the problem well enough for me not to want to know any more.

ASSOCIATED VOODOO: If when you roll over a hyperlink in a dynamic text field with external HTML file content containing images and text, and the text jumps, picture disappears, text wraps one letter per line down the side of the text field or something weird happens, you need to go into your HTML source file, and add SOMETHING after your image link.

Make sure the image link is not the last thing in the source. I simply (in code view in dreamweaver) put my cursor after the last p tag which wraps around the image link, and press return, so the cursor is now on a new blank line. THAT FIXES THE BUGGYNESS. What it does is add an invisible carriage return after it which fixes the problem. (NOTE: this means you have to be extra careful when updating your files not to forget and just haphazardly delete blank lines thinking your cleaning up the code. Perhaps you could add a html comment for future authors and yourself in there to say 'dont delete this line flash needs it) but, i don't want to test if comments cause more problems so ill not do this now). This may even apply to text content without images I cant remember, but try adding a blank character to the end of your HTML source anything is jumping around in your SWF.

IMAGE HEIGHT BUG: Another bug - i cant remember the symptoms now exactly, but in this project the images strictly could not be over 241px high, or they triggered a bug. (Probably jumping around when moused over or disappearing or weird rendering artifacts or text wrapping problems or something.) This bug really limits the use of images via external HTML in your project. If your having trouble with images via HTML dynamic text boxes in Flash CS3, try making the images have a small height, see if this fixes the problem. Use in combination with above fixes.

Yes I narrowed this down the hard way, one pixel at a time to find the 'magic number' of 241px high. Although, this magic number may in some way be related to the proportions elsewhere in my project, such as stage height, or text field height or something, so if the number dosn't work for you jut test with a very small image height to begin with.

ALSO HELPFUL FOR TEXT FIELD JUMPING WHEN TEXT SELECTED BY USER: Another 'buggy' thing I noticed was that the dynamic text field was set to 'selectable', so that when the users mouse is over the text box, the mouse icon changes into a... that bar thingy that you use when typing... anyway, to a user it indicates either you can type, or you can select and copy paste the text. I didn't need this functionality. Also I found it did a buggy thing when there is a extra blank line in your HTML text file (which there was to correct other bugs above) OR your text file dosn't quite fit all its content in the available vertical space of the text field (but it looks like it does visually there is no text missing) when the user selects the text, and drags down to highlight it right to the end of the text field's content, the text field 'jumps' or 'scrolls up' (it is NOT a scrollable text field!) to select the out of sight extra blank line or extra content. This makes my heading at the top of the text field 'scroll' out of sight, not pretty. This problem could be solved by making the text field bigger, but design constraints made this not possible (fixed height design). And I wasn't about to go into adding a scrollable text field with that ugly scrollbar and more unknown bugs to squash.

So the solution for this weird behaviour that looks like a bug is to make your text field 'not selectable'. You can do it either in actionscript if you create your text field that way, or from the 'properties panel' if your text field are made on the stage. Select your text field on the stage and click to toggle on off 'selectable' button, it's the square button, with and Ab on it where the b is highlighted in black.

With these solutions your dynamic text fields with images and text from a external HTML file should not have anymore jumpyness! (note not tested on PC/Win as yet)

My conclusion is that dynamic text fields with HTML images are very buggy in CS3 and best avoided. I had far less problems with just text no images... Maybe its all fixed in CS4 (have fun with the new bones tool...) or CS5... I don't care Flash is not my friend anymore.

HTML AND JQUERY FOREVER.