Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012
    Location
    Norwich, Norfolk
    Posts
    5
    Plugin Contributions
    0

    Default What is the correct way to reference language file?

    In the new pages I am creating what is the proper way and place to reference the appropriate language file?

    At the moment I have

    PHP Code:
    include(DIR_WS_LANGUAGES '/english/products_all.php'); 
    in the template file (/includes/templates/template_default/templates/tpl_product_credential_default.php)

    I'm sure this isn't correct as "english" shouldn't be hardcoded in like this.

    Regards,

    Chris V

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Correct way to reference language file

    Quote Originally Posted by venablc View Post
    In the new pages I am creating what is the proper way and place to reference the appropriate language file?

    At the moment I have

    PHP Code:
    include(DIR_WS_LANGUAGES '/english/products_all.php'); 
    in the template file (/includes/templates/template_default/templates/tpl_product_credential_default.php)

    I'm sure this isn't correct as "english" shouldn't be hardcoded in like this.

    Regards,

    Chris V
    Try this: (untested)
    PHP Code:
    $template =  $GLOBALS['template_dir'];
    include(
    DIR_WS_LANGUAGES $template.'/products_all.php'); 
    Cheers
    Rod

  3. #3
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,268
    Plugin Contributions
    3

    Default Re: Correct way to reference language file

    /includes/templates/template_default/templates/tpl_product_credential_default.php

    Not a core ZC file, so

    1. What's it doing in /template_default/?
    2. Who put it there?
    3. What is its purpose?
    20 years a Zencart User

  4. #4
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Correct way to reference language file

    Your business logic should be in the /includes/modules/pages/PAGE_NAME_HERE/header_php.php file.
    And that's where the language files are loaded.

    See the About Us addon for an example of adding your own custom page as you seem to be trying to do.
    (You can skip the html_includes folder content if you're not needing the define-page part of it)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Replies: 0
    Last Post: 19 Nov 2011, 11:04 PM
  2. What is the correct way to display multiple images?
    By keemeng in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 6 Jun 2011, 12:19 AM
  3. Replies: 2
    Last Post: 20 Jun 2008, 10:28 AM
  4. Wishlist code in the language file - what's it for?
    By robax in forum General Questions
    Replies: 2
    Last Post: 8 Apr 2007, 11:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg