Jovanni G
Jovanni G

Reputation: 331

Remove extra whitespace from output CodeIgniter

I am trying to render a dynamically created xml data. Everything is working fine EXCEPT for some reason CodeIgniter adds unnecessary extra whitespace at the beginning of the document. enter image description here

Here's what I have tried so far but with no luck:

  1. just simply loading the view
  2. used simpleXmlElement to render the xml directly inside the controller
  3. just left the controller method empty.

    public function whateverControllerMethod(){ // empty with no code }

Upvotes: 1

Views: 1390

Answers (1)

user14597628
user14597628

Reputation: 11

Check if in the top of models or controllers there is whitespace or lines before of tag php, because sometimes if used the file autoload.php that is in the path application/config and load all models and if there is whitespace or lines before of tag php in the models then the output from the function of controller will be with extra whitespace.

In my case, this was my problem:

Click Here

Upvotes: 1

Related Questions