I'm new to Joomla! and I was asked to create some modules, I have succesfully created and installed about a dozen by following the documentation here (https://docs.joomla.org/J3.x:Creating_a_simple_module) but looking at the files on the server I noticed that all of my files of the modules now have an empty line separating each line of my scripts (CSS, JavaScript, PHP, HTML, XML and so on...)

If the original file appeared to be like this (this is just an example):

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site" method="install">
    <files>
        <filename module="mod_strikes">mod_strikes.php</filename>
        <folder>system</folder>
        <folder>tmpl</folder>
        <folder>style</folder>
        <folder>script</folder>
        <filename>helper.php</filename>
        <filename>index.html</filename>
        <filename>mod_strikes.xml</filename>
    </files>
    <config>
    </config>
</extension>

After the installation it looks like this:

<?xml version="1.0" encoding="utf-8"?>

<extension type="module" version="3.1" client="site" method="install">

    <files>

        <filename module="mod_strikes">mod_strikes.php</filename>

        <folder>system</folder>

        <folder>tmpl</folder>

        <folder>style</folder>

        <filename>helper.php</filename>

        <filename>index.html</filename>

        <filename>mod_strikes.xml</filename>

    </files>

    <config>

    </config>

</extension>

I thought that there could be some setting which may have modified my files during installation but the site manager in my office said that there is nothing which makes such things.

Is there someone else who has experienced such a situation? Mine is not just a curiosity because editing files with separate lines for me is tedious.

  • Is the server O/S linux and ur development box Windows? Could be line ending... but that's def a weird one! – Brian Bolli Mar 22 '16 at 14:44
  • Yes and yes! So which I have to use? \n instead of \r\n in my editor? It is strange to me because if I upload the file to a normal folder (not a Joomla! one) on the same server it results as the original is...I can't understand why other modules (custom and non) are ok – Cliff Burton Mar 22 '16 at 14:49
  • That is a very weird issue. Can I ask what you are using to view the server files? – Brian Bolli Mar 22 '16 at 16:30

At the end of each of your lines of code you have the invisible characters: \r\n.

It seems that the \r characters (carriage returns) are to blame.

Some systems will bind \r\n together and others will "return" on both \r and \n separately.

To fix this in your code, you can leave the \n (newline characters) alone and just do a replace on \r in your editor -- then your spacing will be as desired.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.