cupidare Posted July 30, 2019 Share Posted July 30, 2019 OSCOM CE Phoenix & other I am a little bit confused regarding the language files: - in some there is "const" in some "define" - some include a closing "?>" tag - some don't Is there any mechanism according to which one could bring a little order to it? Thanks in advance Link to comment Share on other sites More sharing options...
burt Posted July 30, 2019 Share Posted July 30, 2019 No ending ?> You can use const or define, whatever you find easier. Link to comment Share on other sites More sharing options...
Denkster Posted July 30, 2019 Share Posted July 30, 2019 Apparently, today's php interpreters do not really care about the ending tag ?> I suppose each file that includes any amount of <?php opening tags must have an equal amount of ?> Ending tags Numerous files in Phoenix do niet comply to that rule, are missing the ?> Link to comment Share on other sites More sharing options...
burt Posted July 30, 2019 Share Posted July 30, 2019 Just now, Denkster said: Apparently, today's php interpreters do not really care about the ending tag ?> I suppose each file that includes any amount of <?php opening tags must have an equal amount of ?> Ending tags Numerous files in Phoenix do niet comply to that rule, are missing the ?> No. There should be no ending ?> in pure php files. Link to comment Share on other sites More sharing options...
burt Posted July 30, 2019 Share Posted July 30, 2019 And, a little discussion from a while back; Link to comment Share on other sites More sharing options...
Denkster Posted July 30, 2019 Share Posted July 30, 2019 33 minutes ago, burt said: No. There should be no ending ?> in pure php files. Interesting, thank You, Burt! Still, that accepting as The Thruth, numerous files do not comply, I think.. Link to comment Share on other sites More sharing options...
burt Posted July 30, 2019 Share Posted July 30, 2019 1 minute ago, Denkster said: Still, that accepting as The Thruth, numerous files do not comply, I think.. That's correct. There is *loads* of work still to do Needs loads more shopowner to be supportive, like you - thank you! Link to comment Share on other sites More sharing options...
ArtcoInc Posted July 30, 2019 Share Posted July 30, 2019 @burt You and I had a conversation via email just over a year ago. I shared with you that while define() allows string additions using dots, const does not. Remember? M Link to comment Share on other sites More sharing options...
cupidare Posted July 31, 2019 Author Share Posted July 31, 2019 @burt Thank you for pointing this out again. According to https://www.php.net/manual/en/language.basic-syntax.phptags.php it is preferable to omit the closing tag in all files containing only php code. Does it mean, that we should omit all ?> on all ends of the pages here? This wouldn't affect the languages files only... Do I understand correctly that the reason is to avoid unwanted character addition to the output and any accidently added char would trigger an error (which informs one, that there are unwanted chars)? Personally I would prefer const over define in language definitions for readability (we don't need conditions there) Link to comment Share on other sites More sharing options...
burt Posted July 31, 2019 Share Posted July 31, 2019 1 hour ago, cupidare said: According to https://www.php.net/manual/en/language.basic-syntax.phptags.php it is preferable to omit the closing tag in all files containing only php code. Does it mean, that we should omit all ?> on all ends of the pages here? This wouldn't affect the languages files only... Modules too. eg box modules, content modules and so on. eg https://github.com/gburton/Responsive-osCommerce/blob/master/includes/modules/content/navigation/cm_navbar.php#L118 - no ending ?> Link to comment Share on other sites More sharing options...
burt Posted July 31, 2019 Share Posted July 31, 2019 15 hours ago, ArtcoInc said: @burt You and I had a conversation via email just over a year ago. I shared with you that while define() allows string additions using dots, const does not. Remember? M I vaguely remember that... I did just try this and it worked OK...did we struggle with something different? const CONCAT_STRING = '<p>%2$s had a little %1$s.</p><p>test' . "1234</p><hr>"; echo sprintf(CONCAT_STRING, 'lamb', 'mary'); Link to comment Share on other sites More sharing options...
ArtcoInc Posted July 31, 2019 Share Posted July 31, 2019 @burt You and I were discussing one of your 28-day modules. In it, you had this in the language file: const NOTIFICATIONS_EMAIL_TEXT = 'Be quick, our %3$s is back in stock!' . "\n\n" . 'Hi %1$s, this is a courtesy email from us at %5$s to let you know that our product that you wanted to be notified about is back in stock!' . "\n\n" . 'Thank You, your friends at %5$s' . "\n\n" . 'You signed up to be notified about this product on %4$s...'; We had a problem with: ' . "\n\n" . ' Const didn't like it. Define() didn't have a problem. M Link to comment Share on other sites More sharing options...
burt Posted July 31, 2019 Share Posted July 31, 2019 OK, define is good if const is more difficult to work with. Whatever the end user prefers. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.