javascript slider not working - php

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({

Related

How to add next and previous buttons on ad (item) view on dj-classifieds (Joomla)?

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 } ?>

Container slideshow control to display on all but last item

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

Pagination on Wp-Property not working

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

Division by zero in code

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.

Convert current animated banner into a nivo slider from bespoke CMS

I've taken over a website that currently has a custom built CMS which we want to keep. The one change we want to make is to the homepage animated banner as it's pretty poor.
It's currently setup so it grabs the images input through the cms and outputs them in an animated banner. I want to keep that functionality but feed the images into a nivo slider instead. I'm a little cautious as to how I go about doing it.
This is the code that's outputting the images into the animated banner (I think!!):
<? if ($page[id] == 1) { ?>
<?
$i = 0;
$homebanners = mysql_query("SELECT * FROM banners ORDER BY banner_order ASC");
while ($banner = mysql_fetch_assoc($homebanners)) {
if (!$first) { $first = true; $bannerimage = $banner[banner_image]; $bannertext = $banner[banner_text]; $bannerlink = $banner[banner_link]; }
$javascript .= "bannerimage[$i] = '$banner[banner_image]';
bannertext[$i] = '".addslashes($banner[banner_text])."';
bannerlink[$i] = '$banner[banner_link]';
";
$i++;
}
if ($i > 1) {
?>
<script>
var curbanner = 0;
var bannerimage = new Array();
var bannertext = new Array();
var bannerlink = new Array();
<? echo $javascript; ?>
totalbanners = bannerimage.length;
function changebanner() {
curbanner = curbanner + 1;
if (totalbanners == curbanner) { curbanner = 0; }
bannerurl = 'banner_images/'+bannerimage[curbanner];
$('#bannertext').fadeOut('100', function() {
$("#banner").animate({"height": "0px"}, 350, "linear",
function() {
$('#banner').css({ 'background-image': 'url('+bannerurl+')' }).fadeIn('slow');
$("#banner").animate({"height": "222px"}, 350, "linear",
function() {
document.getElementById('btext').innerHTML=bannertext[curbanner];
document.getElementById('bannerlink').href=bannerlink[curbanner];
if (bannerlink[curbanner] == "") { document.getElementById('bannerlink').innerHTML = ''; } else { document.getElementById('bannerlink').innerHTML = 'Read more...'; }
$('#bannertext').fadeIn('100');
});
});
});
}
setInterval('changebanner()',10000);
</script><? } ?>
And...
<div id="rightcol" style="height:222px;">
<div id="banner" style="background-image:url('banner_images/<? echo $bannerimage; ?>')">
<div id="bannertext">
<h2 id="btext"><? echo $bannertext; ?></h2>
<a id="bannerlink" href="<? echo $bannerlink; ?>" class="readmore"><? if ($bannerlink) { ?>Read more...<? } ?></a>
</div><!-- END bannertext -->
</div><!-- END banner -->
</div><!-- END rightcol -->
How can I get the image, banner text and banner link into a nivo slider in this format:
<div id="slider" class="nivoSlider">
<img src="image-1.jpg" alt="" title="banner-text-1" />
<img src="image-2.jpg" alt="" title="banner-text-2" />
<img src="image-3.jpg" alt="" title="banner-text-3" />
</div>
The amount of slides inputted through the cms should be infinite.
<?php
if ($page[id] == 1) {
$i = 0;
$html = '';
$homebanners = mysql_query("SELECT * FROM banners ORDER BY banner_order ASC");
while ($banner = mysql_fetch_assoc($homebanners)) {
if (!$first) { $first = true; $bannerimage = $banner[banner_image]; $bannertext = $banner[banner_text]; $bannerlink = $banner[banner_link]; }
$html .= "<img src=\"$bannerimage\" alt=\"$bannertext\" title=\"$bannertext\" />";
$i++;
}
if ($i > 1) {
echo "<div id=\"slider\" class=\"nivoSlider\">";
echo $html;
echo "</div>";
}
}
?>

Categories