How to access pages based on product ids - javascript

I am having a problem in navigating from one page to another.
<?php
while($row = mysqli_fetch_array($result)) { ?>
<div class="list">
<p><?php echo $row['productname']?></p>
<div class="images">
<img src="<?php echo 'images/'. $row['image'] ?>" style="max-width:100%;height:auto;" />
</div>
}
<div class="text">
<p>
<?php echo $row['description'] ?>
</p>
</div>
<div class="clear"></div>
</div>
<?php
Here the problem is that when I click on the product link it does not take to the desired product description page. Rather than it is redirected to the same commodities page. So i am not understanding what to do.So please help me to find out my error..

You missed php tag inside your markup. please have a look updated code
<?php while ($row = mysqli_fetch_array($result)) { ?>
<div class="list">
<p><?php echo $row['productname']; ?></p>
<div class="images">
<img src="<?php echo 'images/' . $row['image']; ?>" style="max-width:100%;height:auto;" />
</div>
<!-- remove this end curly braces from ur markup-->
<div class="text">
<p>
<?php echo $row['description']; ?>
</p>
</div>
<div class="clear"></div>
</div>
<?php } ?>
<!-- close while loop in proper place. as of now $row['description'] outside from while loop -->

Syntax error in your php statements..
Echo statements are not terminated with (;)
<?php
while($row = mysqli_fetch_array($result)) { ?>
<div class="list">
<p><?php echo $row['productname']; ?></p>
<div class="images">
<img src="<?php echo 'images/'. $row['image']; ?>" style="max-width:100%;height:auto;" />
</div>
<div class="text">
<p>
<?php echo $row['description']; ?>
</p>
</div>
<div class="clear"></div>
</div>
<?php }?>
<?php

Related

Php code My image is no showing on website

my uploaded image are not showing on webpage.
<div class="col-md-8 news-item">
<a href="<?php echo base_url('home/newsdetail/'); ?><?php echo $newsdetail[0]['id']; ?>" style="text-decoration: none; color:black;" >
<h1><?php echo $newsdetail[0]['heading']; ?></h1>
</a>
<p class="author-name"><?php echo $newsdetail[0]['staffname']; ?> <span class="time"><i class="fa fa-clock-o"></i><?php echo date("d-m-Y H:i:s",strtotime($newsdetail[0]['created_date'])); ?></span></p>
<div class="read-img">
<?php if($newsdetail[0]['image']==''){ ?>
<img class="img-responsive" src="<?php echo base_url('assets/img/noimage.gif')?>" height="70"/>
<?php } else { ?>
<?php $multiimage=explode(",",$newsdetail[0]['image']); ?>
<div id="jssor_1" style="position:relative;margin:0 auto;top:0px;left:0px;width:980px;height:480px;overflow:hidden;visibility:hidden;">
<!-- Loading Screen -->
<div data-u="loading" class="jssorl-009-spin" style="position:absolute;top:0px;left:0px;width:100%;height:100%;text-align:center;background-color:rgba(0,0,0,0.7);">
<img style="margin-top:-19px;position:relative;top:50%;width:38px;height:38px;" src="//jssorcdn7.azureedge.net/theme/svg/loading/static-svg/spin.svg" />
</div>
<div data-u="slides" style="cursor:default;position:relative;top:0px;left:0px;width:980px;height:380px;overflow:hidden;">
<?php foreach($multiimage as $imgrow){ ?>
<div>
<img data-u="image" src="<?php echo base_url('uploads/newsimages/'); ?><?php echo $imgrow; ?>" />
<img data-u="thumb" src="<?php echo base_url('uploads/newsimages/'); ?><?php echo $imgrow; ?>" />
</div>
<?php } ?>
</div>
First, try to print image path array. see if those are correct.
<?php
$multiimage=explode(",",$newsdetail[0]['image']);
print_r($multiimage);
?>
Then make sure those images are in the right directory.
Also for debugging purpos try printing the path if it's ok. you can check the image by simply putting the path on a browser URL.
<?php echo base_url('uploads/newsimages/').$imgrow ?>

why pagination in my wordpress theme is not showing (wp-paginate plugin)

I use the rethink theme in wordpress, and use the wp-paginate plugin
in arcive.php, category.php and index.php pagination is fine
but why in page.php not running?
and I created my own template showing all the posts
posting.php
<?php
/*
Template Name: posting
*/
get_header();
?>
<div class="full-content">
<div class="grid_17 alpha">
<div class="content_bar">
<div class="feature_content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$count_posts = wp_count_posts();
$published_posts = $count_posts->publish;
$myposts = get_posts(array('posts_per_page'=>3)); ;
foreach($myposts as $post) :
setup_postdata($post);
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('product'); ?>>
<div class="post-info">
<h1 class="product_title">
<a href= "<?php the_permalink(); ?>" rel="bookmark" title="<?php echo sprintf(__("Permanent link to %s", 'rethink'), get_the_title(get_the_ID())); ?>">
<?php the_title(); ?>
</a>
</h1>
<div class="detail">
<ul class="post_meta">
<li class="admin"><?php printf(__("Posted by %s", 'rethink'), get_the_author_link()); ?></li>
<li class="date"><?php printf(__('Posted on %s', 'rethink'), get_the_time('F j, Y')); ?></li>
<li class="category"><?php the_category(','); ?></li>
<li class="commentt"><?php comments_popup_link(__('No Comments.', 'rethink'), __('1 Comment.', 'rethink'), __('% Comments.', 'rethink')); ?></li>
</ul>
</div>
</div>
<div class="post_thumbnail_wrapper">
<?php if (has_post_thumbnail()) { ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('post_thumbnail', array('class' => 'postimg')); ?>
</a>
<?php
} else {
echo rethink_main_image();
}
?>
</div>
<div class="product_content"><?php the_excerpt(); ?><div class="buttons"><a class="btn-2" href="<?php the_permalink() ?>"><span><?php _e('Read Review', 'rethink') ?></span></a></div>
</div>
</div>
<?php endforeach;
if(function_exists('wp_paginate')){
wp_paginate(); }
wp_reset_postdata(); ?>
<div class="clear"></div>
<?php endwhile;
else:
?>
<div class="product">
<p>
<?php _e('Sorry, no posts matched your criteria.', 'rethink'); ?>
</p>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="grid_7 omega">
<!--Start Sidebar-->
<?php get_sidebar(); ?>
<!--End Sidebar-->
</div>
</div>
<?php get_footer(); ?>
how i want to display the pagination of my coding ????
sorry if the line of code is not neat I still newbie
Update this Code:
if(function_exists('wp_paginate')){
wp_paginate();
}
to this code:
if(function_exists('wp_paginate')){
wp_paginate(array('page' => 'page'));
}

gallery image not showing their order

I have an gallery.php file.It consist Albums and it's gallery images. My problem is when I click on Album image, Gallery images start to showing from images 4/4 then 3/4 and so on.
gallery.php
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/lightbox-plus-jquery.min.js"></script>
<div class="menu-port">
<div class="container">
<div class="menu-grid-main">
<?php
include("database/connection.php");
$result=mysql_query("SELECT * from Album_image where status='process'");
while ($row1= mysql_fetch_array($result)) {
?>
<div class="col-md-4 menu-grid wow bounceInDown" data-wow-delay="0.3s">
<?php
include("database/connection.php");
$result1=mysql_query("SELECT * from Gallery_image where aid=$row1[aid]");
while ($row2= mysql_fetch_array($result1)) {
?>
<a href="admin/gcatch//<?php echo $row2['image'] ?>" data-lightbox="<?php echo $row1['name']?>" >
<?php }?>
<img src="admin/acatch/<?php echo $row1['image'] ?>" alt="" class="img-responsive">
</a>
<h3><?php echo $row1['name']?></h3>
<p><?php echo $row1['des']?></p>
</div>
<?php }?>
<div class="clearfix"> </div>
</div>
</div>
</div>
I used lightbox effect to showing gallery images
Please anyone help me to showing image proper format
there is syntax issue. try this
<div class="menu-port">
<div class="container">
<div class="menu-grid-main">
<?php
include("database/connection.php");
$result=mysql_query("SELECT * from Album_image where status='process'");
while ($row1= mysql_fetch_array($result)) {
?>
<?php
include("database/connection.php");
$result1=mysql_query("SELECT * from Gallery_image where aid=$row1[aid]");
while ($row2= mysql_fetch_array($result1)) {
?>
<div class="col-md-4 menu-grid wow bounceInDown" data-wow-delay="0.3s">
<a href="admin/gcatch//<?php echo $row2['image'] ?>" data-lightbox="<?php echo $row1['name']?>" >
<img src="admin/acatch/<?php echo $row1['image'] ?>" alt="" class="img-responsive">
</a>
<h3><?php echo $row1['name']?></h3>
<p><?php echo $row1['des']?></p>
</div>
<?php }?>
<?php }?>
<div class="clearfix"> </div>
</div>
</div>
</div>
this query is better for fetch data
"SELECT * from Gallery_image where aid=$row1[aid] ORDER BY id DESC"
ordering result is best way to figure out what data in what order is fetching
REMEMBER : mysql_* functions (mysql_connect OR mysql_query) are deprecated ! you should use PDO or at least mysqli functions
here is some resource to learn PDO : PDO and mysqli
/ intro to PDO (laracast tutorial)

How Do I get lean modal js to show more than one modal in wordpress?

I have set up the modal for a team member page in WordPress as an advanced custom fields repeater field. That part works well, as it repeats and the modal opens up, but it only has the first team member's modal open up even though, it's another team member. My code is as follows:
<div class="leadership-row">
<?php
if ( get_field('leadership_block') ):
while( has_sub_field('leadership_block') ) :
?>
<div class="Leadership">
<a href="#teammember" rel="leanModal">
<div class="leadership-image">
<img src="<?php echo get_sub_field('leadership_image'); ?>" />
</div><!-- end of leadership-image -->
</a>
<div class="leadership-copy">
<h5 class="leadership-name"><?php echo get_sub_field('leadership_name'); ?></h5>
<h5 class="leadership-position"><?php echo get_sub_field('leadership_position'); ?></h5>
</div>
</div><!-- end of Leadership -->
<?php
endwhile;
endif;
?>
<?php
if ( get_field('team_modal') ):
while( has_sub_field('team_modal') ) :
?>
<div id="teammember">
<a class="modal_close"></a>
<div class="modal-image">
<img src="<?php echo get_sub_field('modal_image'); ?>" />
</div><!-- end of modal-image -->
<div class="modal-copy">
<h4><?php echo get_sub_field('modal_name'); ?></h4>
<p><?php echo get_sub_field('modal_position'); ?></p>
<img src="<?php echo get_sub_field('modal_icon'); ?>" />
<p><?php echo get_sub_field('modal_description'); ?></p>
</div><!-- end of modal-copy -->
</div><!-- end of teammember -->
<?php
endwhile;
endif;
?>
</div>
My JQuery is set up like this:
jQuery(document).ready(function($) {
$("a[rel*=leanModal]").leanModal({ top : 200, overlay : 0.4, closeButton: ".modal_close" });
});
Any help would be immensely appreciated.

opencart jcarousel on latest product

Right now I'm learning Opencart, and I'm trying to make my latest product display with jCarousel. I'm using Opencart 1.5.4.
This is what I've already tried, but still failed: http://www.packtpub.com/article/opencart-themes-using-jCarousel-plugin
I'm editing the latest.tpl file step-by-step as in the tutorial, but I'm getting stuck on the eight step.
When I open Firefox and hit refresh nothing happens, no error or message. This is my latest.tpl file:
<script type="text/javascript" src="catalog/view/javascript/jquery/jCarousel/js/jquery.jcarousel.min.js"></script>
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/jCarousel/skins/tango/skin.css" />
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#latestcarousel').jcarouseljcarousel();
});
</script>
<div class="box">
<div class="box-heading"><?php echo $heading_title; ?></div>
<div class="box-content">
<div id="latestcarousel" class="box-product">
<?php foreach ($products as $product) { ?>
<div class="jCarousel-skin-tango">
<?php if ($product['thumb']) { ?>
<div class="image"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></div>
<?php } ?>
<div class="name"><?php echo $product['name']; ?></div>
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['rating']) { ?>
<div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
<?php } ?>
<div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div>
</div>
<?php } ?>
</div>
</div>
</div>
Any suggestion?
This is what I do with latest.tpl file. It works now.
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/jCarousel/skins/tango/skin.css" />
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#latestcarousel').jcarousel({
scroll: 1,
visible: 3,
auto: 3,
rtl: true,
wrap: 'circular'
});
});
</script>
<div class="box">
<div class="box-heading"><?php echo $heading_title; ?></div>
<div class="box-content">
<div class="box-product">
<ul id="latestcarousel" class="jcarousel-skin-tango">
<?php foreach ($products as $product) { ?>
<li class="carousel-latest">
<div class="image"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></div>
<div class="name"><?php echo $product['name']; ?></div>
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
Thanks for anything.

Categories