Support » Plugins » Best way to copy and paste code?

  • I’ve tried a few plugins recently that when I copied and pasted the code to an editor, then uploaded it to the plugins folder, the header info runs into the real code, basically showing the whole script on the plugin page. Obviously I’m doing something wrong when I paste the code, but I don’t know what it could be. Any insight would be great.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Instead of copying and pasting the code:
    1. Right click on the Link of the Plugin
    2. Go to Save As…
    3. Save the File
    4. Put the saved file in your plugins folder

    That worked, but I’d still like to know what I’m doing wrong when I cut and paste.

    I have never experiences that problem before. Sorry.

    What are you pasting into?

    Make sure that it is a text editor and not a word processor.

    Make sure there are no spaces before the <?php at the very start of the plugin.

    If you right click “File, Save As” or “Save Target As”, the file may save as a PHPS file. You will need to make sure that you rename it PHP.

    And before right clicking and saving a plugin link, make sure it is a link to a phps or text file and not a zip. That can get messy. 😉

    If it is a zip file, unzip it and just copy the plugin file directly to your plugin directory.

    I know to use a bloody text editor, I used two different ones, both Smultron and Taco. Tried two different ways of copying the .txt file, tried unwrapping text, checked for spaces at the beginning and end.
    At least you didn’t just copy and paste a link to the codex this time…

    I think that this kind of response is unnecessary and unhelpful. The answer you were given was more than appropriate to help you and anyone else looking at the question two years from now. How would I personally know your level of expertise?

    We are all volunteers here and it makes it very difficult when honest and sincere help is offered and treated this way.

    And not to get into a pissing contest, but I don’t think your response was neccessary or helpful. My original post clearly uses the term “editor”. At no point, did I say I had a problem “saving as”, or that I didn’t understand the concept. And since I find myself wanting to go off about issues unrelated to this thread, I will leave it at that.

    1. Did you save the file as .php and not .txt? (probably)

    2. did you save as plain text?

    3. did/can you save/upload as ASCII? and use LF instead of CRLF or CR?

    #3 was it. In the preferences for Smultron (and I assume somewhere in Taco) there was the option for line endings and to use LF instead of CR. I had changed it in cyberduck, didn’t think about it in Smultron.


Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Best way to copy and paste code?’ is closed to new replies.