I’ve got this script installed on two sites. In my localhost site, it operates fine. However, on my 2nd test site, the script below is returning a 404 error (in Chrome’s developer console) on the color.php file.
Although, I can then click on color.php in the console and it loads fine and echo’s out the correct value I’m expecting. I’m at a loss for what’s causing the 404, but its preventing the script from getting to the alert() in the doColor() function. Any ideas?
$('#my_theme').change
(
function()
{
$("#largePreview").hide();
var myImage = $('#my_theme :selected').text();
$('.selectedImage img').attr('src','<?php echo get_bloginfo('template_directory') ?>/styles/'+myImage+'/screenshot.jpg');
$('.selectedImage img').attr('title',myImage);
$.get('<?php echo get_bloginfo('template_directory') ?>/color.php', {theme: myImage, spot: '1'}, function(data){doColor('#my_theme_header_color', data);});
$.get('<?php echo get_bloginfo('template_directory') ?>/color.php', {theme: myImage, spot: '2'}, function(data){doColor('#my_theme_sidebar_color', data);});
$.get('<?php echo get_bloginfo('template_directory') ?>/color.php', {theme: myImage, spot: '3'}, function(data){doColor('#my_theme_spot_color_alt', data);});
$.get('<?php echo get_bloginfo('template_directory') ?>/color.php', {theme: myImage, spot: '4'}, function(data){doColor('#my_theme_spot_color_alt2', data);});
}
);
function doColor(el, color)
{
alert('in function docolor');
$(el).val(color).trigger('keyup');
$(el).attr('value', color);
$(el).val(color);
}
Contents of color.php is below…
<?php
require_once('../../../wp-blog-header.php');
$myTheme = $_REQUEST['theme'];
$spot = $_REQUEST['spot'];
$myThemeColor = $myTheme."_color".$spot;
$myColor = get_option($myThemeColor);
$file = "styles/".$myTheme."/template.ini";
if ($myColor == "")
{
if (file_exists($file) && is_readable($file))
{
$ini_array = parse_ini_file($file);
if($spot == 1){$myColor = $ini_array['color1'];}
if($spot == 2){$myColor = $ini_array['color2'];}
if($spot == 3){$myColor = $ini_array['color3'];}
if($spot == 4){$myColor = $ini_array['color4'];}
}
else
{
if($spot == 1){$myColor = get_option('cb2_theme_header_color');}
if($spot == 2){$myColor = get_option('cb2_theme_sidebar_color');}
if($spot == 3){$myColor = get_option('cb2_theme_spot_color_alt');}
if($spot == 4){$myColor = get_option('cb2_theme_spot_color_alt2');}
}
}
echo $myColor;
?>
Sounds like your web server doesn’t know about the file on the second test server.
Could be a permissions setting.
What platform and web server are you using?