i have pasted some two screen shoots of my database and how actually i want my web page to look. im trying to get this done but not getting how to solve the issue
i have stored all the images in folder and also the image path in the database, now i want to fetch the image in such a way that when i click the all works it should display all the images but when i click creative or photography or web development like this then it should show only those images which are related to their classes stored in database with type as column. alternatively for example if i click say creative then it should display 2nd, 3rd, 5th and 8th like this.i really don have any idea how to do this. please i really need help
//-----controller------
public function portfolio()
{
$this->load->helper('url');
$this->load->view('header');
$data['results'] = $this->Contact_model->getAllRecords3();
$this->load->view('portfolio',$data);
$this->load->view('footer');
}
//--------model-----
function getAllRecords3()
{
return $this->db->get('portfolio1')->result();
}
//-------view---------
<section id="portfolio">
<div class="container">
<div class="center">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor incididunt</p>
</div>
<ul class="portfolio-filter text-center">
<li><a class="btn btn-default active" href="#" data-filter="*">All Works</a></li>
<li><a class="btn btn-default" href="#" data-filter=".bootstrap">Creative</a></li>
<li><a class="btn btn-default" href="#" data-filter=".html">Photography</a></li>
<li><a class="btn btn-default" href="#" data-filter=".wordpress">Web Development</a></li>
</ul>
<!--/#portfolio-filter-->
</div>
<div class="container">
<div class="">
<div class="portfolio-items">
<?php
if( !empty($results) ) {
foreach($results as $row) {?>
<div class="portfolio-item apps joomla col-xs-12 col-sm-4 col-md-3">
<div class="recent-work-wrap">
<img class="img-responsive" src="<?php echo base_url('uploads/'.$row->filename);?>" alt="">
<div class="overlay">
<div class="recent-work-inner">
<h3><?php echo $row->first_content; ?></h3>
<p><?php echo $row->second_content; ?></p>
<a class="preview" href="<?php echo base_url('uploads/'.$row->filename);?>" rel="prettyPhoto"><i class="fa fa-eye"></i> View</a>
</div>
</div>
</div>
</div>
<?php
} ?>
<?php }
?>
</div>
</div>
</div>
</section>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="<?php echo base_url(); ?>js/jquery-2.1.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="<?php echo base_url(); ?>js/bootstrap.min.js"></script>
<script src="<?php echo base_url(); ?>js/jquery.prettyPhoto.js"></script>
<script src="<?php echo base_url(); ?>js/jquery.isotope.min.js"></script>
<script src="<?php echo base_url(); ?>js/wow.min.js"></script>
<script src="<?php echo base_url(); ?>js/functions.js"></script>
Please try below solution.
You have missed dynamic classes adding in div like apps and joomla
<div class="portfolio-item apps joomla col-xs-12 col-sm-4 col-md-3">
added class in above line with your existing code
<?php
foreach($results as $row) {
//code for getting dynamic class names from db
$class = explode(",.", $row->type);
$gettypes = implode(" ", $class);
?>
<div class="portfolio-item <?php echo $gettypes;?> col-xs-12 col-sm-4 col-md-3">
Hope this work!
U have included jquery.isotope.min.js library u need to follow following documentation
https://isotope.metafizzy.co/
$grid.isotope({ filter: '.transition' })
also change to following view code
<div class="portfolio-item <?php echo $gettypes;?> col-xs-12 col-sm-4 col-md-3">
Related
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;
}
}
I am doing a project in codeigniter 3.3(latest version). Is there any method/function that is related to skip while inside the foreach? For example, I have 5 data in my table(ofcourse you need to use foreach in view to get all the data). The 3 images will be display on the top part and the last 2 will be display in the bottom part, is it possible
View
<div class="container-fluid proj-bottom">
<div class="row">
<?php foreach($getContent as $content){ if($content->id=="1"){ skip();}?>
<div class="col-md-4 col-sm-6 fh5co-project animate-box" data-animate-effect="fadeIn">
<?=$content->id?>
<a href="#fly" data-toggle="modal" data-animation="animated zoomInRight" ><img src="<?= base_url() .'uploaded/'. $content->img_path?>" alt="Free HTML5 Website Template by FreeHTML5.co" class="img-responsive">
<h3>Fly</h3>
<span>View</span>
</a>
</div>
<?php } ?>
</div>
</div>
You can use continue:
<div class="container-fluid proj-bottom">
<div class="row">
<?php foreach($getContent as $content){ if($content->id=="1"){ skip();}?>
<div class="col-md-4 col-sm-6 fh5co-project animate-box" data-animate-effect="fadeIn">
<?=$content->id?>
<a href="#fly" data-toggle="modal" data-animation="animated zoomInRight" ><img src="<?= base_url() .'uploaded/'. $content->img_path?>" alt="Free HTML5 Website Template by FreeHTML5.co" class="img-responsive">
<h3>Fly</h3>
<span>View</span>
</a>
</div>
<?php } ?>
</div>
</div>
The continue (Manual reference) will skip the current loop and go for the next record if it exists.
The break (Manual reference) will skip and quit the loop.
I am attempting to install the masonry.js library into my website.
But no matter what I add/remove, Masonry just doesn't appear to align anything on the webpage.
This is my code:
<script>
var $grid = $('.grid').masonry({
// options...
});
// layout Masonry after each image loads
$grid.imagesLoaded().progress( function() {
$grid.masonry('layout');
});
</script>
And my HTML/PHP
<div class="container">
<div class="grid">
<div id="row" >
<?php foreach ($pages as $page): ?>
<div class="col-md-4 col-sm-6">
<div class="panel panel-default">
<div class="panel-body">
<div class="grid-item"><a href="<?php echo BASE_URL; ?>/page.php?page=<?php echo $page['slug']; ?>"><img alt="Article Image" class="img-responsive" src="<?php echo BASE_URL;?><?php echo $page['image']; ?>"></div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
Any assistance at all would be greatly appreciated, I've gone through several articles about installing Masonry with Bootstrap, but no matter what I attempt, it still refuses to align
http://imgur.com/C0nyUYq
Modified
<div class="grid">
To
<div class="grid js-masonry">
Which has now done the trick. :)
I trying to produce a dynamic carousel banner to update the image, headers, text, links & alts based on the content page being viewed.
The site is being coded in .php & using the bootstrap CSS framework. I've broken the site into three main parts... Header, "Content" and Footer.
I'm calling the function img-banner as part of the header.php but wish to use variables stored in the "content" pages which will determine the images etc being viewed.
Calling the function:
<div class="img-banner">
<?php include ("functions/img-banner.php"); ?>
<!-- closing img-banner -->
</div>
The function:
<?php
function img_banner()
{
?>
<div class="carousel-inner">
<div class="item active"> <img src="<?php echo $img1;?>" alt="<?php echo $alt1;?>">
<div class="container">
<div class="carousel-caption">
<h1><?php echo $head1;?></h1>
<p><?php echo $text1;?></p>
<p><a class="btn btn-lg btn-primary" href="<?php echo $link1;?>" role="button">Learn More<i class="fa fa-chevron-details"></i></a></p>
</div>
</div>
</div>
<div class="item"> <img src="<?php echo $img2;?>" alt="<?php echo $alt2;?>">
<div class="container">
<div class="carousel-caption">
<h1><?php echo $head2;?></h1>
<p><?php echo $text2;?></p>
<p><a class="btn btn-lg btn-primary" href="<?php echo $link2;?>" role="button">Learn More<i class="fa fa-chevron-right"></i></a></p>
</div>
</div>
</div>
<div class="item"> <img src="<?php echo $img3;?>" alt="<?php echo $alt3;?>">
<div class="container">
<div class="carousel-caption">
<h1><?php echo $head3;?></h1>
<p><?php echo $text3;?></p>
<p><a class="btn btn-lg btn-primary" href="<?php echo $link3;?>" role="button">Learn More<i class="fa fa-chevron-right"></i></a></p>
</div>
</div>
</div>
</div>
<?php
}
?>
I'm a little stumped and have tried (obviously unsuccessfully lol) global and SESSION variables but cant get them to work correctly.
I'd appreciate confirmation on the best method to implement the above so I can read up and figure this out. My main goal is to have a cms style admin panel to update the images.
Thanks!
First of all, the function does not have access to the $img1-$img3 variables as you're not passing them to the function.
Secondly, you really do not require a function to do this simple task.
Last but not least, you are not even calling the function, only including it's file.
Here's how you should do this:
<div class="img-banner">
<?php include ("img-banner.php"); ?>
<!-- closing img-banner -->
</div>
And the img-banner.php:
<div class="carousel-inner">
<div class="item active"> <img src="<?php echo $img1;?>" alt="<?php echo $alt1;?>">
<div class="container">
<div class="carousel-caption">
<h1><?php echo $head1;?></h1>
<p><?php echo $text1;?></p>
<p><a class="btn btn-lg btn-primary" href="<?php echo $link1;?>" role="button">Learn More<i class="fa fa-chevron-details"></i></a></p>
</div>
</div>
</div>
<div class="item"> <img src="<?php echo $img2;?>" alt="<?php echo $alt2;?>">
<div class="container">
<div class="carousel-caption">
<h1><?php echo $head2;?></h1>
<p><?php echo $text2;?></p>
<p><a class="btn btn-lg btn-primary" href="<?php echo $link2;?>" role="button">Learn More<i class="fa fa-chevron-right"></i></a></p>
</div>
</div>
</div>
<div class="item"> <img src="<?php echo $img3;?>" alt="<?php echo $alt3;?>">
<div class="container">
<div class="carousel-caption">
<h1><?php echo $head3;?></h1>
<p><?php echo $text3;?></p>
<p><a class="btn btn-lg btn-primary" href="<?php echo $link3;?>" role="button">Learn More<i class="fa fa-chevron-right"></i></a></p>
</div>
</div>
</div>
</div>
My javascript code for slider is as follows which is displayed in the
html format but not displayed when I integrated it into a theme.This code is in header.php.I have called all the requred js css and image files in it and that worked fine but the problem is in slider portion.
Code in header.php
<script type="text/javascript">
$(window).load(function() {
$('.flexslider').flexslider({
animation: "slide",
useCSS: Modernizr.touch
});
});
</script>
Code in index.php
<div class="flexslider">
<ul class="slides">
<li>
<div class="hero-unit">
<h1>Affordable Hosting Solution</h1>
<h3>Flathost is a bootstrap based responsive minimal, flat and afforable
hosting template with easy customization and great support</h3>
<div class="slider-actions text-center"> <a href="features.html" class="btn
btn-success btn-lg">Explore Features </a> <a href="pricing.html" class="btn
btn-primary btn-lg">Plans and Pricing </a> </div>
</div>
</li>
<li>
<div class="slide2">
<p><img src="<?php echo get_template_directory_uri(); ?
>/images/server1.png" alt="server" class="img-responsive center-block"></p>
<h1>Dedicated and VIP Hosting</h1>
</div>
</li>
<li>
<div class="slide3">
<p class="pull-left"><img src="<?php echo get_template_directory_uri(); ?
>/images/server2.png" alt="server" class="img-responsive"></p>
<h1>Managed Hosting</h1>
<h3>Flathost is a bootstrap based responsive minimal, flat and afforable
hosting template with easy customization and great support </h3>
</div>
</li>
</ul>
</div>
</div>
</div>
<?php echo do_shortcode('[thethe-image-slider name="flexslider"]'); ?>