Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

conventions in language files


cupidare

Recommended Posts

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

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

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

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

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 :thumbsup: 

Needs loads more shopowner to be supportive, like you - thank you!

Link to comment
Share on other sites

@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

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

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

@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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...