Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Language variable

    Hi,
    I am sorry if I am using the wrong terminology but I hpe byt the examples it will be clear.
    In the file tpl_main_page.php I need to mod this code I have just before the closing </body> in order to change based on language choosen by the user:

    <?php require(DIR_WS_TEMPLATE . 'cookie_control/jscript_cookie_Control-7.0.4.min.php');
    ?>

    I think it should appear like this
    <?php require(SOMETHING_ELSE . '/jscript/cookie_control/jscript_cookie_Control-7.0.4.min.php');
    ?>
    Were SOMETHING_ELSE shall generate /includes/languages/the language chosen/

    Is it possible? If yes could someone suggest me the code to use?
    Thanks

  2. #2
    Join Date
    Jul 2012
    Posts
    16,735
    Plugin Contributions
    17

    Default Re: Language variable

    DIR_WS_LANGUAGES . $_SESSION['language']

    So that will be:
    Code:
    <?php require(DIR_WS_LANGUAGES . $_SESSION['language'] . '/jscript/cookie_control/jscript_cookie_Control-7.0.4.min.php');
    Last edited by mc12345678; 13 Oct 2016 at 09:27 PM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Re: Language variable

    Quote Originally Posted by mc12345678 View Post
    DIR_WS_LANGUAGES . $_SESSION['language']

    So that will be:
    Code:
    <?php require(DIR_WS_LANGUAGES . $_SESSION['language'] . '/jscript/cookie_control/jscript_cookie_Control-7.0.4.min.php');
    Hi, thanks.
    that is what I used, but misteriously it keeps creating the following link.
    <script src="/includes/templates/responsive_classic/cookie_control/jscript_cookieControl-7.0.4.min.js" type="text/javascript"></script>
    I am lost!

  4. #4
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Re: Language variable

    OK. I have done some tests and ended up with this:
    <?php require(DIR_WS_LANGUAGES . $_SESSION['language'] . '/cookie_control/jscript_cookie_Control-7.0.4.min.php');
    ?>
    <?php echo (DIR_WS_LANGUAGES . $_SESSION['language'] . '/cookie_control/jscript_cookie_Control-7.0.4.min.php');
    ?>
    that will give this

    <script src="/includes/templates/responsive_classic/cookie_control/jscript_cookieControl-7.0.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">//<![CDATA[
    cookieControl({
    .........
    </script>
    includes/languages/italian/cookie_control/jscript_cookie_Control-7.0.4.min.php</body>

    It looks like that if the command is require it would ignore DIR_WS_LANGUAGES . $_SESSION['language'] while if the command is echo the DIR_WS_LANGUAGES . $_SESSION['language'] is used.
    Simply out of my knowledge.

    Thanks fo help.
    Ciao
    enzo

  5. #5
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Re: Language variable

    Hold it! I may have found the solution. Let me test and I will let you know.
    Ciao

  6. #6
    Join Date
    Jul 2009
    Posts
    402
    Plugin Contributions
    0

    Default Re: Language variable

    YESSSSSS, The problem was inside the php which was calling the script in a hard coded path. Changed the hard coding in the englsh and italian file and everything went perfect.
    Thanks for your patience.
    ciao from Italy
    enzo

  7. #7
    Join Date
    Jul 2012
    Posts
    16,735
    Plugin Contributions
    17

    Default Re: Language variable

    Welcome... that was where I was going to suggest next. Mind you, placing the javascript in the languages directory like this is a little abnormal for standard ZC setup. Are you sure that you want to try to manage this this way instead of having language constants in the desired directory with the appropriate words pulled to the code instead?

    I say this somewhat from a maintenance perspective because with perhaps the javascript tucked away in two or more language folders, a change to one requires a change to the other.

    Perhaps in the hard coding rewrite you did you already resolved this issue.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v154 Naming a global variable the same as a SESSION, GET or POST variable
    By torvista in forum General Questions
    Replies: 5
    Last Post: 6 Dec 2015, 11:11 AM
  2. Display language variable un URL
    By cactusman in forum General Questions
    Replies: 7
    Last Post: 7 Jul 2010, 11:50 AM
  3. Replies: 8
    Last Post: 10 Jan 2010, 08:04 PM
  4. actual language php variable ?
    By Franck69 in forum General Questions
    Replies: 2
    Last Post: 18 Jun 2008, 05:34 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR