Hi,
I spend a lot of time to make a item-slideshow, but it don´t work. I think there are two mistakes: There are php-variables in a php-code, for example the patch to the javascript file is a php variable in a php code. That´s wrong, but I don´t know a solution. The second is, that if I use the variable <?php if( osc_count_item_resources() ) { ?> for the slideshow on the startpage, I can not have normal articels on the start-page (main.php) without slideshow,´cause there will repeat the previous and next button-image, I don´t know why.
This code will show you. I use a browser-detect script, ´cause the slideshow will not supported by IE7!
<?php
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('|MSIE ([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = 'IE';
} elseif (preg_match('|Opera/([0-9].[0-9]{1,2})|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = 'Opera';
} elseif(preg_match('|Firefox/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = 'Firefox';
} elseif(preg_match('|Safari/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = 'Safari';
} elseif(preg_match('|Chrome/([0-9\.]+)|',$useragent,$matched)) {
$browser_version=$matched[1];
$browser = 'Chrome';
} else {
// Browser nicht erkannt!
$browser_version = 0;
$browser= 'anderer';
}
if ($browser == "IE" AND $browser_version < "8.0") {
echo '<font style="color:red;">Sie benutzen den Internet Explorer 7. Bitte aktualisieren Sie Ihren Browser um eine dynamische Artikelübersicht einzusehen.</font>';
}
else {
echo '
<script type="text/javascript" src="<?php echo osc_current_web_theme_js_url("jquery_1_3_2.js") ; ?>"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#carousel_ul li:first").before($("#carousel_ul li:last"));
$("#right_scroll img").click(function(){
var item_width = $("#carousel_ul li").outerWidth() + 0;
var left_indent = parseInt($("#carousel_ul").css("left")) - item_width;
$("#carousel_ul:not(:animated)").animate({"left" : left_indent},500,function(){
$("#carousel_ul li:last").after($("#carousel_ul li:first"));
$("#carousel_ul").css({"left" : "-122px"});
});
});
$("#left_scroll img").click(function(){
var item_width = $("#carousel_ul li").outerWidth() + 0;
var left_indent = parseInt($("#carousel_ul").css("left")) + item_width;
$("#carousel_ul:not(:animated)").animate({"left" : left_indent},500,function(){
$("#carousel_ul li:first").before($("#carousel_ul li:last"));
$("#carousel_ul").css({"left" : "-122px"});
});
});
});
</script>
<?php while ( osc_has_latest_items() ) { ?>
<div id="carousel_container">
<div id="carousel_inner">
<ul id="carousel_ul">
<?php if( osc_count_item_resources() ) { ?>
<li><a href="<?php echo osc_item_url() ; ?>"><?php echo osc_item_title() ; ?></a><div class="noblock_slider"><a href="<?php echo osc_item_url() ; ?>"><img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="94" height="94" alt="" /></a></div></li>
<?php } else { ?>
<?php } ?>
</ul>
</div>
<div style="width:488px;">
<div id="left_scroll"><img src="/images/prevArrow.png" /></div>
<div id="right_scroll"><img src="/images/nextArrow.png" /></div>
</div>
</div>
<?php } ?>
';
}
?>
Maybe, somebody can help me.
Thanks alot.