I get this error when I enter data in my form

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in

\functions.php on line 77

return '<span class="vwbx">Views</span>''<span class="vwbx">$count.</span>';

==== Whole function===

function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
    return "0 View";
return $count. '<span class="vwbx">Views</span>''<span class="vwbx">views</span>';

The problem is that you have two strings that aren't actually being appended together.

Try replacing

return $count. '<span class="vwbx">Views</span>''<span class="vwbx">views</span>';


return $count. '<span class="vwbx">Views</span>'.'<span class="vwbx">views</span>';

(note the added period in the centre).

Or instead, remove the two quotation marks from the centre:

return $count. '<span class="vwbx">Views</span><span class="vwbx">views</span>';

That should work :D

EDIT In response to your comment... I think you'll be wanting to replace it with:

return '<span class="vwbx">Views</span><span class="bxarw"></span><span class="CntBx">'.$count.'</span>';
| improve this answer | |
  • thanks Harris working but i need to do this, to get $count value like return '<span class="vwbx">Views</span><span class="bxarw"></span><span class="CntBx">$count.</span>'; – user8503 Jan 18 '12 at 14:23
  • 1
    I've edited my answer :D. By the way, you may want to start accepting answers to your questions - your score is very low and people may decide not to bother answering you. – Stephen Harris Jan 18 '12 at 14:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.