Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i have this simple typo issue here i guess.
How can i resolve it?
<?php the_content("<br /> <span class='custom-more'>Read More: " . get_the_title('', '', false) "</span>"); ?>
I need to make a read more button in WordPress and i need to wrap the read more inside a span class.
I get this error message:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in
How am i supposed to resolve this?
Thanks
You are missing the concatenation operator . between get_the_title function and </span>
<?
php the_content("<br /> <span class='custom-more'>Read More: ".get_the_title('', '', false)."</span>");
?>
You are missing the concatenate (.)
Correct code will be
php the_content("<br /> <span class='custom-more'>Read More: ".get_the_title('', '', false)."</span>");
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
i want to echo a div in PHP, and set the ID equal to the value of $divName, but i cannot get it to work
Here is my code:
$divName = "divText"
echo '<div id=$divName></div>'
Just do it like this:
$divName = "divText";
echo '<div id="'.$divName.'"></div>';
You should read the PHP Documentation. This is really basic stuff.
http://php.net/docs.php
Why you don't add semicolons (;) at the end of each command line?
Change single quotes (') to double quotes (") and that it:
$divName = "divText";
echo "<div id=$divName></div>";
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
function wrap($str) {
$str="[#id=\"".$str."\"]";
return($str);
}
$str="Hi";
$str=wrap($str);
I would have $str like [#id="Hi"], but i have $str like [#id=\"Hi\"]
How could i do that?
$str='[#id="'.$str.'"]';
replace " with '
The code works as expected, no need to change quotes to single ticks or remove the second pair of double quotes.
Probably the backslashes are added later. If you just echo $str; after your snippet it shows this in a browser
[#id="Hi"]
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How can i fix this? i want make this :
$diagnosa=blabla , blabla2 , blabla3 , ;
and then i use foreach but it cannot work,
$nama_diagnosa = Laporan::ViewDataDiagnosa(2,'2015-02-02');
$diagnosa = foreach ($nama_diagnosa as $cellDiagnosa){
echo $cellDiagnosa['nama_diagnosa']." , ";
}
[resolved]
Finally I added temporary variables to hold data for diagnosatemp variable, then I add a diagnosa variable like this
$nama_diagnosa=Laporan::ViewDataDiagnosa($cell['id_pasien'],$cell['tgl_rekam']);
$diagnosa = '';
foreach ($nama_diagnosa as $cellDiagnosa){
$diagnosaTemp=$cellDiagnosa['nama_diagnosa'];
$diagnosa=$diagnosa.",".$diagnosaTemp;
} echo $diagnosa;
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have a variable inside an inline style -
style='color:$custom_color;font-size:$custom_icon_size;'
And am trying to add the letters px directly after the $custom_icon_size. This obviously does not work? Any ideas what is the correct method?
thanks
you need to use {} around your PHP vaariable
style='color:$custom_color;font-size:${custom_icon_size}px;'
Assuming that you're echoing it, you have two options:
echo "style='color:$custom_color;font-size:{$custom_icon_size}px;'";
echo "style='color:" . $custom_color . ";font-size:" . $custom_icon_size . "px;'";
$style = 'color:'.$custom_color.'; font-size: '.$custom_icon_size.'px';
echo 'style="'.$style.'"';
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I put in the tag and inside it is this:
$one = "\Images\";
I correctly closed the tag itself, but everything after it is being considered part of the tag.
Full code:
<div id="skyscraper-ad">
<?php
$one = "\Images\";
?>
</div>
In PHP the \ character is used to escape an immediately following character that could be interpreted as 'not part of the string'.
eg. If you were to run this:
echo '\'hello';
it would output: 'hello.
In your code, you're escaping the ending ' which will make PHP throw an error.
echo '\Images\\'; on the other hand will output \Images\
You need to escape the backslashes:
<div id="skyscraper-ad">
<?php
$one = "\\Images\\";
?>
</div>