Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Plugins & Atahualpa »

Incomapitibility of RotateHeaderImages with other plugins

Old May 9, 2012, 05:53 PM
1 posts · Dec 2011
Incomapitibility of RotateHeaderImages with other plugins

since RotateHeaderImages uses the global variable j as index, this variable can be changed by other plugins which are written as bad as this piece of code of yours. When writing modules/plugins/themes you should keep you plugin independent so that no other plugin can interfere (unexpectedly) with it.
It happend to me, that j was set to 120 after page load (due to email-decrypt--for()-loops or whatever which also shouldn't use global variables (imagine image rotation would reset the variable while decrypting is in process (which could be possible in future))) and the image was replaced by image[120] which is 'undefined' which of course was no valid/existing file.

So i changed your code (in JS you can use structures which are like a light version of C-objects) and I would be very glad if you integrated it into atahualpa for all the other users and also accepted the idea and principle for your next and current projects.


<?php if (strpos($bfa_ata['configure_header'],'%image')!== FALSE AND 
$bfa_ata['header_image_javascript'] != "0" AND $bfa_ata['crossslide_fade'] == "0") { ?>
bfa_ata = {
	HeaderImages: [<?php echo implode(", ", bfa_rotating_header_images()); $init = ''; ?>], t:0, i:0, j:0, p:<? echo count(bfa_rotating_header_images())-1; ?>,
	<?php if ($bfa_ata['header_image_javascript_preload'] == "Yes") { 
		$init = 'bfa_ata.init(); '; ?>
	PreLoadImages: [],
	init: function() {
		for (var i = 0; i < bfa_ata.p; i++) {
			bfa_ata.PreLoadImages[i] = new Image();
			bfa_ata.PreLoadImages[i].src = HeaderImages[i];
	<?php } ?>
	RotateHeaderImages: function() {
		if (document.body) {
			if (!bfa_ata.HeaderImageContainer) bfa_ata.HeaderImageContainer = document.getElementById('imagecontainer');
			bfa_ata.HeaderImageContainer.style.background = 'url(' + bfa_ata.HeaderImages[bfa_ata.j] + ') <?php echo $bfa_ata['headerimage_alignment']; ?> no-repeat';
			if (++bfa_ata.j > (bfa_ata.p)) {bfa_ata.j = 0;}
			bfa_ata.t = setTimeout(bfa_ata.RotateHeaderImages, <?php echo $bfa_ata['header_image_javascript']; ?>000);
window.onload = function(){<? echo $init; ?>bfa_ata.RotateHeaderImages()};
<?php } ?>

Last edited by Jonny007-MKD; May 9, 2012 at 05:57 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
3.6.1 doesn't work with plugins taisia Plugins & Atahualpa 4 Jan 23, 2011 05:23 PM
SEO Plugins -- How Many are Too Many? Cheers Header configuration & styling 7 Dec 21, 2010 03:35 PM
Plugins for IDX Broker mcglastonbury9 Plugins & Atahualpa 1 Oct 16, 2010 01:53 PM
Plugins Esperanza Plugins & Atahualpa 6 Aug 25, 2009 03:33 PM

All times are GMT -6. The time now is 02:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.