Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Adding a stylesheet to a language pack?

Adding a stylesheet to a language pack?

Locked

Views: 1,364

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
1 Sep 2006, 2:03 PM
#1
burbage avatar

burbage

New Zenner

Join Date:
Sep 2006
Posts:
2
Plugin Contributions:
0

Adding a stylesheet to a language pack?

Sorry if someone has covered this, but I did a seach and cannot find the answer.

I have a background image with text in it in the main wrapper. You can see the design here:

http//:www.jim-hill.com/catalog/index.php

Unfortunately, the French Language selection keeps the same image (of course). Can I put a stylesheet into the French section to select a different image? If so, how should I set it up.

All suggestions gratefully accepted. Thanks.

1 Sep 2006, 2:58 PM
#2
brainiack avatar

brainiack

New Zenner

Join Date:
Aug 2006
Posts:
6
Plugin Contributions:
0

Re: Adding a stylesheet to a language pack?

i did the following:

back up first

  1. i opened /includes/functions/html-output
  2. search for the function "function zen_image_button"
  3. after this function (after the closing tag } ) i made a new function with a new name:
//// added by Brainiack
/// outputs an image from includes - templates - MY_TEMPLATE - images - language
// Output a function button in the selected language

  function brainiack_image_button($image, $alt = '', $parameters = '') {
    global $template, $current_page_base;
    return zen_image($template->get_template_dir($image, DIR_WS_TEMPLATE, 'images/' . $_SESSION['language'] . '/') . $image, $alt, '', '', $parameters);
//    return zen_image($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'images/' . $_SESSION['language'] . '/') . $image, $alt, '', '', $parameters);
  }

now on every page where i want i change the call to the standard image function (zen_image_button) from zencart to brainiack_image_button. For example in document_product_info.php or other files.

  1. now you need to create a subfolder under /includes/templates/YOUR_TEMPLATE/images/ with the name of the language. In my case i have dutch added as "nederlands", so i have a subfolder nederlands .

  2. To get things going smoothly and not messing up al kind of image names in differentfolders i made a new file brainiack_image_names.php in every folder of /includes/languages/YOUR_LANGUAGE. This might come in handy when you want to have filenames in french and filenames in english. just add lines of defines like:

define('MORE_INFO', 'button_info.jpg');
define('MORE_INFO_ALT', 'Meer informatie aanvragen');
  1. to make point 5 work you have to add an additional line in filenames.php in includes/ like define('FILENAME_BRAINIACK_IMAGES_NAMES','brainiack_images_names.php');

  2. you also have to alter /includes/languages/YOUR_LANGUAGE.PHP. Add the following code just at the end of the document before the closing ?> tag

//  include template specific brainiack image name defines
  if (file_exists(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $template_dir . '/' . FILENAME_BRAINIACK_IMAGES_NAMES)) {
    $template_dir_select = $template_dir . '/';
  } else {
    $template_dir_select = '';
  }
  require(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $template_dir_select . FILENAME_BRAINIACK_IMAGES_NAMES);
  1. example of calling the function:
<?php echo brainiack_image_button(MORE INFO , MORE INFO_ALT); ?>

MORE_INFO_ALT is the text that will be displayed when the image is missing or when you hoover over this image with the mouse.

if you have any questions post them here. If things get messed up, don't blame me.

1 Sep 2006, 3:03 PM
#3
burbage avatar

burbage

New Zenner

Join Date:
Sep 2006
Posts:
2
Plugin Contributions:
0

Re: Adding a stylesheet to a language pack?

Thanks, i'll give that a try and let you know how I get on.

Cheers.

1 Sep 2006, 3:04 PM
#4
brainiack avatar

brainiack

New Zenner

Join Date:
Aug 2006
Posts:
6
Plugin Contributions:
0

Re: Adding a stylesheet to a language pack?

cheers!

CHEERS

Here it is friday and i gonna have weekend!! :D

2 Sep 2006, 7:13 AM
#5
seethrou avatar

seethrou

Totally Zenned

Join Date:
May 2004
Location:
Hong Kong
Posts:
1,156
Plugin Contributions:
0

Re: Adding a stylesheet to a language pack?

For information, there is a docs in the docs directory of the default Zen Cart installation.
docs/readme_css_system.html

              style*.css // are always loaded and at least ONE should contain site-wide properties.
language_stylesheet.css // changes to ALL pages, when that language is used
          page_name.css // changes to one page
 language_page_name.css // changes to one page, when that language is used
            c_??_??.css // changes to all info pages in a category
   language_c_??_??.css // changes to all info pages in a category, when that language is used
               m_??.css // changes to a manufacturer's listing page
      language_m_??.css // changes to a manufacturer's listing page, when that language is used
               p_??.css // changes to a product's info page
      language_p_??.css // changes to a product's info page, when that language is used
             print*.css // printer-friendly global usage site-wide changes for printing-only