I have the following php,
<?php
$items_position = $helper->get('position');
$mods = JModuleHelper::getModules($items_position);
$count = count($mods);
$doc = JFactory::getDocument();
$doc->addScript (T3_TEMPLATE_URL . '/acm/container-slideshow/js/landing/jquery.easing.js');
$doc->addScript (T3_TEMPLATE_URL.'/acm/container-slideshow/js/landing/jquery.mousewheel.min.js');
$doc->addScript (T3_TEMPLATE_URL.'/acm/container-slideshow/js/landing/jquery.singular.js');
?>
<div class="style-1 block-landing">
<?php $i = 1; foreach ($mods as $mod) : ?>
<div class="block-landing-item <?php if (isset($animation)) echo $animation; ?>" id="block-landing-item-<?php echo $mod->id; ?>">
<?php
echo JModuleHelper::renderModule($mod);
?>
<?php if (($i==$count-1) && $helper->get('enable-leave-slide')): ?>
<a class="arrow-bottom block-landing-next" href="#"><i class="fa fa-long-arrow-down"></i></a>
<?php endif; ?>
</div>
<?php $i++; endforeach; ?>
<div class="mod-nav">
<ul class="block-landing-nav">
<?php $i = 0; foreach ($mods as $mod) : ?>
<li class="mod-nav-item"><?php echo $mod->id; ?></li>
<?php $i++; endforeach; ?>
<?php if($helper->get('enable-leave-slide')): ?>
<?php endif; ?>
</ul>
<!-- /mod-nav -->
</div>
</div>
<script>
(function($){
var iOS = parseFloat(('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,''])[1]).replace('undefined', '3_2').replace('_', '.').replace('_', '')) || false;
if(!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || iOS)) {
var slide = $('.block-landing');
var parent = slide.parents('#t3-section');
slide.singular({
section: '.block-landing-item',
nav: '.block-landing-nav',
prev: '.block-landing-prev',
next: '.block-landing-next',
navActiveClass: 'block-landing-active',
scrollSpeed: 600,
mousewheel: true,
easing: 'easeInOutQuart',
scrollEnd: function(elem) {
if ($('.block-landing-nav .block-landing-active').hasClass('sec-last')) {
$('#sec-last').animate({
height: 0,
opacity: 0
}, 400, function() {
parent.addClass('slide-hide');
$('html, body').css('overflow', 'unset');
});
}
}
});
$(window).on('mousewheel', function(e, delta) {
if(delta < -0.8) {
}
if(delta > 0.8) {
if ($(this).scrollTop() == 0) {
parent.removeClass('slide-hide');
$('.block-landing-prev', '#sec-last').click();
$('html, body').css('overflow', 'hidden');
}
}
});
} else {
$('.home-landing').css('overflow','unset');
$('.block-landing').css('position','static');
$('.block-landing > div').css('height','auto!important');
$('.block-landing-nav').css('display','none');
}
})(jQuery);
</script>
This code is used to generate a little arrow that points down to let you know that you need to scroll in my container slideshow.
The problem is that the little arrow only shows on the last slide item. It should show on all of the slides except from the last slide.
Don't suppose anyone could help me to display this on all but last?
Thanks,
Richard
Related
Could someone please tell me why am I getting the following error?
Parse error: syntax error, unexpected '"', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /app/vendor/magenest/module-instagram-shop/view/frontend/templates/slider/slider.phtml on line 161 ?
The file is unmodified.
PHP version: PHP 7.2.30 (cli) (built: Apr 23 2020 18:36:52) ( NTS )
short_open_tag = On.
PHPStorm's code inspector is not throwing any issue.
I think it could be related to my environment settings. If i remove everything from the file (0 length), the page containing this widget renders properly. The module is properly set up in the backend. I am stumped. Thank you very much!
The line is
if ($widgetOptions["lazy_load"]) {
Full code:
<?php
if ($sliderBlock = $block->getSliderBlock()) {
$widgetOptions = $sliderBlock->getWidgetOptions();
$photos = $sliderBlock->getPhotos();
$slickConfig = $sliderBlock->getData();
$totalItems = $photos->getSize();
$itemsPerSlide = $sliderBlock->getItemsPerSlide();
$prefixElementClass = uniqid();
$storyBlock = $sliderBlock->getStoryBlock(); ?>
<!-- allow show widget if photos is not null -->
<?php if ($photos->getSize() != 0 || $storyBlock != '') { ?>
<div class="photo-slider-wrapper"
id="slider-<?= $block->escapeHtmlAttr($prefixElementClass) ?>"
style="display: none;">
<div class="slider">
<?= $block->getSharedPopupHtml($sliderBlock->getPhotoSource()) ?>
</div>
<div class="block-title">
<h2 class="title"><?= $block->escapeHtml($sliderBlock->getTitle()) ?></h2>
</div>
<?= $storyBlock ?>
<div class="block-content">
<div class="block block-photo-slider slider-list container">
<?php if ($totalItems) { ?>
<div class="photos-wrapper">
<ul class="photos-slick slick-<?= $block->escapeHtmlAttr($prefixElementClass) ?>"
<?php
if ($widgetOptions["rtl"] == "true") {
echo ("dir='rtl'");
}
?>>
<?php
$count = 0;
/** #var \Magenest\InstagramShop\Model\Photo $photo */
foreach ($photos as $photo) {
if (!$sliderBlock->isDefaultTemplate() && $count % $itemsPerSlide == 0) {
echo $block->escapeHtml(
'<li class="slide-item"><ul class="'
. $block->getItemsPerSlideClass()
. '-photo">'
);
} ?>
<li class="<?= $block->escapeHtmlAttr($photo->getPhotoId()) ?>
instagram-photo
<?php if ($sliderBlock->isDefaultTemplate()) {
echo 'default';
} ?>"
id="<?= $block->escapeHtmlAttr($photo->getPhotoId()) ?>">
<a href="<?= $block->escapeUrl($photo->getUrl()) ?>"
<?php if (!$sliderBlock->isDefaultTemplate()) {
echo 'class="instagram-link-photo"';
} ?>>
<?php if ($widgetOptions["lazy_load"]): ?>
<img data-lazy="<?= $sliderBlock->getPhotoSourceOptimize($photo) ?>"
alt=""/>
<?php else: ?>
<img src="<?= $sliderBlock->getPhotoSourceOptimize($photo) ?>" alt=""/>
<?php endif; ?>
<?php if ($photo->getMediaType() == 'VIDEO') { ?>
<i class="fas fa-video"
style="
float: right;
margin: 5px;
font-size: 20px;
position: absolute;
right: 0;
top: 0">
</i>
<?php } ?>
<div class="overlay"></div>
<div class="text">
<span class="widget-icon">
<i class="far fa-heart">
<?= $block->escapeHtml($photo->getLikes()) ?>
</i>
<i class="far fa-comment">
<?= $block->escapeHtml($photo->getComments()) ?>
</i>
</span>
<p class="photo-caption">
<?= $block->getPhotoCaption($photo->getCaption()) ?>
</p>
</div>
</a>
<?= $sliderBlock->getLinkedProductsHtml($photo) ?>
<?= $sliderBlock->getHotspotHtml($photo) ?>
<?php if ($sliderBlock->canShowVideo()) {
echo $sliderBlock->getVideoHtml($photo);
} ?>
</li>
<?php
$count++;
if (!$sliderBlock->isDefaultTemplate()
&& ($count % $itemsPerSlide == 0 || $count == $totalItems)) {
echo ('</ul></li>');
}
} ?>
</ul>
</div>
<?php if ($sliderBlock->displayGalleryButton()): ?>
<div class="gallery-btn-block">
<a href="<?= $block->escapeUrl($sliderBlock->getUrl('instagram/gallery/')) ?>"
style="<?= $sliderBlock->getViewFullGalleryCss() ?>"
class="instagram-button">
<?= $block->escapeHtml($sliderBlock->getViewFullGalleryTitle()) ?>
</a>
</div>
<?php endif; ?>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
<?php if ($photos->getSize()):
$scriptString = <<<script
require([
'jquery',
'photoModel',
'slick'
], function ($, photoModel) {
let item_number = {$block->escapeHtml($widgetOptions["items_number_desktop"])},
photos = {$sliderBlock->getPhotosData($photos)},
photoSize = {$block->escapeHtml($totalItems)};
$('#slider-{$block->escapeHtml($prefixElementClass)}').on('init', function () {
$(this).attr('style', 'display: block;');
});
$('.photos-slick.slick-{$block->escapeHtml($prefixElementClass)}')
.on('afterChange', function (event, slick, currentSlide) {
//currentSlide is undefined on init -- set it to 0 in this case (currentSlide is 0 based)
let i = (currentSlide ? currentSlide : 0) + 1;
// no dots -> no slides
if (slick.\$dots) {
// use dots to get some count information
dotsLength = (slick.\$dots[0].children.length);
if (i == dotsLength) {
$(this).slick('slickGoTo', 0, true);
}
}
if (i <= photoSize) {
let iterator = item_number + 20, photo = [];
for (var j = 0; j < iterator; j++) {
if(typeof photos[i+item_number] != 'undefined') {
photo.push(photos[i+item_number]);
i++;
}
}
photoModel.setPhotos(photo);
}
});
$('.photos-slick.slick-{$block->escapeHtml($prefixElementClass)}').slick({
slidesToShow: {$widgetOptions["items_number_desktop"]},
slidesToScroll: {$widgetOptions["slides_to_scroll"]},
infinite: false,
dots: {$block->escapeHtml($widgetOptions["animation_dots"])},
arrows: {$block->escapeHtml($widgetOptions["animation_arrows"])},
script;
if ($widgetOptions["lazy_load"]) {
$scriptString .= <<<script
lazyLoad: 'ondemand',
script;
}
$scriptString .= <<<script
autoplay: {$block->escapeHtml($widgetOptions["autoplay"])},
autoplaySpeed: {$block->escapeHtml($widgetOptions["autoplaySpeed"])},
rtl: {$block->escapeHtml($widgetOptions["rtl"])},
responsive: [
{
breakpoint: 1023,
settings: {
slidesToShow: {$widgetOptions["items_number_tablet"]},
}
},
{
breakpoint: 640,
settings: {
slidesToShow: {$widgetOptions["items_number_mobile"]},
}
}
]
}).slick('setPosition');
});
require(['mage/url'], function (urlBuilder) {
return urlBuilder.setBaseUrl('{$block->escapeUrl($sliderBlock->getBaseUrl())}');
});
script;
?>
<?= isset($secureRenderer)
? $secureRenderer->renderTag('script', [], $scriptString, false)
: "<script>$scriptString</script>" ?>
<?php
$canShowVideo = $sliderBlock->canShowVideo() ? 'true' : 'false';
$scriptString = <<<script
{
"#slider-{$block->escapeHtml($prefixElementClass)}": {
"instagramPopup": {
"photos" : {$sliderBlock->getPhotosData($photos, true)},
"canShowVideo": {$canShowVideo},
"prefixContainer":".slider",
"prefixElement":"ul.slick-{$block->escapeHtml($prefixElementClass)} li",
"photoType": {$block->escapeHtml($sliderBlock->getPhotoType())},
"prefixElementClass": "#slider-{$block->escapeHtml($prefixElementClass)}",
"baseMediaUrl": "{$block->escapeUrl($block->getBaseMediaUrl())}"
}
}
}
script;
?>
<?= isset($secureRenderer)
? $secureRenderer->renderTag('script', ['type' => 'text/x-magento-init'], $scriptString, false)
: "<script type='text/x-magento-init'>$scriptString</script>" ?>
<?php elseif ($storyBlock != ''):
$scriptString = <<<script
require(['jquery'], function ($) {
$('#slider-{$block->escapeHtml($prefixElementClass)}').css('display', 'block');
})
script;
?>
<?= isset($secureRenderer)
? $secureRenderer->renderTag('script', [], $scriptString, false)
: "<script>$scriptString</script>" ?>
<?php endif; ?>
<?php
} ?>
The code is probably not written for 7.2 but since you're on 7.2 it should be enough to move script; at the beginning of the line:
[...]
The closing identifier may be indented by space or tab, in which
case the indentation will be stripped from all lines in the doc
string. Prior to PHP 7.3.0, the closing identifier must begin in the
first column of the line.
[...]
Heredoc's doc page
I tried many codes to do the thing, but it's not working.
The Image code is in the line 21. This is a copy of the code where I have to add the next and previous buttons:
<?php
defined ('_JEXEC') or die('Restricted access');
$par = JComponentHelper::getParams( 'com_djclassifieds' );
$app = JFactory::getApplication();
$item = $this->item;
$main_img_width = $par->get('gallery_width','200')-4;
$thumbs_limit = $par->get('gallery_thumbs_in_row','3');
$thumb_width = round(($par->get('gallery_width','200')/$thumbs_limit)-14);
$djMediaTools = ($par->get('djmediatools_integration', 0) == '1' && $par->get('djmediatools_album_item', 0) > 0) ? $par->get('djmediatools_album_item', 0) : false;
$djMediaToolsMinimum = (int)$par->get('djmediatools_minimum', 1);
JHtml::_('jquery.framework');
?>
<div class="images_wrap" style="width:<?php echo $par->get('gallery_width','200');?>px"><div class="images">
<?php if ($djMediaTools > 0 && count($this->item_images) >= $djMediaToolsMinimum) {?>
<div class="djc_images">
<?php echo JHtml::_('content.prepare', '{djmedia '.(int)$djMediaTools.'}', $par, 'com_djclassifieds.item.djmediatools'); ?>
</div>
<?php } else { ?>
<div class="djc_images">
<div class="djc_mainimage">
<?php if(count($this->item_images)){ ?>
<a id="djc_mainimagelink" rel="djc_lb_0" title="<?php echo $item->name; ?>" href="<?php echo JURI::base(true).$this->item_images[0]->thumb_b; ?>">
<img id="djc_mainimage" alt="<?php echo $item->name; ?>" src="<?php echo JURI::base(true).$this->item_images[0]->thumb_b;?>" />
</a>
<?php }else{?>
<?php if($par->get('blank_img_source','0')==1){ ?>
<img id="djc_mainimage" class="djc_mainimage_no_image" style="width:<?php echo $par->get('gallery_width','200');?>px" alt="<?php echo $item->name; ?>" src="<?php echo DJClassifiedsImage::getCatImage($item->cat_id);?>" />
<?php }else{ ?>
<img id="djc_mainimage" class="djc_mainimage_no_image" style="width:<?php echo $par->get('gallery_width','200');?>px" alt="<?php echo $item->name; ?>" src="<?php echo JURI::base(true).$par->get('blank_img_path','/components/com_djclassifieds/assets/images/').'no-image-big.png';?>" />
<?php } ?>
<?php }?>
</div>
<?php
if (count($this->item_images) > 1) { ?>
<div class="djc_thumbnails djc_thumbs_gal<?php echo $thumbs_limit;?> " id="djc_thumbnails">
<?php foreach($this->item_images as $im=>$img){
if($im>0 && $im%$thumbs_limit==0){
$new_row_class = ' new_row';
}else{
$new_row_class = '';
}
?>
<div class="djc_thumbnail djc_thumb_row<?php echo $new_row_class;?>">
<a rel="<?php echo JURI::base(true).$img->thumb_b;?>" title="<?php echo $img->caption; ?>" href="<?php echo JURI::base(true).$img->thumb_b;?>">
<img alt="<?php echo $img->caption; ?>" src="<?php echo JURI::base(true).$img->thumb_s;?>" />
</a>
</div>
<?php } ?>
<div class="clear_both"></div>
</div>
<?php } ?>
<?php for($ii=0; $ii<count($this->item_images);$ii++ ){ ?>
<a id="djc_lb_<?php echo $ii; ?>" class="lightbox-djitem" rel="lightbox-djitem" title="<?php echo $this->item_images[$ii]->caption;?>" href="<?php echo JURI::base(true).$this->item_images[$ii]->thumb_b;?>" style="display: none;"></a>
<?php } ?>
</div>
<?php } ?>
</div></div>
<script type="text/javascript">
this.DJCFImageSwitcher = function (){
var mainimagelink = document.id('djc_mainimagelink');
var mainimage = document.id('djc_mainimage');
var thumbs = document.id('djc_thumbnails') ? document.id('djc_thumbnails').getElements('img') : null;
var thumblinks = document.id('djc_thumbnails') ? document.id('djc_thumbnails').getElements('a') : null;
<?php if($par->get('lightbox_type','slimbox')!='magnific'){ ?>
if(mainimagelink && mainimage) {
mainimagelink.removeEvents('click').addEvent('click', function(evt) {
var rel = mainimagelink.rel;
document.id(rel).fireEvent('click', document.id(rel));
//if(!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) {
return false;
//}
//return true;
});
}
<?php } ?>
if (!mainimage || !mainimagelink || !thumblinks || !thumbs) return false;
thumblinks.each(function(thumblink,index){
var fx = new Fx.Tween(mainimage, {link: 'cancel', duration: 200});
thumblink.addEvent('click',function(event){
event.preventDefault();
//new Event(element).stop();
/*
mainimage.onload = function() {
fx.start('opacity',0,1);
};
*/
var img = new Image();
img.onload = function() {
fx.start('opacity',0,1);
};
fx.start('opacity',1,0).chain(function(){
mainimagelink.href = thumblink.href;
mainimagelink.title = thumblink.title;
mainimagelink.rel = 'djc_lb_'+index;
img.src = thumblink.rel;
mainimage.src = img.src;
mainimage.alt = thumblink.title;
});
return false;
});
});
};
window.addEvent('load', function(){
var img_width = document.id('dj-classifieds').getElement('.djc_images').getSize().x;
var dj_item = document.id('dj-classifieds').getElement('.djcf_images_generaldet_box').getSize().x;
var general_det = dj_item-img_width-1;
if(general_det<150){
document.id('dj-classifieds').getElement('.general_det').addClass('general_det_s');
}
if(general_det<301){
document.id('dj-classifieds').getElement('.general_det').addClass('general_det_m');
}
document.id('dj-classifieds').getElement('.general_det').setStyle('width',general_det) ;
});
window.addEvent('domready', function(){
DJCFImageSwitcher();
});
</script>
<?php if($par->get('lightbox_type','slimbox')=='magnific'){ ?>
<script type="text/javascript">
!function($){
$(document).ready(function(){
$('#djc_mainimagelink').click(function(e) {
e.preventDefault();
var rel = $(this).attr('rel');
console.log(rel);
$('#'+rel).click();
//console.log(e);
//do other stuff when a click happens
});
$('.lightbox-djitem').magnificPopup({
//$(this).magnificPopup({
// delegate: '.dj-slide-link', // the selector for gallery item
type: 'image',
mainClass: 'mfp-img-mobile',
gallery: {
enabled: true
},
image: {
verticalFit: true,
titleSrc: 'title'
},
iframe: {
patterns: {
youtube: null,
vimeo: null,
link: {
index: '/',
src: '%id%'
}
}
}
// });
});
});
}(jQuery);
</script>
<?php } ?>
I have a Wordpress site that is using Wp-Property and the pagination isn't working, can anyone help fix this please. Please see below the pagination part from the function page.
<?php if($use_pagination) { ?>
if(!wpp_pagination_<?php echo $unique_hash; ?>) {
jQuery("#wpp_shortcode_<?php echo $unique_hash; ?> .wpp_pagination_slider_wrapper").each(function() {
var this_parent = this;
/* Slider */
jQuery('.wpp_pagination_slider', this).slider({
value:1,
min: 1,
max: <?php echo $pages; ?>,
step: 1,
slide: function( event, ui ) {
/* Update page counter - we do it here because we want it to be instant */
jQuery("#wpp_shortcode_<?php echo $unique_hash; ?> .wpp_current_page_count").text(ui.value);
jQuery("#wpp_shortcode_<?php echo $unique_hash; ?> .wpp_pagination_slider .slider_page_info .val").text(ui.value);
},
stop: function(event, ui) {
wpp_query_<?php echo $unique_hash; ?> = changeAddressValue(ui.value, wpp_query_<?php echo $unique_hash; ?>);
}
});
/* Fix slider width based on button width */
var slider_width = (jQuery(this_parent).width() - jQuery(".wpp_pagination_back", this_parent).outerWidth() - jQuery(".wpp_pagination_forward", this_parent).outerWidth() - 30);
jQuery(".wpp_pagination_slider", this_parent).css('width', slider_width);
jQuery('.wpp_pagination_slider .ui-slider-handle', this).append('<div class="slider_page_info"><div class="val">1</div><div class="arrow"></div></div>');
});
wpp_pagination_<?php echo $unique_hash; ?> = true;
}
<?php } ?>
});
</script>
<?php
$js_result = ob_get_contents();
ob_end_clean();
ob_start(); ?>
<div class="properties_pagination <?php echo $settings['class']; ?> wpp_slider_pagination" id="properties_pagination_<?php echo $unique_hash; ?>">
<div class="wpp_pagination_slider_status">
<?php
if(function_exists('WPPFL_getNumberOfFavorites')) {
$num_of_favorites = WPPFL_getNumberOfFavorites();
} else{
$num_of_favorites = 0;
}
$currentTemplate = "";
if (isset($wpp_query['template'])) {
$currentTemplate = $wpp_query['template'];
}
?>
<?php if ($currentTemplate==TEMPLATEPATH . "/list-my-property-content.php") { ?>
<div class="wppcs-sub-menu">
<?php global $post;
$post_name = $post->post_name; ?>
<?php $class='class="active"'; ?>
<ul>
<li <?php if($post_name == 'list-my-property') { echo $class; } ?>>
<a href="<?php echo get_bloginfo('url'); ?>/list-my-property/">
View Listed Properties
</a>
</li>
<li <?php if($post_name == 'add-new-property') { echo $class; } ?>>
<a href="<?php echo get_bloginfo('url'); ?>/list-my-property/add-new-property/">
Add New Property
</a>
</li>
</ul>
</div>
<?php } else { ?>
<ul class="top_part">
<li><a>Search results</a></li>
<li class="favor">My Favourites(<span class="number_of_favorites"><?php echo $num_of_favorites; ?></span>)</li>
</ul>
<?php } ?>
<div class="clear"></div>
</div>
<?php if($use_pagination) { ?>
<div class="wpp_pagination_slider_wrapper">
<div class="wpp_page_numbers_block">
<span class="numbers-title">Pages</span>
<?php
if ($pages < 10) {
for($i=1; $i<=$pages; $i++) {
echo '<span class="page_numbers" data-value="'.$i.'">'.$i.'</span>';
}
} else {
for($i=1; $i<=$pages; $i++) {
if (($i < 4) || ($i>$pages-3)) {
echo '<span class="page_numbers" data-value="'.$i.'">'.$i.'</span>';
}
if ($i==4) {
echo '<span class="middle-pages"><span class="dotted-separator">...</span></span>';
}
}
}?>
</div>
<div class="wpp_pagination_back wpp_pagination_button"><?php _e('Prev', 'wpp'); ?></div>
<div class="wpp_pagination_forward wpp_pagination_button"><?php _e('Next', 'wpp'); ?></div>
<div class="wpp_pagination_slider"></div>
</div>
<?php } ?>
</div>
<div class="ajax_loader"></div>
<?php
$html_result = ob_get_contents();
ob_end_clean();
Thank you in anticaption.
The first thing which can cause your issue is some of third party plugins or your theme. So try firstly to deactivate third party plugins and switch theme to default one to be sure that issue doesn't relate to any of them.
Such request you can also send here
https://wordpress.org/support/plugin/wp-property
or on our site
https://usabilitydynamics.com/contact-us/
Regards.
Usability Dynamics Support
I have this slider in a wordpress theme that it's not working. I have done all the settings right and it won't slide. Automatically or manually. From what I see eveyrthing seems tobe correct. I have also followed all the manufacturer instructions but can't seem to sort it out. Here is the website: www.casavulturului.com
<?php if ( !$paged && get_option('woo_featured') == "true" ) { ?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#loopedSlider").loopedSlider({
<?php
$autoStart = 0;
$slidespeed = 600;
if ( get_option("woo_slider_auto") == "true" )
$autoStart = get_option("woo_slider_interval") * 1000;
else
$autoStart = 0;
if ( get_option("woo_slider_speed") <> "" )
$slidespeed = get_option("woo_slider_speed") * 1000;
?>
autoStart: <?php echo $autoStart; ?>,
slidespeed: <?php echo $slidespeed; ?>,
autoHeight: true
});
});
</script>
<?php } ?>
<div id="sliderWrap">
<div class="innerwrap">
<div id="loopedSlider">
<?php $img_pos = get_option('woo_featured_img_pos'); ?>
<?php $saved = $wp_query; query_posts('suppress_filters=0&post_type=slide&order=ASC&orderby=date&showposts=20'); ?>
<?php if (have_posts()) : $count = 0; $postcount = $wp_query->post_count; ?>
<div class="container">
<div class="slides">
<?php while (have_posts()) : the_post(); ?>
<?php if (!woo_image('return=true')) continue; // Don't show slides without image ?>
<?php $count++; ?>
<div id="slide-<?php echo $count; ?>" class="slide">
<div class="slide-content <?php if($img_pos == "Left") { echo "fr"; } else { echo "fl"; } ?>">
<h2 class="slide-title">
<?php the_title(); ?>
<?php if ($postcount > 1) echo '<span class="controlsbg"> </span>'; ?>
</h2>
<p><?php the_content(); ?></p>
</div><!-- /.slide-content -->
<?php if (woo_image('return=true')) { ?>
<div class="image <?php if($img_pos == "Left") { echo "fl"; } else { echo "fr"; } ?>">
<?php woo_image('width=515&height=245&class=feat-image&link=img'); ?>
</div>
<?php } ?>
<div class="fix"></div>
</div>
<?php endwhile; ?>
</div><!-- /.slides -->
<?php if($count > 1) { ?>
<ul class="nav-buttons <?php if($img_pos == "Left") { echo "right"; } else { } ?>">
<li id="p"></li>
<li id="n"></li>
</ul>
<?php } ?>
</div><!-- /.container -->
<div class="fix"></div>
<?php else : ?>
<p class="note"><?php _e( 'Please add some "Slides" to the featured slider.', 'woothemes' ); ?></p>
<?php endif; $wp_query = $saved;?>
</div><!-- /#loopedSlider -->
</div>
</div><!-- /#sliderWrap -->
JQUERY Code:
(function(jQuery) {
jQuery.fn.loopedSlider = function(options) {
var defaults = {
container: '.container',
slides: '.slides',
pagination: '.pagination',
containerClick: false, // Click container for next slide
autoStart: 0, // Set to positive number for auto start and interval time
restart: 0, // Set to positive number for restart and restart time
slidespeed: 100, // Speed of slide animation
fadespeed: 100, // Speed of fade animation
autoHeight: false // Set to positive number for auto height and animation speed
};
this.each(function() {
var obj = jQuery(this);
var o = jQuery.extend(defaults, options);
var pagination = jQuery(o.pagination+' li a',obj);
var m = 0;
var t = 1;
var s = jQuery(o.slides,obj).children().size();
var w = jQuery(o.slides,obj).children().outerWidth();
var p = 0;
var u = false;
var n = 0;
var interval=0;
var restart=0;
jQuery(o.slides,obj).css({width:(s*w)});
jQuery(o.slides,obj).children().each(function(){
jQuery(this).css({position:'absolute',left:p,display:'block'});
p=p+w;
});
jQuery(pagination,obj).each(function(){
n=n+1;
jQuery(this).attr('rel',n);
jQuery(pagination.eq(0),obj).parent().addClass('active');
});
if (s!=1) { // WooThemes add
jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:-w});
} // WooThemes add
if (s>3) {
jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:-w});
}
if(o.autoHeight){autoHeight(t);}
jQuery('.next',obj).click(function(){
if(u===false) {
animate('next',true);
if(o.autoStart){
if (o.restart) {autoStart();}
else {clearInterval(sliderIntervalID);}
}
} return false;
});
jQuery('.previous',obj).click(function(){
if(u===false) {
animate('prev',true);
if(o.autoStart){
if (o.restart) {autoStart();}
else {clearInterval(sliderIntervalID);}
}
} return false;
});
if (o.containerClick) {
jQuery(o.container ,obj).click(function(){
if(u===false) {
animate('next',true);
if(o.autoStart){
if (o.restart) {autoStart();}
else {clearInterval(sliderIntervalID);}
}
} return false;
});
}
You're using the slide on the "#loopedslider" element:
jQuery("#loopedSlider").loopedSlider({
But that div holds a container with slides, instead of the slides itself. So you have two options:
1) remove the container
OR
2) switch the slider to the element holding the slides:
jQuery(".slides").loopedSlider({
I have been working on a site. It displays the following error,
Warning: Division by zero in
/home/sunshine/public_html/wp-content/themes/DailyDeal/index.php on
line 63
Now I went to check the index.php file but on line 63 I have nothing but a closing brace (})
I would be very thankful if someone could point out the error here(I have tried deactivating all the plugins but the problem still holds).
Below is the complete index.php for the reference,
<?php get_header(); ?>
<script type="text/javascript" >
var root_path_js = '<?php echo get_option('siteurl')."/";?>';
</script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/timer.js"></script>
<script type="text/javascript">
jQuery.noConflict();
function a()
{
return false;
}
jQuery(function() {
jQuery( "#slider-range-min-var" ).slider({
range: "min",
value: jQuery("#sellsqlinfo1").val(),
min: 0,
max: jQuery("#noofcoupon1").val(),
enable: false,
slide: function( event, ui ) {
jQuery("#amount").val("$"+ ui.value );
}
});
jQuery( "#amount" ).val( "$" + jQuery( "#slider-range-min-var" ).slider( "value" ) );
});
</script>
<?php
/* Mail To Friend BOF */
if($_POST['sendact']=='email_frnd') {
require_once (TEMPLATEPATH . '/monetize/send_to_friend/email_friend_frm.php');exit;
}
/* Mail To Friend EOF */
/* Home Page Deal Display BOF */
global $wpdb,$deal_db_table_name;
$postmeta_db_table_name = $wpdb->prefix."postmeta";
$post_db_table_name = $wpdb->prefix."posts";
$destination_path = site_url().'/wp-content/uploads/';
$args = array('numberposts' => 1,'meta_key' =>'is_expired' , 'meta_value' =>'0','post_status' => 'publish','post_type' => 'seller','meta_key' =>'status' , 'meta_value' =>'2' ,'orderby' => 'DESC');
$recent_posts = get_posts( $args );
if(mysql_affected_rows() > 0) { // 1st IF Condition BOF
$post_large = bdw_get_images($destination_path.get_post_meta($post->ID,'file_name',true),'large');
$post_images = bdw_get_images($destination_path.get_post_meta($post->ID,'file_name',true),'thumb'); ?>
<div class="top_content">
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('home_above')) { } else { }?>
</div>
<!-- top content #end -->
<div class="box_header"></div>
<div class="box_bg">
<div class=" box_bottom">
<?php foreach( $recent_posts as $post ){ // foreach loop BOF
if((get_post_meta($post->ID,'status',true) == 2) && (get_post_meta($post->ID,'is_expired',true) == 0)) {
deal_expire_process($post->ID);
$home_deal_id = $post->ID;
global $home_deal_id;
$coupon_website= get_post_meta($post->ID,'coupon_website',true);
$owner_name= get_post_meta($post->ID,'owner_name',true);
$our_price= get_post_meta($post->ID,'our_price',true);
$current_price= get_post_meta($post->ID,'current_price',true);
$sellsql = "select count(*) from $transection_db_table_name where post_id=".$post->ID." and status=1";
$totdiff = $current_price - $our_price;
$percent = $totdiff * 100;
$percentsave = $percent/$current_price;
$sellsqlinfo = $wpdb->get_var($sellsql);
$date = get_post_meta($post->ID,'coupon_end_date_time',true);
$tardate= date("F d, Y H:i:s",get_post_meta($post->ID,'coupon_end_date_time',true));
$stdate= date("F d, Y H:i:s",get_post_meta($post->ID,'coupon_start_date_time',true));
$tardate1= date("F d, Y",get_post_meta($post->ID,'coupon_end_date_time',true));
if(get_post_meta($post->ID,'coupon_end_date_time',true) != "") {
if(date("Y-m-d H:i:s") >= $tardate1 && get_post_meta($post->ID,'enddate',true) != '0' || (get_post_meta($post->ID,'no_of_coupon',true)==$sellsqlinfo)) {
if(get_post_meta($post->ID,'is_expired',true)== '0' || get_post_meta($post->ID,'is_expired',true)== '') {
update_post_meta($post->ID,'is_expired','1');
}
}
} else {
if(get_post_meta($post->ID,'enddate',true) != '0' || (get_post_meta($post->ID,'no_of_coupon',true)==$sellsqlinfo)) {
if(get_post_meta($post->ID,'is_expired',true)== '0' || get_post_meta($post->ID,'is_expired',true)== '') {
update_post_meta($post->ID,'is_expired','1');
}
}
}
$geo_longitude = get_post_meta($post->ID,'geo_longitude',true);
$geo_latitude = get_post_meta($post->ID,'geo_latitude',true);
$shhiping_address = get_post_meta($post->ID,'shhiping_address',true);
$coupon_type = get_post_meta($post->ID,'coupon_type',true);
$no_of_coupon = get_post_meta($post->ID,'no_of_coupon',true); ?>
<div class="content_left"> <a href="<?php the_permalink(); ?>">
<?php if(get_post_meta($post->ID,'file_name',true) != "") { ?>
<img src="<?php echo templ_thumbimage_filter(get_post_meta($post->ID,'file_name',true),'&w=330&h=250&zc=1&q=80');?>" alt="" />
<?php } else { ?>
<img src="<?php echo templ_thumbimage_filter(get_template_directory_uri()."/images/no-image.png",'&w=330&h=250&zc=1&q=80');?>" alt="" />
<?php } ?>
</a> </div>
<div class="content_right">
<span class="title_yellow">Today's Top Cruise Holiday Deal</span>
<h3><?php echo $post->post_title; ?></h3>
<?php if(date("Y-m-d H:i:s")>= date("Y-m-d H:i:s",get_post_meta($post->ID,'coupon_end_date_time',true))){
if(get_post_meta($post->ID,'is_expired',true)=='1' || get_post_meta($post->ID,'no_of_coupon',true)==$sellsqlinfo) {
?>
<div class="i_expire"><?php _e('This deal has','templatic');?><span><?php _e(' expired','templatic');?></span><?php _e('on','templatic');?>
<span><?php echo $tardate1;?></span></div>
<?php }
} else {
if(get_post_meta($post->ID,'coupon_end_date_time',true)){ ?>
<div id="demo" style="pointer-events:none; cursor:default;">
<div id="slider-range-min-var" ></div>
</div>
<div class="deal_time_box">
<div class="time_line"></div>
<div id="countdowncontainer"></div>
<script type="text/javascript">
var dealexpire=new cdtime("countdowncontainer", "<?php echo $tardate; ?>")
dealexpire.displaycountdown("days", formatresults)
</script>
<div class="fr">
<div class="price_main"> <span class="strike_rate"><?php echo get_currency_sym();?><?php echo $current_price;?></span> <span class="rate"><?php echo get_currency_sym();?><?php echo $our_price;?></span> </div>
<?php if(get_post_meta($post->ID,'coupon_type',true) == 1) { ?>
<?php _e(BUY_NOW,'templatic');?>
<?php } else { ?>
<?php _e(BUY_NOW,'templatic');?>
<?php }?>
</div>
</div>
<?php } ?>
<?php } ?>
<!-- Rate Summery BOF -->
<ul class="rate_summery border_bottom">
<li class="rate_current_price"><span><?php _e(CURRENT_PRICE,'templatic');?></span> <strong><small><?php echo get_currency_sym();?></small><?php echo $current_price;?></strong></li>
<li class="rate_our_price"><span><?php _e(OUR_PRICE,'templatic');?></span> <strong><small><?php echo get_currency_sym();?></small><?php echo $our_price;?></strong></li>
<li class="rate_percentage"><span><?php _e(YOU_SAVE,'templatic');?></span> <strong><?php echo #number_format($percentsave,2);?>%</strong></li>
<?php if($sellsqlinfo == 0 ) {
$enddate = explode(" ",$tardate);
$curdate = explode(" ",date("F d, Y H:i:s"));
$enddate= str_replace(",","",$enddate[1]);
$curdate = str_replace(",","",$curdate[1]);
$startdate = explode(" ",$stdate);
$strdate = str_replace(","," ",$startdate[1]);
$curtime = $enddate - $curdate;
$totaltime = ($enddate - $strdate);
$nowremail = $curdate - $strdate; ?>
<input type="hidden" value="<?php echo $nowremail ; ?>" name="sellsqlinfo1" id="sellsqlinfo1"/>
<input type="hidden" value="<?php echo ($enddate - $strdate) ; ?>" name="noofcoupon1" id="noofcoupon1"/>
<?php } else { ?>
<input type="hidden" value="<?php echo $sellsqlinfo; ?>" name="sellsqlinfo1" id="sellsqlinfo1"/>
<input type="hidden" value="<?php echo $no_of_coupon; ?>" name="noofcoupon1" id="noofcoupon1"/>
<?php } ?></li>
</ul>
<?php if(get_post_meta($post->ID,'enddate',true) == '0' && get_option('ptttheme_view_opt') != 'Grid View' && (get_post_meta($post->ID,'status',true) == '1' || get_post_meta($post->ID,'status',true) == '2') ) {
?>
<?php if(get_post_meta($post->ID,'coupon_type',true) == 1) {?>
<?php _e(BUY_NOW,'templatic');?>
<?php } else { ?>
<?php _e(BUY_NOW,'templatic');?>
<?php }
}?>
<!-- Rate Summery EOF -->
<div id="content" class="text_content" ><?php echo "".$post->post_excerpt.""; ?>
<?php _e(get_option('ptthemes_content_excerpt_readmore'));?> </div>
</div>
<!-- Social Network Button Like: twitter,facebook,google + one BOF -->
<div class="share_div index_share_spacer">
<div class="twitt_like"><?php templ_show_twitter_button(); ?></div>
<div class="googleplus">
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script type="text/javascript">
gapi.plusone.render(gcontent,"href": "<?php the_permalink(); ?>", "state": "on");
gapi.plusone.go("gcontent");
</script>
<div id="gcontent">
<g:plusone href="<?php the_permalink(); ?>" size="medium"></g:plusone>
</div>
</div>
<?php templ_show_facebook_button(); ?>
<?php _e(MAIL_TO_FRIEND,'templatic');?>
</div>
<!-- Social Network Button Like: twitter,facebook,google + one EOF -->
<?php } else { ?>
<div class="content_left">
<h3><?php echo _e(NO_RECENT_DEAL,'templatic'); ?></h3>
</div>
<?php }
} // foreach loop BOF
} // 1st IF Condition EOF
/* Home Page Deal Display EOF */ ?>
</div>
</div>
<!-- main post #end -->
<div class="clear">
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('home_below')) { } else { }?>
</div>
<?php include_once (TEMPLATEPATH . '/monetize/send_to_friend/popup_frms.php');?>
<?php get_footer(); ?>
Your divide by zero is inside the include from line 61. Post that code if you still cant find the problem.
So let's be very careful in our codes having numerical divisions because any number divided by zero is undefined. Try it in any device - your phone, your calculator, etc.
This ternary condition could help, but don't force 0 (zero) to be the value of $percentsave when $current_price equals 0. This will ruin the semantic logic of your application.
$percentsave = ($current_price != 0) ? $percent/$current_price : 'undefined';
However, regarding your query -- why its showing in line 63, perhaps you have a code wrapping with your IDE (php specific codes) and that part of the code can be seen in line 63.