Richard 10-23-2004, 09:29 PM $piconeloc = "blah.jpg";
$piconew = "250";
$piconeh = "150";
$piconealt = "blah blah";
$desc = str_replace("*picone*", "<img src=\"/images/$piconeloc\" width=\"$piconew\" height=\"$piconeh\" alt=\"$piconealt\" align=\"right\" border=\"0\">", "$desc");
echo "$desc";
This just echoes:
<img src="/images/" width="" height="" alt="" align="right" border="0">
Why isn't it including the info in the $'s? They definately exist.
Try:
$piconeloc = 'blah.jpg';
$piconew = '250';
$piconeh = '150';
$piconealt = 'blah blah';
$desc = str_replace('*picone*', '<img src="/images/' . $piconeloc . '" width="' . $piconew . '" height="' . $piconeh . '" alt="' . $piconealt .'" align="right" border="0" />', $desc);
Spookster 10-24-2004, 12:02 AM Try reading our POSTING GUIDELINES (http://www.codingforums.com/postguide.htm) sometime
Richard 10-24-2004, 03:15 PM Well how about being sa bit more constructive and try to suggest a subject title that could have been used? I can't think of one.
Do you not take into account the fact that some people are not that good at asking questions or thinking up complicated subject titles?
marek_mar 10-24-2004, 04:19 PM If we would take that into account you will have to take in account that you will get now anwser.
You are the one that want's something not us.
Spookster 10-24-2004, 06:37 PM Well how about being sa bit more constructive and try to suggest a subject title that could have been used? I can't think of one.
Do you not take into account the fact that some people are not that good at asking questions or thinking up complicated subject titles?
Complicated?
Subject: PHP echo problems
That didn't seem too complicated to me.
trib4lmaniac 10-24-2004, 11:52 PM But... did it fix it? I take it it did, 'cos you don't seem too bothered about it anymore.
Richard 10-25-2004, 12:04 AM But... did it fix it? I take it it did, 'cos you don't seem too bothered about it anymore.
Yes thank you it's fine now.
btw spookster it was a str_replace problem, and it is a php forum so no need to put php in the subject eh ;) :P
Spookster 10-25-2004, 12:18 AM Yes thank you it's fine now.
btw spookster it was a str_replace problem, and it is a php forum so no need to put php in the subject eh ;) :P
The easiest way to come up with a proper subject is to type in your question or code and then look through that for keywords or code statements. "Problem with str_replace" or "str_replace not working" would have been just fine as a subject line. The more specific the better. The reason we stress proper subject lines is because when people use our search feature and come up with a list of 50 results they will want to be able to sift through the subject lines of the results without having to open each and every thread to see if the thread is related to their problem.
trib4lmaniac 10-25-2004, 01:30 PM I would have called it "str_replace not replacing" or something similar :D
i would have called it:
"embedded values not showing in doublequoted string used in str_replace()"
trib4lmaniac 10-25-2004, 04:14 PM i would have called it:
"embedded values not showing in doublequoted string used in str_replace()"
Right... bit long winded for me. Each to there own though :p
i already trimmed it down from
"terrible codingproblem with embedded variables' values that are not showing in doublequoted string that serves as the replacevalue in the str_replace() function i am using, is giving me a headache" :eek:
trib4lmaniac 10-26-2004, 12:14 AM i already trimmed it down from
"terrible codingproblem with embedded variables' values that are not showing in doublequoted string that serves as the replacevalue in the str_replace() function i am using, is giving me a headache" :eek:
:eek:
jkrolen 11-08-2004, 07:31 PM bad-juju
chilipie 11-08-2004, 07:39 PM You cheeky little b****** jkrolen :mad: !
marek_mar 11-08-2004, 07:45 PM It's all about what you like to do. You can spend 20 minutes on inventing a fancy and understandable title or you can spend that time on going to php.net and finding it out.
The best solution to it would be to stop coding in the 'wrong' style
$desc = str_replace("*picone*", "<img src=\"/images/$piconeloc\" width=\"$piconew\" height=\"$piconeh\" alt=\"$piconealt\" align=\"right\" border=\"0\">", "$desc");
and start coding in the 'right' style
$desc = str_replace('*picone*', '<img src="/images/' . $piconeloc . '" width="' . $piconew . '" height="' . $piconeh . '" alt="' . $piconealt .'" align="right" border="0" />', $desc);
All quotes are parsed differently in PHP so it's good to know when to use what.
jkrolen 11-08-2004, 08:29 PM I need to post appropriate messages on this forum
chilipie 11-08-2004, 08:34 PM <tone="sarcastic">I think you're gonna be real popular around here mate.</tone>
jkrolen,
i already gave the right sollution before anyone else posted, so why shouldn't spookster just do his job and ask to use an appropriate title. he was even so kind to explain why it is important.
i'm glad there are people like him around so they can keep the forum clean.
marek_mar 11-08-2004, 09:31 PM ...and ban individuals like jkrolen.
Spookster 11-08-2004, 09:48 PM This thread is now closed. jkrolen will be dealt with for his blatant violations of our forum rules.
|