PHP Parse error: syntax error, unexpected T_STRING
After my last upload my home page is blank and I am getting the following error message from the report -
PHP Parse error: syntax error, unexpected T_STRING in /home/xxxxxxx/public_html/includes/modules/classic/meta_tags.php on line 48
I cannot see anything missing - can you ?
$keywords_string_metatags .= zen_clean_html($keywords_metatags->fields['categories_name']) . METATAGS_DIVIDER;
$keywords_metatags->MoveNext();
}
define('KEYWORDS', str_replace('"','',zen_clean_html($keywords_string_metatags) . CUSTOM_KEYWORDS));
// if per-page metatags overrides have been defined, use those, otherwise use usual defaults:
if ($current_page_base != 'index') {
if (defined('META_TAG_TITLE_' . strtoupper($current_page_base))) define('META_TAG_TITLE', constant('META_TAG_TITLE_' . strtoupper($current_page_base)));
if (defined('META_TAG_DESCRIPTION_' . strtoupper($current_page_base))) define('META_TAG_DESCRIPTION', constant('META_TAG_DESCRIPTION_' . strtoupper($current_page_base)));
if (defined('META_TAG_KEYWORDS_' . strtoupper($current_page_base))) define('META_TAG_KEYWORDS', constant('META_TAG_KEYWORDS_' . strtoupper($current_page_base)));
}
//// Get different meta tag values depending on main_page values
switch ($_GET['main_page']) {
case ($this_is_home_page == true):
define('META_TAG_TITLE', 'Women's boots sale ShoeShop UK,');
define('META_TAG_DESCRIPTION', 'Find all women's boots sale at shoeshop uk and enjoy a variety of popular styles to complement any ensemble. Choose womens boots on sale in tall, mid length and ankle length to accentuate your wardrobe
thanks for reading
Re: PHP Parse error: syntax error, unexpected T_STRING
Your define statements use single quotes to enclose text, but you also have single quotes inside your text. This causes the code to think the text ends prematurely, and leaves fatal PHP errors dangling.
You need to escape these single quotes with a backslash \ like this \' :
define('META_TAG_TITLE', 'Women\'s boots sale ShoeShop UK,');
define('META_TAG_DESCRIPTION', 'Find all women\'s boots sale at shoeshop uk and enjoy a variety of popular styles to complement any ensemble. Choose womens boots on sale in tall, mid length and ankle length to accentuate your wardrobe
Re: PHP Parse error: syntax error, unexpected T_STRING
Quote:
Originally Posted by
gjh42
Your define statements use single quotes to enclose text, but you also have single quotes inside your text. This causes the code to think the text ends prematurely, and leaves fatal PHP errors dangling.
You need to escape these single quotes with a backslash \ like this \' :
define('META_TAG_TITLE', 'Women\'s boots sale ShoeShop UK,');
define('META_TAG_DESCRIPTION', 'Find all women\'s boots sale at shoeshop uk and enjoy a variety of popular styles to complement any ensemble. Choose womens boots on sale in tall, mid length and ankle length to accentuate your wardrobe
I tried with back slash but it still didnt worek so have taken \' out completely. :dontgetit
Thanks though
Re: PHP Parse error: syntax error, unexpected T_STRING
Okay, I wasn't certain that a single escape layer would work, since the text might be handled more than once on its way to the page. Safest to avoid the problem, though it would be good to know exactly what steps would fully escape those characters, whether a double escape \\\' to leave \' on the first pass and ' in output, or what.