Hi can anyone tell me what's wrong with this?

Thx in advance.

$meta_tags = '<meta name="keywords" content="' .$meta_keywords' . ">
<meta name="description" content="' .$meta_keywords . '">';

Its throwing the following error:

PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Recommended Answers

All 5 Replies

Try this

meta_tags = "<meta name="keywords" content="".$meta_keywords."">
<meta name="description" content="".$meta_keywords."">";

Look at this again:

content="' .$meta_keywords' . ">

You should see the error.

kk29 is right, it's just a question of getting those devilish quotes in the right place.

By the way, the line break between tags won't appear as a line break in the served html. For that you need to embed "\n" (note the double quotes).

For multi-line output, this is a useful technique:

$outputStr = array();
........
........
$outputStr[] = '<meta name="keywords" content="' . $meta_keywords . '">';
$outputStr[] = '<meta name="description" content="' .$meta_keywords . '">';
........
........
$outputStr[] = 'whatever';
$outputStr[] = 'whatever';
........
........
print implode("\n", $outputStr);

Airshow

Ah!!!! blooming single quote out of place !!!

My bad :)

Thx for the help AIRSHOW and kk2929 - sometimes can't see for looking

sometimes can't see for looking

We've all been there.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.