I want to create an event calendar but I got this message below after I execute the code below.
Parse error:syntax error,unexpected 'echo'(T_ECHO)
the error is on this line
return '<li id="li-'.$this->currentDate;?> <?php '"class=btn btn-info btn-lg data-toggle="modal" data-target="#myModal""'.($cellNumber%7==1?' start ':($cellNumber%7==0?' end ':' ')).
($cellContent==null?'mask':'').'">'.$cellContent.'</li>'
I'm trying to find the solution, but failed. so, i really hope that someone can help me. thank you...
Try this,
return '<li id="li-'.$this->currentDate;?> <?php echo "class=btn btn-info btn-lg data-toggle='modal' data-target='#myModal'".($cellNumber%7==1?' start ':($cellNumber%7==0?' end ':' ')).
($cellContent==null?'mask':'').'">'.$cellContent.'</li>'
I think the problem is here,
<?php '"class=btn btn-info btn-lg data-toggle="modal" data-target="#myModal""'.($cellNumber%7==1?' start ':($cellNumber%7==0?' end ':' '))
HTML part is not getting echoed correctly.
Related
I'm trying to make hard-coded text translatable in WordPress theme.
This is the code:
<a class="btn advanced-search-btn btn-full-width" data-toggle="collapse" href="#advanced-search-filters">
<i class="houzez-icon icon-cog mr-1"></i> <?php echo houzez_option ('srh_btn_adv', 'Advanced');?>
</a>
And this is what I have tried:
<a class="btn advanced-search-btn btn-full-width" data-toggle="collapse" href="#advanced-search-filters">
<i class="houzez-icon icon-cog mr-1"></i> <?php _e houzez_option ('srh_btn_adv', 'Advanced', 'wpml_theme');?>
</a>
It gave me an error:Syntax error, unexpected T_String
I have tried to replace _e with __e and also tried esc_html__ but it give me the same error!
What I'm doing wrong?
Replace
<?php echo houzez_option ('srh_btn_adv', 'Advanced');?>
with
<?php _e(houzez_option ('srh_btn_adv', 'Advanced'));?>
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 2 years ago.
Hi tried editing code and i am trying to add an IF condition into the bit of php code /button. I got error "Parse error: syntax error, unexpected '<'" for button open tag line , what am i doing wrong?
<?php
if( wc_memberships_is_user_member( null, 3171 ) ) {
<button type="button" class="btn btn-secondary btn-sm" id="addNewFAQS"><span class="plus-sign">+</span>
} ?>
<?php esc_html_e('Add New', 'direo-extension'); ?>
</button>
Ended up using below thanks to help from #user3783243
if( wc_memberships_is_user_member( null, 3171 ) ) {
Echo "<html>";
Echo
'<button type="button" class="btn btn-secondary btn-sm" id="addNewFAQS"><span class="plus-sign">+</span></button>';
esc_html_e('Add New', 'direo-extension');
} ?>
You cannot insert HTML code into php for this you should echo it.
<?php
if( wc_memberships_is_user_member( null, 3171 ) ) {
echo '<button type="button" class="btn btn-secondary btn-sm" id="addNewFAQS"><span class="plus-sign">+</span>';
} ?>
I am make a variable to show the display:none; in the php echo code. But my code function cannot work when I've clicked the Delete button. I think this code is errored to put variable style='.$show_display.', maybe the syntax error. Hope anyone can point out which part I am getting error in the code.
if ($is_delete == "1"){
$show_display = "";
}
if ($is_delete == "0"){
$show_display = "display:none;";
}
echo '<a style='.$show_display.' onclick="delete_folder(\'' . md5($rs_wtp['id'].$md5) . '\',1)" class="btn btn-sm btn-primary" data-color-format="hex">Delete</a>';
I've tried to console the error. The error show me like below the picture:
Issue here is with the missing quotes for style attribute. So the echo statement would look like below:
echo '<a style="'.$show_display.'" onclick="delete_folder(\'' . md5($rs_wtp['id'].$md5) . '\',1)" class="btn btn-sm btn-primary" data-color-format="hex">Delete</a>';
I'm trying to echo a link on a page. It should be a bootstrap button, but it's just coming out as plain text.
This is my code. What am I doing wrong?
echo '<a class="btn btn-info" href='.$url.'>Video Link</a>';
Try this. I have checked it in my localhost and it is working perfectly.
$url = 'https://www.facebook.com/';
echo '<a class="btn btn-info" href='.$url.'>Video Link</a>';
Please let me know if you have any further questions or any problem occurs.
You should wrap the string you are contencating in double quotes, like this
echo '<a class="btn btn-info" href="'.$url.'">Video Link</a>';
href need to be wrapped up with href=""
try -----> href="'.$url.'"
Change this:
echo '<a class="btn btn-info" href='.$url.'>Video Link</a>';
To this:
echo '<a class="btn btn-info" href="'.$url.'">Video Link</a>';
You should not use single quotes inside single quotes so you have to change your code to something like this
echo '<a class="btn btn-info" href="'.$url.'">Video Link</a>';
<?php
$id=16;
echo '<td><a class="btn btn-primary" href="edit_news.php?id=$id"><i class="fa fa-pencil fa-fw"></i> Edit</a></td>';
?>
I have a search program that performs search via ajaX,whwre i need to embed html tag with php. Search works fine but when i click on edit button the id cant pass on another page. It shows thathttp://localhost/web/edit_news.php?id=$id. But i cant get the id=16. And error shows Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\web\edit_news.php on line 9. what is the error in my code?
Can any one help me to solve this?
you have change "edit_news.php?id=$id" to "edit_news.php?id='.$id.'". Because data in double quotes treated it like string. or you can use single quotes '. like href='edit_news.php?id=$id'.
<?php
$id=16;
echo '<td><a class="btn btn-primary" href="edit_news.php?id='.$id.'"><i class="fa fa-pencil fa-fw"></i> Edit</a></td>';
?>
just change it quote like ' to " and " to '
<?php
$id=16;
echo "<td><a class='btn btn-primary' href='edit_news.php?id=$id'><i class='fa fa-pencil fa-fw'></i> Edit</a></td>";
?>
OR
<?php
$id=16;
echo '<td><a class="btn btn-primary" href="edit_news.php?id='.$id.'"><i class="fa fa-pencil fa-fw"></i> Edit</a></td>';
?>
Change the single quote with double and double with single Like this :
<?php
$id=16;
echo "<td><a class='btn btn-primary' href='edit_news.php?id=$id'><i class='fa fa-pencil fa-fw'></i> Edit</a></td>";
?>