Jump to content

PHP echo strange behavior


flaab

Recommended Posts

Hi,

 

I have a really strange problem in a production server and  I don't know what it is. I'm going nuts.

 

I'm programming a HTML newsletter that is saved into he hard drive and sent by mail. So, the HTML code must be created dinamically.

 

Take a look at the following (simplified) code. Basically, it grabs an array of strings and displays an image for each one of them.

 

 
// Iteramos parrafos poniendo fotos si tenemos
for($it = 0; $it < count($parrafos); $it++)
{
     // El parrafo debe ser mas alrgo que 3 caracteres
     if(strlen($parrafos[$it]) > 2)
     {
           // Si tenemos foto para este parrafo
           if(isset($imagenes[$image_it]))
           {
                 $cuerpo_final .= '<img width="80" src="http://www.ecoturismorural.com';
                 $cuerpo_final .= $imagenes[$image_it];
                 $cuerpo_final .= '" />';
                 $image_it++;
            }
                        
             // Ponemos parrafo
             $cuerpo_final .= "\n<p>". $parrafos[$it] ."</p>\n";
     }
}

 

The created string is not modified at any time before being printed on the screen. And the local output is the following:

 

<img width="80" src="http://www.ecoturismorural.com/img/Parrafos/File/IMG_0161.JPG" />
<p>Durante la semana del 26 al 30 de Mayo un grupo ... (more text)</p>

<img width="80" src="http://www.ecoturismorural.com/img/Parrafos/File/IMG_0166.JPG" />
<p>El programa "Galicia Natural" tiene como objetivo ... (more text)</p>

 

That will be the correct output.

 

The problem is...the same script executed on the production machine outputs other thing completely!

 

- Domain names are removed from all URLS

- Characters < > and " are trasnslated into html entities

- Image outputs are surrounded by <p> and </p>

 

All these all by its own! :s

 

<p><img src="img/Establecimientos_Mini/4385La%20Monta%F1eta%201.JPG"></p>
<p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed lorem ... (more text)</p>

<p><img src="img/Establecimientos_Mini/64266.jpg"></p>
<p>Class aptent taciti sociosqu ad litora torquent per ... (more text)</p>

 

And it's just he same echo(). I would really appreciate any help!

 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.