Closed neekfenwick closed 1 year ago
Can you use a 1.5.8 style language file in this case? Move your define out of
includes/modules/pages/custom_page/header_php.php
to
includes/languages/english/lang.custom_page.php
and make it an array entry, in the style of new language file settings, per
Sorry for the late reply, been very busy. Tried your suggestion but for some reason lang.custom_page.php wasn't loaded at all. I'll try to spend more time on it but doing live site rollout today so likely next week.
I have never done what you're doing or seen it done - this could be a bug or a weakness in the documentation. Please let me know what you find or (better) submit a PR if required.
Describe the bug includes/modules/meta_tags.php allows you to define a constant named after your custom page, which is used to define META_TAG_TITLE, but later again defines META_TAG_TITLE, causing a duplicate definition Warning to be generated.
Version Zen Cart version: 1.5.8 PHP version: 8.1 MySQL version: n/a Plugins that may be related: n/a What older/newer versions were also tested? n/a
To Reproduce Steps to reproduce/demonstrate the behavior:
define('META_TAG_TITLE_CUSTOM_PAGE', 'This is a custom meta title tag');
PHP Warning: Constant META_TAG_TITLE already defined in /home/neek/workspace/zen-cart/zencart/includes/modules/meta_tags.php on line 344.
Expected behavior Constants should not be defined twice.
Screenshots
Additional context I'm not sure how many people create custom pages with custom meta tags like this.
meta_tags.php line 40 sets META_TAG_TITLE:
if (defined('META_TAG_TITLE_' . strtoupper($metatag_page_name))) define('META_TAG_TITLE', constant('META_TAG_TITLE_' . strtoupper($metatag_page_name)));
then thedefault
case in the switch, hit because this is a custom page not matched by the other case blocks, sets it again on line 344:define('META_TAG_TITLE', (defined('NAVBAR_TITLE') ? NAVBAR_TITLE . PRIMARY_SECTION : '') . TITLE . TAGLINE);
Maybe just guard those lines around 344 with
defined()
checks?