Skip to:
Content
Pages
Categories
Search
Top
Bottom

Syntax questions


  • wittmania
    Member

    @wittmania

    A couple of questions about what syntax to use, especially on template pages:

    1. I see that a lot of people use _e('string...') instead of echo('string...'). Is this just a bbpress/wordpress thing or is this generally acceptable php coding?

    2. In front-page.php of kakumei (and many other places), I see people using this shorthand echo where normal text would work just fine. For instance, in the hottags div, it is:

    <h2><?php _e('Hot Tags'): ?></h2>

    Why would you have PHP echo that when you could just have it as plain ol’ text in the first place? Am I missing something?

    I realize neither of these is of any earth-shaking importance, but I would like to know so I can keep my code modifications in line with the default syntax that is used throughout. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

  • fel64
    Member

    @fel64

    My assumption is that they’re in place for localisation purposes. I don’t know for sure.


    lonemadmax
    Member

    @lonemadmax

    fel64′s assumption is correct. You can see the definition of _e() and __() in bb-includes/l10n.php:

    // Return a translated string.

    function __($text, $domain = 'default') {

    // Echo a translated string.

    function _e($text, $domain = 'default') {


    wittmania
    Member

    @wittmania

    So, if I have a Japanese installation (for example), it would translate “Hot Tags” into its Japanese equivalent?

    That makes sense. Thanks for the info.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.