database values not displaying in carousal in codeigniter php - php

i have a website in which i used carousel sliders to display images and its values, I have 3 carousel in my homepage, 3 of them have same code, however the first carousel is not displaying name and price like the 2nd and 3rd carousel:
as you can see in the image
the code for this carousel is below:
<section class="carousel_sec">
<div class="container">
<div class="row ">
<h3 class="carousel_heading">Trending Birthday Cakes <button class="pull-right"><span>VIEW ALL</span><!-- <span class="visible-xs">>></span> --></button></h3>
<hr>
<div class="carou">
<div class="demo">
<ul id="landing_products1">
<?php foreach($trending_products1 as $key=>$val) { ?>
<li>
<div class="item">
<div class="pad15 content_div">
<div class="carou_thumb">
<img class="st_img" src="<?php echo ADMIN_IMG.'cakes/'.$val['image'][0]['cake_image'];?>" alt="<?php echo $val['cake_name']; ?>" />
<img class="nd_img" src="<?php echo ADMIN_IMG.'cakes/'.$val['image'][0]['cake_image'];?>" alt="<?php echo $val['cake_name']; ?>" />
<p>
<?php echo $val['cake_name']; ?>
</p>
<?php
$btp_price=0;$offer_price=0;
$btp_price=$val['price'][0]['btp_price'];
$offer_price=$val['price'][0]['offer_price'];
?>
<div class="price text-center" style="width:100%;float:left;">
<span class="amount" style="color:#f2136e;font-size:14px;">
<?php echo PRICE_UNIT;?><?php echo $offer_price;?>
</span> (
<s> <?php echo $btp_price;?></s>)
<span> </span>
<br>
</div>
<!--<br><span><?php echo PRICE_UNIT;100; ?></span></p>-->
</div>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
</section>
<?php } ?>
while inspecting in browser the value is showing, the live URL is enter link description here
can anyone please tell me what could be wrong here, thanks in advance

You'll need to tweak the css to reveal the content that is hidden.
To push you in the direction, see the improvement with:
#landing_products1 {
height: 330px;
margin-top: -65px;
}
I don't know how responsive you need to be with your UI, so let's call this a temporary fix. The first carousel's dimensions don't perfectly match the others, so I'll leave the fine tuning to you.
It also appears that you have some js and css issues to mop up.

Related

How to structure title,images and button with css,html for online shop

I'm still learning to program and I have some issues with my layout.
I'm developing an online shop for clothes and accessories.
I want when the user opens a page with all items being looks like this:
The items have a very good structure.
Titles, images, and descriptions are looks very good.
Here is my layout:
My layout does not look very good. Titles, images, and descriptions are not in the same line.
I'm thinking that you understand what i want..
Here is my code:
<?php foreach($posts as $post) : ?>
<div class="col-xs-12 col-sm-6 col-md-4" >
<!-- <div class="gallery"> -->
<h4><?php echo word_limiter($post['title'],4); ?></h4>
<?php if($this->session->userdata('logged_in')) :?>
<small class="post-date">Posted on: <?php echo $post['created_at']; ?> in <strong><?php echo $post['name']; ?></strong></small>
<?php endif ?>
<div class="zoom-in">
<img class="post-thumb" width="500" height="300" src="<?php echo site_url(); ?>assets/images/posts/<?php echo $post['post_image']; ?>">
</div>
<!-- <?php echo word_limiter($post['body'],5); ?> -->
<b></b><br>
<input type="button" class="btn btn-danger addcart" productid="<?php echo $post['id'] ?>" value="Добави в количката">
<br><a style="color: black;"class="btn btn-link" href="<?php echo site_url('/posts/'.$post['slug']); ?>">Виж повече</a>
</div>
<?php endforeach; } ?>
Please help me how to fix this issue.
Thank you in advance!

How to make a button show on mobile

Good day everyone.
Just started working in Firm that has given me task to optimize their website (nigeria-friends(dot)com/staging.academix) responsively, which I have been doing gradually and am not all that proficient with PHP, HTML and CSS. But, I can confidently read and understand some couple of stuff in them. Thus;
I have been trying to center all the contents on the frontpage image banner
Reveal or make a particular button "How Academix can benefit you" appear on mobile devices of max-width:380px with no success and that has got me perplexed.
I have searched all through the CSS and couldn't get my head around any to fix it. Hence, me calling for help. And having looked into the index.html from the based folder I found something, the aforementioned buttons were in a loop sort of, which I don't understand.
Here is the index code:
<div class="col-sm-12 col-xs-10 col-centered">
<?php if(!isset($_SESSION["acc_identifier"])){ ?>
<!--
<div class="col-sm-4 col-centered">
<a href="<?php echo $URLMAIN; ?>/access/signup.html">
<div id="fb-login" class="social-login">
<div class="social-text">Sign up for free</div>
</div>
</a>
</div>
-->
<div class="col-sm-6 col-centered">
<a href="<?php echo $URLMAIN; ?>/about/benefits.html">
<div id="yahoo-login" class="social-login">
<div class="social-text">How <?php echo $web_shortName; ?> can benefit you</div>
</div>
</a>
</div>
<div class="col-sm-6 col-centered">
<a href="<?php echo $URLMAIN; ?>/access/host.html">
<div id="g-login" class="social-login">
<div class="social-text">Host your journal on <?php echo $web_shortName; ?></div>
</div>
</a>
</div>
<?php }else{ ?>
<div class="col-sm-6 col-centered">
<a href="<?php echo $URLMAIN; ?>/about/benefits.html">
<div id="yahoo-login" class="social-login">
<div class="social-text">How <?php echo $web_shortName; ?> can benefit you</div>
</div>
</a>
</div>
<div class="col-sm-6 col-centered">
<a href="<?php echo $URLMAIN; ?>/access/host.html">
<div id="g-login" class="social-login">
<div class="social-text">Host your journal on <?php echo $web_shortName; ?></div>
</div>
</a>
</div>
<?php } ?>
</div>
I can't paste in all the index.html code here as is quite long and length, which is generating error format when I try to, which is mixed php and html, where PHP starts the index.html. So also is the CSS file.
#media (min-width: 380px){
#yahoo-login .social-text {
display: none;
}
}
OR
#media (max-width: 380px){
#yahoo-login .social-text {
display: block;
}
}

Create Random image slideshow

i have a website live at the moment and the images desplay in sequence i want to add a little dynamics with the slider and make it so it randomly displays the images instead this is the basic code:
<div class="container slideshowContainer" style="width: 100%;">
<!-- BEGIN REVOLUTION SLIDER -->
<div class="fullwidthbanner-container slider-main margin-bottom-10">
<div class="fullwidthabnner">
<ul id="revolutionul" style="display:none;">
<!-- OUTPUT THE SLIDES -->
<?php
foreach($slides as $d){
?>
<li data-transition="fade" data-slotamount="8" data-masterspeed="700" data-delay="9400" data-thumb="assets/img/sliders/revolution/thumbs/thumb2.jpg">
<?php if($d['slideshow_image_sub_title_4'] != ""){ ?>
<a href="<?php echo $d['slideshow_image_sub_title_4']; ?>">
<img src="uploads/images/<?php echo $d['slideshow_image_file']; ?>" title="<?php echo $d['slideshow_image_title']; ?>" style="width: 100%;" />
</a>
<?php } else { ?>
<img src="uploads/images/<?php echo $d['slideshow_image_file']; ?>" title="<?php echo $d['slideshow_image_title']; ?>" style="width: 100%;" />
<?php } ?>
</li>
<?php
}
?>
</ul>
<div class="tp-bannertimer tp-bottom"></div>
</div>
</div>
<!-- END REVOLUTION SLIDER -->
</div>
how can i modify this to help randomly display images
please ask if i need to provide more info
Thanks in advance
Try this:
div class="container slideshowContainer" style="width: 100%;">
<!-- BEGIN REVOLUTION SLIDER -->
<div class="fullwidthbanner-container slider-main margin-bottom-10">
<div class="fullwidthabnner">
<ul id="revolutionul" style="display:none;">
<!-- OUTPUT THE SLIDES -->
<?php
shuffle($slides);
foreach($slides as $d){
?>
<li data-transition="fade" data-slotamount="8" data-masterspeed="700" data-delay="9400" data-thumb="assets/img/sliders/revolution/thumbs/thumb2.jpg">
<?php if($d['slideshow_image_sub_title_4'] != ""){ ?>
<a href="<?php echo $d['slideshow_image_sub_title_4']; ?>">
<img src="uploads/images/<?php echo $d['slideshow_image_file']; ?>" title="<?php echo $d['slideshow_image_title']; ?>" style="width: 100%;" />
</a>
<?php } else { ?>
<img src="uploads/images/<?php echo $d['slideshow_image_file']; ?>" title="<?php echo $d['slideshow_image_title']; ?>" style="width: 100%;" />
<?php } ?>
</li>
<?php
}
?>
</ul>
<div class="tp-bannertimer tp-bottom"></div>
</div>
</div>
<!-- END REVOLUTION SLIDER -->
</div>
http://php.net/manual/de/function.shuffle.php
I'm pretty sure there is a better answer than this, but the way I accomplish this is by naming the pictures using numbers, and using the following code to load them:
<img src="uploads/images/<?php.rand(1,9).".jpg";?>">
I hope this helps.

How to display images of products with respect to products id in codeigniter

I have 10 images of each brand and want to display brand by brand with there press releases images.
Example:
Product 1:
press release_image1,press release_image2,press release_image3 so on..
Product 2:
press release_image1,press release_image2,press release_image3 so on..
Product 3:
press release_image1,press release_image2,press release_image3 so on..
<?php foreach($press as $p){ ?>
<div class="header">
<h1 class=''>
<a href="<?php echo base_url('index.php/brand/view')."/".$p->brand_id;?>">
<?php
echo $p->brand_name;
?>
</a>
</h1>
</div>
<section id="portfolio-preview-items" class="row four-cols rows_1">
<?php //$row = $this->dashboard->get_press_release($id);
?>
<!-- Portfolio Normal Mode -->
<div class="portfolio-item design web-design v3" data-id="354" style="height: 475px; margin-bottom: 20px;">
<div class="he-wrap tpl2">
<a href="<?php echo base_url('assets/files/press_release') . '/' . $p->press_image; ?>" class="image-614" data-lightbox="event_img" data-title="<?php echo $p->press_title; ?>" >
<img style="cursor:pointer;" src="<?php echo base_url('assets/files/press_release') . '/' . $p->press_image; ?>" alt="">
</a>
<div class="shape4"></div>
<div class="he-view">
<div class="bg a0" data-animate="fadeIn">
<div class="center-bar v1">
<a href="<?php echo base_url('index.php/brand/view').'/'.$p->brand_id; ?>" class="link a0" data-animate="zoomIn">
<i class="moon-link-4"></i>
</a>
</div>
</div>
</div>
</div>
</div>
<!-- Portfolio Normal Mode End -->
</section>
<?php } ?>
You can combine id and particular images(concat by ',') from mysql query.
then in php code u can use explode and implode to display each images

Using PHP if and else statements to search multiple values in table

I am trying to get the following to happen:
if "field_ListingID" = h100 then show div x
or if "field_ListingID" = h200 then show same div x
Basically, within the same table1, I have 2 values "h100 "& "h200". I am able to pull just one value fine, but how do I pull if red or if blue.
Here is the code I have currently that is working for just one value. I tried placing the same php code for "h100" under the else statement, but that generated errors:
<?php if ($row["field_ListingID"]=="h100"){ ?>
<div class="featured-property">
<a href="#">
<div class="inner-logo"><img src="images/inner-logo.png" alt="LOGO" width="136" height="41" /></div>
<div class="bg-txt">
<div class="star-icon"></div>
<div class="txt"><p>Featured <span>Property</span></p></div>
</div>
</a>
</div>
<?php } else { ?>
<div style="margin-top: 20px; min-height:55px;"> </div>
<?php }?>
Thanks.
Here try this, I added the or operator (||) to your if statement:
<?php if ($row["field_ListingID"]=="h100" || $row["field_ListingID"]=="h200" ){ ?>
<div class="featured-property">
<a href="#">
<div class="inner-logo"><img src="images/inner-logo.png" alt="LOGO" width="136" height="41" /></div>
<div class="bg-txt">
<div class="star-icon"></div>
<div class="txt"><p>Featured <span>Property</span></p></div>
</div>
</a>
</div>
<?php } else { ?>
<div style="margin-top: 20px; min-height:55px;"> </div>
<?php }?>

Categories