[CONTRIBUTION] Banner Multi language MOD
Posted 03 August 2012 - 02:28 PM
I'd like to ask you a question about the contribution Banner Multi language MOD.
I installed it successfully, but I get a little problem.
I installed the banner for my 3 languages, French dutch and English.
But the banner doesn't always match the right language. And if I refresh the page a few times, the language of the banner switches to another language alone.
So I get french with dutch, then english with english then with french.
Could you help me with that please?
My site is http://www.lejoaillier.be
Posted 13 November 2012 - 05:10 PM
Posted 07 February 2013 - 06:20 AM
I've tried to sort it out, but to no avail. My only conclusion is that this is a mod for a banner rotator add-on out there and the original contributor just forgot to mention? I assumed MOD was for module, but it would make sense if it's a modification of another add-on, like the jQuery Banner Rotator contribution.
Either way, would be super helpful if someone can shed some light. (Fingers crossed @OSC-Sevilla sees this!)
For the record, I've uninstalled and reinstalled this as-is 3 times so far, even with the language from tables update submitted by @mpps. No luck at all.
Edited by Chachita, 07 February 2013 - 06:23 AM.
Posted 08 April 2013 - 12:02 AM
And this was the database mod that was used:
ALTER TABLE `banners` ADD `language_id` INT( 11 ) NOT NULL DEFAULT '1' AFTER `banners_id` ;
What I did after was make a directory in the images/adds directory in my install, for each of my languages. I then copied the images to be used in my banners for each language into the appropriate directory that I created. Then in the banner manager I created banner elements for all the languages and added them to the same banner group. The mod does allow you to set the language when you are doing this and the table language key values are updated correctly in the banners table. The admin area seems to completely work with regards to this.
And here is where I see the issue. The banners load with all the images regardless of the language definition. So I think that the key is modifying the includes/functions/banner.php so that it loads the banner elements based on the fact that languages in use match the language id of the banner element whenever the banner is refreshed.
Posted 08 April 2013 - 04:07 PM
if not, then i agree, it must be the includes/functions/banner.php file that needs tweaking. i too am using the nivo slider, and i've tried dissecting the code with my own limited knowledge of php, but no luck. although, i also wonder if its the actual backend set-up for the banners. could it be the banner group assigned? maybe if each language had its own group? i dont understand how banner groups work, so i havent attempted that yet. have to admit, im a bit scared to.
Posted 08 April 2013 - 04:44 PM
I am not a coder at all but have been playing with the includes/functions/banner.php and in my version (not stock 2.3.3 but included with a template that was purchased, file says 2003) and the code in this block:
// Display a banner from the specified group or banner id ($identifier)
seems to be the most important. I have 6 images, 3 in each language folder and the banner loads all 6 images related to the banner group regardless of language. I tried to change the database queries 'where' clause to add language_id=1 (my main language) into the string with the hope of the code only pulling and displaying the images for one language. The way the code works, it has multiple validations and will still pull the 6 images (when it should pull 3). The banner will display with 6 items but when it switches to the actual images of 3 of them you will get no image displayed and a TEP error about being disabled or not found because the result of the query mod gives correctly gives 3 elements. So that's a step in the right direction. My thinking was that if I could get the code to display the correct amount of images with a fixed language_id value in the database queries, I could then replace that fixed value with the user selected language variable value once I figured out how. I don't understand why it still tries to display the full 6 images. I must not be fiddling with the correct block of code that gets the initial images associated with the banner group. There is a 'select count(*)' query that seems to be used to grab the banners that are part of the banners group and limiting this to grab only the 3 images still has the effect of trying to display 6.
I think at minimum that whole block needs to be rewritten for it to work the way we want it to with the language mod. It would be nice to have access to a database map and flowchart of osC to better understand the logic independently of the code.
Posted 08 April 2013 - 05:49 PM