w1ww Posted December 30, 2006 Share Posted December 30, 2006 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? :sOh another question, am I able to include pages inside the $content ? Thank you! Link to comment https://forums.phpfreaks.com/topic/32308-simple-question-image-on-php/ Share on other sites More sharing options...
michaellunsford Posted December 30, 2006 Share Posted December 30, 2006 Your example code sets a variable called $content. Does it also echo or print the variable? Link to comment https://forums.phpfreaks.com/topic/32308-simple-question-image-on-php/#findComment-149981 Share on other sites More sharing options...
w1ww Posted December 30, 2006 Author Share Posted December 30, 2006 yes:[code]print stringForJavascript($content);[/code] Link to comment https://forums.phpfreaks.com/topic/32308-simple-question-image-on-php/#findComment-149998 Share on other sites More sharing options...
michaellunsford Posted December 30, 2006 Share Posted December 30, 2006 the funciton stringForJavascript() isn't a php function. If it's a custom function, I'd also need to see what it does before I can say why the image isn't showing. Link to comment https://forums.phpfreaks.com/topic/32308-simple-question-image-on-php/#findComment-150025 Share on other sites More sharing options...
w1ww Posted December 30, 2006 Author Share Posted December 30, 2006 [code]<?phpfunction 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 https://forums.phpfreaks.com/topic/32308-simple-question-image-on-php/#findComment-150026 Share on other sites More sharing options...
michaellunsford Posted December 30, 2006 Share Posted December 30, 2006 include "filename.php";http://us2.php.net/include/ Link to comment https://forums.phpfreaks.com/topic/32308-simple-question-image-on-php/#findComment-150027 Share on other sites More sharing options...
w1ww Posted December 30, 2006 Author Share Posted December 30, 2006 I wasn't sure about it, thank you! About the image nothing? Many thanks Link to comment https://forums.phpfreaks.com/topic/32308-simple-question-image-on-php/#findComment-150029 Share on other sites More sharing options...
w1ww Posted December 30, 2006 Author Share Posted December 30, 2006 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]<?phpfunction 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 https://forums.phpfreaks.com/topic/32308-simple-question-image-on-php/#findComment-150037 Share on other sites More sharing options...
w1ww Posted December 30, 2006 Author Share Posted December 30, 2006 Fixed it.. Link to comment https://forums.phpfreaks.com/topic/32308-simple-question-image-on-php/#findComment-150086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.