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:
Code:
//// 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.
4. 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 .
5. 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:
Code:
define('MORE_INFO', 'button_info.jpg');
define('MORE_INFO_ALT', 'Meer informatie aanvragen');
6. 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');
7. 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
Code:
// 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);
8. example of calling the function:
Code:
<?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.