Jump to content

Simple question. Image on PHP


w1ww

Recommended Posts

Hello I've this:

[code]$content = '<p><img src="teste.jpg" alt="" style="float: left; margin: 0px 6px 3px 0px;" class="borderimage" />Lorem ipsum dolorsit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio.</p>';[/code]

The image its not showing up, why? :s

Oh another question, am I able to include pages inside the $content ?

Thank you!
Link to comment
Share on other sites

[code]<?php
function stringForJavascript($in_string) {
  $str = ereg_replace("[\r\n]", " \\n\\\n", $in_string);
  $str = ereg_replace('"', '\\"', $str);
  Return $str;
}
switch($_GET['id']) {
case 'tab1':
$content = '<p><img src="teste.jpg" alt="" style="float: left; margin: 0px 6px 3px 0px;" class="borderimage" />Lorem ipsum dolorsit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio.</p>';
break;
case 'tab2':
$content = 'Outra Aqui.';
break;
case 'tab3':
$content = 'Mais uma aqui.';
break;
case 'tab4':
$content = 'LAalalla.';
break;
default:
$content = 'There was an error.';
break;

}
print stringForJavascript($content);
usleep(400000);
?>[/code]

This is an ajax script, everything works, but the image just doesnt show up!

Can I include pages at the $content var ? If yes, can you tell how do it?

Thank you
Link to comment
Share on other sites

So ok, including the file the image is printed buut, somehow, a '1' is printed after the text .. :\ I arealy checked the code and the one just appears if I include files.

[code]<?php
function stringForJavascript($in_string) {
  $str = ereg_replace("[\r\n]", " \\n\\\n", $in_string);
  $str = ereg_replace('"', '\\"', $str);
  Return $str;
}
switch($_GET['id']) {
case 'tab1':
$content = include "lol.php";
break;
case 'tab2':
$content = include "2.php";
break;
case 'tab3':
$content = 'Mais uma aqui.';
break;
case 'tab4':
$content = 'LAalalla.';
break;
default:
$content = 'There was an error.';
break;

}
print stringForJavascript($content);
usleep(400000);
?>[/code]

--------
Code for lol.php

[code]<p><img src="teste.jpg" alt="" style="float: left; margin: 0px 6px 3px 0px;" class="borderimage" />Lorem ipsum dolorsit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio.</p>[/code]
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.