Div not wrapping around all items in a loop - php

I got 2 sections on a page. You can see it here: http://www.equitasmg.com/who-we-are-2/
Both sections have a <div> wrapped around them, but the first section "Our Leadership" seems to not like the <div>. The <div> wraps around the first item in the section but does not wrap around all the items.
Here is the PHP for both sections.
First section
<center><h2>Our Leadership</h2></center>
<center><div>
<?php
$people= get_field('people');
$a=0;
foreach ($people as $r) {
$a++;
?>
<div class="people">
<img src="<?php echo $r['image']['sizes']['team'];?>" style="max-width:750px !important;width:100%;">
<h3>
<?php echo $r['name'];?>
</h3>
<div class="position">
<h4><?php echo $r['position'];?></h4>
</div>
<?php echo $r['intro_text'];?>
<?php if ($r[ 'learn_more_text']) { ?>
Learn More
<?php } ?>
<?php if ($r[ 'learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name'] );?>" class="reveal-modal medium" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h3><?php echo $r['name'];?></h3>
<div class="position">
<?php echo $r['position'];?>
</div>
<div class="content">
<?php echo $r['learn_more_text'];?>
</div>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
</div></center>
<div style="clear:both;"></div>
Second section
<center><h2>Our Team</h2></center>
<center><div>
<?php
$people2= get_field('people_bottomsection');
$a=0;
foreach ($people2 as $r) {
$a++;
?>
<div class="people">
<img src="<?php echo $r['image']['sizes']['team'];?>" style="max-width:750px !important;width:100%;">
<h3>
<?php echo $r['name'];?>
</h3>
<div class="position">
<h4><?php echo $r['position'];?></h4>
</div>
<?php echo $r['intro_text'];?>
<?php if ($r[ 'learn_more_text']) { ?>
Learn More
<?php } ?>
<?php if ($r[ 'learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name'] );?>" class="reveal-modal medium" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h3><?php echo $r['name'];?></h3>
<div class="position">
<?php echo $r['position'];?>
</div>
<div class="content">
<?php echo $r['learn_more_text'];?>
</div>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
</div></center>
<div style="clear:both;"></div>

You just got extra div.
First section you got extra div here
<center><h2>Our Leadership</h2></center>
<center>
<div>
<?php
$people= get_field('people');
$a=0;
foreach ($people as $r) {
$a++;
?>
<div class="people">
<img src="<?php echo $r['image']['sizes']['team'];?>" style="max-width:750px !important;width:100%;">
<h3>
<?php echo $r['name'];?>
</h3>
<div class="position">
<h4><?php echo $r['position'];?></h4>
</div>
<?php echo $r['intro_text'];?>
<?php if ($r[ 'learn_more_text']) { ?>
Learn More
<?php } ?>
<?php if ($r[ 'learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name'] );?>" class="reveal-modal medium" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h3><?php echo $r['name'];?></h3>
<div class="position">
<?php echo $r['position'];?>
</div>
<div class="content">
<?php echo $r['learn_more_text'];?>
</div>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
<!-- </div> --> //extra div here
<?php } ?>
</div>
<?php } ?> //end of foreach
</div>
</center>
<div style="clear:both;"></div>
second section
<center><h2>Our Team</h2></center>
<center>
<div>
<?php
$people2= get_field('people_bottomsection');
$a=0;
foreach ($people2 as $r) {
$a++;
?>
<div class="people">
<img src="<?php echo $r['image']['sizes']['team'];?>" style="max-width:750px !important;width:100%;">
<h3>
<?php echo $r['name'];?>
</h3>
<div class="position">
<h4><?php echo $r['position'];?></h4>
</div>
<?php echo $r['intro_text'];?>
<?php if ($r[ 'learn_more_text']) { ?>
Learn More
<?php } ?>
<?php if ($r[ 'learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name'] );?>" class="reveal-modal medium" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h3><?php echo $r['name'];?></h3>
<div class="position">
<?php echo $r['position'];?>
</div>
<div class="content">
<?php echo $r['learn_more_text'];?>
</div>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
<!-- </div> --> //extra div
<?php } ?>
</div>
<?php } ?>
</div>
</center>

Related

PHP Loop executing on top of each other

It should be like this:
<div> code here </div>
<div> code here </div>
<div> code here </div>
Each div looping right after the other. Instead, it is executing like this:
<div> code here </div>
<div> code here </div>
<div> code here </div>
Page I am working on: http://www.equitasmg.com/who-we-are-2/
The images are not aligned (should be in a row).
Here's the PHP:
<center><h2>Our Leadership</h2></center>
<?php
$people= get_field('people');
$a=0;
foreach ($people as $r) {
$a++;
?>
<div style="float:left;width:30%;padding:30px;">
<img src="<?php echo $r['image']['sizes']['team'];?>" style="max-width:750px !important;width:250px;">
<h3>
<?php echo $r['name'];?>
</h3>
<div class="position">
<?php echo $r['position'];?>
</div>
<?php echo $r['intro_text'];?>
<?php if ($r[ 'learn_more_text']) { ?>
Learn More
<?php } ?>
<?php if ($r[ 'learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name'] );?>" class="reveal-modal medium" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h3><?php echo $r['name'];?></h3>
<div class="position">
<?php echo $r['position'];?>
</div>
<div class="content">
<?php echo $r['learn_more_text'];?>
</div>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
</div>
<?php } ?>
<?php } ?>
Here is the problem one div should between closing php tag
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
<?php } ?>
</div>
<?php } ?>
You don't need to float every div in loop just add a div before loop and float that div to left.
remove floating Style within loop.. here is your clean code.
JS BIN
<div style="float:left;width:30%;padding:30px;">
<?php
$people= get_field('people');
$a=0;
foreach ($people as $r) {
$a++;
?>
<div style="">
<img src="<?php echo $r['image']['sizes']['team'];?>" style="max-width:750px !important;width:250px;">
<h3>
<?php echo $r['name'];?>
</h3>
<div class="position">
<?php echo $r['position'];?>
</div>
<?php echo $r['intro_text'];?>
<?php if ($r[ 'learn_more_text']) { ?>
Learn More
<?php } ?>
<?php if ($r[ 'learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name'] );?>" class="reveal-modal medium" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h3><?php echo $r['name'];?></h3>
<div class="position">
<?php echo $r['position'];?>
</div>
<div class="content">
<?php echo $r['learn_more_text'];?>
</div>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
</div>
<?php } ?>
<?php } ?>
<div style="clear:both;"></div>
</div>

Image height not working on php loop

Here's the div that manages the look of each item in the loop:
<div style="float:left;width:30%;padding:30px;height:auto;">
<img src="<?php echo $r['image']['sizes']['team']; ?>" style="max-width:750px !important;width:100%;">
<h3>
<?php echo $r['name']; ?>
</h3>
<div class="position">
<?php echo $r['position']; ?>
</div>
<?php echo $r['intro_text']; ?>
<?php if ($r['learn_more_text']) { ?>
Learn More
<?php } ?>
<?php if ($r['learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name']); ?>" class="reveal-modal medium" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h3><?php echo $r['name']; ?></h3>
<div class="position">
<?php echo $r['position']; ?>
</div>
<div class="content">
<?php echo $r['learn_more_text']; ?>
</div>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
</div>
If I set the height to a fixed number (eg: 450x), the images are aligned in a row. But that will make the page non mobile responsive. If I set the height to auto or to a percentage like 30%, the images become mobile responsive but they don't align. I get 2 images that separate into different rows.
Also, I got 2 sections of image. One is called Our Leadership and the other is called Our Team. The section at the bottom is aligned correctly and is contained in a div. The div above it refuses to be contained in a div. If I wrap it in a div, Only the first item wraps itself in the div. I've no idea why.
eg:
<center>
<div>
<div>first item here</div>
</div>
<div>second item here</div>
<div>third item here</div>
<div>fourth item here</div>
Here's the complete code for both sections:
<center><h2>Our Leadership</h2></center>
<center><div>
<?php
$people = get_field('people');
$a = 0;
foreach ($people as $r) {
$a++;
?>
<div style="float:left;width:30%;padding:30px;height:auto;">
<img src="<?php echo $r['image']['sizes']['team']; ?>" style="max-width:750px !important;width:100%;">
<h3>
<?php echo $r['name']; ?>
</h3>
<div class="position">
<?php echo $r['position']; ?>
</div>
<?php echo $r['intro_text']; ?>
<?php if ($r['learn_more_text']) { ?>
Learn More
<?php } ?>
<?php if ($r['learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name']); ?>" class="reveal-modal medium" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h3><?php echo $r['name']; ?></h3>
<div class="position">
<?php echo $r['position']; ?>
</div>
<div class="content">
<?php echo $r['learn_more_text']; ?>
</div>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
</div></center>
<div style="clear:both;"></div>
<center><h2>Our Team</h2></center>
<center><div>
<?php
$people2 = get_field('people_bottomsection');
$a = 0;
foreach ($people2 as $r) {
$a++;
?>
<div style="float:left;width:30%;padding:30px;height:auto;">
<img src="<?php echo $r['image']['sizes']['team']; ?>" style="max-width:750px !important;width:100%;">
<h3>
<?php echo $r['name']; ?>
</h3>
<div class="position">
<?php echo $r['position']; ?>
</div>
<?php echo $r['intro_text']; ?>
<?php if ($r['learn_more_text']) { ?>
Learn More
<?php } ?>
<?php if ($r['learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name']); ?>" class="reveal-modal medium" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h3><?php echo $r['name']; ?></h3>
<div class="position">
<?php echo $r['position']; ?>
</div>
<div class="content">
<?php echo $r['learn_more_text']; ?>
</div>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
</div></center>
<div style="clear:both;"></div>
Check out the source code at: http://www.equitasmg.com/who-we-are-2/
it's because the items in the loop are having different height. So, try adding a constant height to each item in the loop.
Eg:
<div style="float:left;width:30%;padding:30px;min-height:550px;"></div>

Search results form to show another page

I am using a Vebra plugin on Wordpress, they use shortcodes to show a search area and a shortcode to show the results.
I have my homepage (http://lytham.voodoodev4.co.uk/) using the "search" shortcode, my "properties" shortcode is on http://lytham.voodoodev4.co.uk/?page_id=33
When I search on the page it just refreshes the page, how do I push the search results to that page?
Search php:
<div id="propertyFilter" class="vp_search">
<form action="<?php echo vp_get_search_link()?>" method="GET">
<?php vp_hidden_fields(); ?>
<div class="property_refine">Refine your search:</div>
<div class="property_type">
<?php vp_get_areas(); ?>
</div>
<div class="property_search_group">
<p>Minimum number of bedrooms</p>
<?php vp_get_bedrooms(); ?>
</div>
<div class="property_search_group vp_price">
<p>Minimum price of property</p>
<?php vp_get_minprice(); ?>
</div>
<div class="property_search_group vp_price">
<p>Maximum price of property</p>
<?php vp_get_maxprice(); ?>
</div>
<div class="property_search_group vp_rent">
<p>Minimum rent for property</p>
<?php vp_get_minrent(); ?>
</div>
<div class="property_search_group vp_rent">
<p>Maximum rent for property</p>
<?php vp_get_maxrent(); ?>
</div>
<div class="property_search_group vp_commercial">
<p>Min Area (sqft)</p>
<?php vp_get_minarea(); ?>
</div>
<div class="property_search_group vp_commercial">
<p>Max Area (sqft)</p>
<?php vp_get_maxarea(); ?>
</div>
<div class="property_search_group">
<p>Type of property</p>
<?php vp_get_property_types(); ?>
</div>
<div class="property_search_group">
<p>Location</p>
<input type="text" id="vp_location" name="vp_location" placeholder="Enter postcode or place name" value="<?php vp_get_location(); ?>" />
</div>
<div class="property_search_group">
<p>Search</p>
<?php vp_get_radius(); ?>
</div>
<input class="submit" type="submit" value="Search" />
</form>
</div>
Properties results PHP:
<div id="propertyResults">
<?php echo vp_list_head();
if ($properties=vp_theproperties()) {
switch (vp_get_view()) {
case "list": ?>
<div id="propertyListView">
<div id="propertyOrdering" class="clearfix">
<div id="orderBy">
<span id="vp_order_message">Order by:</span>
<?php vp_get_orderby(); ?>
View Map
</div>
</div>
<div class="clearfix">
<?php foreach ($properties as $property) { ?>
<div class="property">
<div class="left_column">
<div class="property_image">
<a class="property_overview_thumb" href="<?php echo vp_propertyurl($property->vebraid); ?>" title="<?php echo $property->address_custom; ?>">
<?php echo vp_propertyimage($property->vebraid,0,"property_image"); ?>
</a>
<div class="property_tagline"><?php echo $property->web_status; ?></div>
</div>
</div>
<div class="right_column">
<div class="property_summary">
<h3 class="property_title">
<span><?php echo $property->address_custom; ?> <?php echo $property->property_type; ?></span>
</h3>
<h4 class="property_address"><?php echo $property->address_display; ?></h4>
<div class="property_excerpt"><?php echo $property->excerpt; ?></div>
</div>
</div>
<div class="property_features clearfix">
<?php if ($property->area == "Commercial") {
if (!empty($property->propertyarea_sqft)) {?>
<span class="property_area"><?php echo $property->propertyarea_sqft; ?> sqft</span>
<?php } ?>
<?php } else {?>
<span class="property_beds"><?php echo $property->bedrooms; ?> Bedrooms</span>
<span class="property_baths"><?php echo $property->bathrooms; ?> Bathrooms</span>
<?php } ?>
<div class="property_price">£<?php echo number_format($property->price,0,"",","); ?> <?php echo $property->price_postfix; ?>View Details<?php do_action('vp_other_action_buttons',$property->vebraid,'button property_button') ?></div>
</div>
</div>
<?php } ?>
</div>
<div class="properties-paging">
<ul>
<?php if (vp_current_page() > 1) { ?>
<li>< Previous</li>
<?php } ?>
<li>Page <?php echo vp_current_page(); ?> of <?php echo vp_page_count(); ?></li>
<?php if (vp_current_page() < vp_page_count()) { ?>
<li>> Next</li>
<?php } ?>
</ul>
</div>
</div>
<?php
break;
case "map":?>
<div id="propertyMapView">
<div id="propertyOrdering" class="clearfix">
<div id="orderBy">
View List
</div>
</div>
<?php vp_map_markers($properties); ?>
<div id="vp-map" style="width: 100%; height: 550px;"></div>
</div>
<?php
break;
case "featured": ?>
<?php foreach ($properties as $property) { ?>
<div class="property">
<div class="left_column">
<div class="property_tagline badge_<?php echo str_replace(" ","_",$property->web_status); ?>"></div>
<div class="property_image">
<a class="property_overview_thumb" href="<?php echo vp_propertyurl($property->vebraid); ?>" title="<?php echo $property->address_name; ?>">
<?php echo vp_propertyimage($property->vebraid,0,"property_image"); ?>
</a>
</div>
</div>
<div class="right_column">
<ul class="property_summary">
<li class="property_title">
<?php echo $property->address_custom; ?><span><?php echo $property->property_type; ?></span>
</li>
<li class="property_address"><?php echo $property->address_display; ?></li>
<li class="property_price">£<?php echo number_format($property->price,0,"",","); ?> <?php echo $property->price_postfix; ?></li>
</ul>
<div class="buttons clearfix">
View Details
</div>
</div>
</div>
<?php } ?>
<?php
break;
}
} else { ?>
<p>No matching properties found. Please try alternative search criteria.</p>
<?php } ?>
<?php echo vp_list_footer();?>
</div>
SOLVED:
In the vp-search.php I changed:
<form action="<?php echo vp_get_search_link()?>" method="GET">
to
<form action="<?php echo vp_get_search_link()?>/property-results/" method="GET">
Obviously replace /property-results/ for the page that has the properties shortcode in it :)

Foreach is only calling the last item in the list

I don't really think knowledge of OpenCart would help too much with answering this question, but maybe I am wrong.
I am using OpenCart to make a shop. I am making edits to my categories.tpl page, and everything was looking good. I only had one product when I was doing the edits so it was normal that it was only showing one product. Before I did the edits, I did check the same page with many of the products you start with and it was working fine.
Here is my code right now, which is only calling the last product (I'm guessing item in an array or in a SQL sheet)
<?php echo $header; ?>
<div class="container">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<?php } ?>
<div class="row"><?php echo $column_left; ?>
<?php if ($column_left && $column_right) { ?>
<?php $class = 'col-sm-6'; ?>
<?php } elseif ($column_left || $column_right) { ?>
<?php $class = 'col-sm-9'; ?>
<?php } else { ?>
<?php $class = 'col-sm-12'; ?>
<?php } ?>
<div id="content" class="<?php echo $class; ?>"><?php echo $content_top; ?>
<?php if ($thumb || $description) { ?>
<div class="row">
<?php if ($thumb) { ?>
<?php } ?>
<?php if ($description) { ?><?php } ?>
</div>
<hr>
<?php } ?>
<?php if ($categories) { ?>
<h3><?php echo $text_refine; ?></h3>
<?php if (count($categories) <= 5) { ?>
<div class="row">
<div class="col-sm-3">
</div>
<?php }
?>
<?php } ?>
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-2 text-right">
</div>
<div class="col-md-3 text-right">
<button type="button" id="grid-view" style="display: none;"></button>
</div>
</div><br />
<div class="row">
<?php foreach ($products as $product) { ?>
<div class="product-layout product-list col-xs-12">
<div class="product-thumb">
<div class="image"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></div>
<div>
<div class="caption">
<h4><?php echo $product['name']; ?></h4>
<p><?php echo $product['description']; ?></p>
<?php if ($product['rating']) { ?>
<div class="rating">
<?php for ($i = 1; $i <= 5; $i++) { ?>
<?php if ($product['rating'] < $i) { ?>
<span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
<?php } else { ?>
<span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['price']) { ?>
<p class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
<?php } ?>
</p>
<?php } ?>
</div>
<div class="button-group">
<button style="width:100%;" type="button" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 text-left"><?php echo $pagination; ?></div>
<div class="col-sm-6 text-right"><?php echo $results; ?></div>
</div>
<?php } ?>
<?php if (!$categories && !$products) { ?>
<p><?php echo $text_empty; ?></p>
<div class="buttons">
<div class="pull-right"><?php echo $button_continue; ?></div>
</div>
<?php } ?>
<?php echo $content_bottom; ?></div>
<?php echo $column_right; ?></div>
</div>
<?php echo $footer; ?>
And here is the code I started with, which worked correctly.
<?php echo $header; ?>
<div class="container">
<ul class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<li><?php echo $breadcrumb['text']; ?></li>
<?php } ?>
</ul>
<div class="row"><?php echo $column_left; ?>
<?php if ($column_left && $column_right) { ?>
<?php $class = 'col-sm-6'; ?>
<?php } elseif ($column_left || $column_right) { ?>
<?php $class = 'col-sm-9'; ?>
<?php } else { ?>
<?php $class = 'col-sm-12'; ?>
<?php } ?>
<div id="content" class="<?php echo $class; ?>"><?php echo $content_top; ?>
<h2><?php echo $heading_title; ?></h2>
<?php if ($thumb || $description) { ?>
<div class="row">
<?php if ($thumb) { ?>
<div class="col-sm-2"><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ?>" title="<?php echo $heading_title; ?>" class="img-thumbnail" /></div>
<?php } ?>
<?php if ($description) { ?>
<div class="col-sm-10"><?php echo $description; ?></div>
<?php } ?>
</div>
<hr>
<?php } ?>
<?php if ($categories) { ?>
<h3><?php echo $text_refine; ?></h3>
<?php if (count($categories) <= 5) { ?>
<div class="row">
<div class="col-sm-3">
<ul>
<?php foreach ($categories as $category) { ?>
<li><?php echo $category['name']; ?></li>
<?php } ?>
</ul>
</div>
</div>
<?php } else { ?>
<div class="row">
<?php foreach (array_chunk($categories, ceil(count($categories) / 4)) as $categories) { ?>
<div class="col-sm-3">
<ul>
<?php foreach ($categories as $category) { ?>
<li><?php echo $category['name']; ?></li>
<?php } ?>
</ul>
</div>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
<?php if ($products) { ?>
<p><?php echo $text_compare; ?></p>
<div class="row">
<div class="col-md-4">
<div class="btn-group hidden-xs">
<button type="button" id="list-view" class="btn btn-default" data-toggle="tooltip" title="<?php echo $button_list; ?>"><i class="fa fa-th-list"></i></button>
<button type="button" id="grid-view" class="btn btn-default" data-toggle="tooltip" title="<?php echo $button_grid; ?>"><i class="fa fa-th"></i></button>
</div>
</div>
<div class="col-md-2 text-right">
<label class="control-label" for="input-sort"><?php echo $text_sort; ?></label>
</div>
<div class="col-md-3 text-right">
<select id="input-sort" class="form-control" onchange="location = this.value;">
<?php foreach ($sorts as $sorts) { ?>
<?php if ($sorts['value'] == $sort . '-' . $order) { ?>
<option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
<?php } else { ?>
<option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="col-md-1 text-right">
<label class="control-label" for="input-limit"><?php echo $text_limit; ?></label>
</div>
<div class="col-md-2 text-right">
<select id="input-limit" class="form-control" onchange="location = this.value;">
<?php foreach ($limits as $limits) { ?>
<?php if ($limits['value'] == $limit) { ?>
<option value="<?php echo $limits['href']; ?>" selected="selected"><?php echo $limits['text']; ?></option>
<?php } else { ?>
<option value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
</div>
<br />
<div class="row">
<?php foreach ($products as $product) { ?>
<div class="product-layout product-list col-xs-12">
<div class="product-thumb">
<div class="image"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></div>
<div>
<div class="caption">
<h4><?php echo $product['name']; ?></h4>
<p><?php echo $product['description']; ?></p>
<?php if ($product['rating']) { ?>
<div class="rating">
<?php for ($i = 1; $i <= 5; $i++) { ?>
<?php if ($product['rating'] < $i) { ?>
<span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
<?php } else { ?>
<span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['price']) { ?>
<p class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
<?php } ?>
<?php if ($product['tax']) { ?>
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
<?php } ?>
</p>
<?php } ?>
</div>
<div class="button-group">
<button type="button" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>
<button type="button" data-toggle="tooltip" title="<?php echo $button_wishlist; ?>" onclick="wishlist.add('<?php echo $product['product_id']; ?>');"><i class="fa fa-heart"></i></button>
<button type="button" data-toggle="tooltip" title="<?php echo $button_compare; ?>" onclick="compare.add('<?php echo $product['product_id']; ?>');"><i class="fa fa-exchange"></i></button>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
<div class="row">
<div class="col-sm-6 text-left"><?php echo $pagination; ?></div>
<div class="col-sm-6 text-right"><?php echo $results; ?></div>
</div>
<?php } ?>
<?php if (!$categories && !$products) { ?>
<p><?php echo $text_empty; ?></p>
<div class="buttons">
<div class="pull-right"><?php echo $button_continue; ?></div>
</div>
<?php } ?>
<?php echo $content_bottom; ?></div>
<?php echo $column_right; ?></div>
</div>
<?php echo $footer; ?>
Thanks in advance for anyone who could try and figure out why it is not working.
Here, have not add properly close tag for foreach php loop.
Try following code in your editing file.
<?php echo $header; ?>
<div class="container">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<?php } ?>
<div class="row"><?php echo $column_left; ?>
<?php if ($column_left && $column_right) { ?>
<?php $class = 'col-sm-6'; ?>
<?php } elseif ($column_left || $column_right) { ?>
<?php $class = 'col-sm-9'; ?>
<?php } else { ?>
<?php $class = 'col-sm-12'; ?>
<?php } ?>
<div id="content" class="<?php echo $class; ?>"><?php echo $content_top; ?>
<?php if ($categories) { ?>
<h3><?php echo $text_refine; ?></h3>
<?php } ?>
<br />
<div>
<?php foreach ($products as $product) { ?>
<div class="product-layout product-list col-xs-12">
<div class="product-thumb">
<div class="image"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></div>
<div>
<div class="caption">
<h4><?php echo $product['name']; ?></h4>
<p><?php echo $product['description']; ?></p>
<?php if ($product['rating']) { ?>
<div class="rating">
<?php for ($i = 1; $i <= 5; $i++) { ?>
<?php if ($product['rating'] < $i) { ?>
<span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
<?php } else { ?>
<span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['price']) { ?>
<p class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
<?php } ?>
</p>
<?php } ?>
</div>
<div class="button-group">
<button style="width:100%;" type="button" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>
</div>
</div>
</div>
</div><?php } ?>
</div>
<div class="row">
<div class="col-sm-6 text-left"><?php echo $pagination; ?></div>
<div class="col-sm-6 text-right"><?php echo $results; ?></div>
</div>
<?php if (!$categories && !$products) { ?>
<p><?php echo $text_empty; ?></p>
<div class="buttons">
<div class="pull-right"><?php echo $button_continue; ?></div>
</div>
<?php } ?>
<?php echo $content_bottom; ?></div>
<?php echo $column_right; ?></div>
</div>
<?php echo $footer; ?>

Pagination with jQuery / AJAX

What plugin should I use to paginate the output of the below PHP foreach (around 400 <articles>):
<div id="hotel-list" class="hotel-list listing-style3 hotel">
<?php foreach ($hotelName as $index => $name):?>
<article class="box" data-board="<?php echo $board[$index];?>" data-stars="<?php echo $StarRating[$index];?>" name="<?php echo $hotelName[$index];?>" data-price="<?php $pret1 =$hotelPrices[$index];echo round($pret1 + ($pret1 * 0.20));?>">
<figure class="col-sm-5 col-md-4">
<a title=""><img width="270" height="160" alt="" src="<?php echo $img[$index][0];?>"></a>
</figure>
<div class="details col-sm-7 col-md-8">
<div>
<div>
<h3 class="box-title"><?php echo $name;?><small><i class="soap-icon-departure yellow-color"></i> <?php echo $hotelAddress[$index];?>, <?php echo $hotelDestination[$index];?></small></h3>
</div>
<div>
<div class="stars-<?php echo $StarRating[$index];?>-container">
<span class="stars-<?php echo $StarRating[$index];?>" style="width: 80%;"></span>
</div>
</div>
</div>
<div>
<div>
<p class="article-text"><label>Perioada: </label> <?php echo $In;?> - <?php echo $Out;?> <?php echo $adults;?> adulti / <?php echo $kids;?> copii; </p>
<p class="article-text"><label>Tip Masa: </label><?php echo $boardType[$index];?></p>
<p class="article-text"><label>Camera(e): </label><?php echo $availHotelss[$index]->rooms[0]->roomCategory;?> <?php echo $availHotelss[$index]->rooms[1]->roomCategory;?> <?php echo $availHotelss[$index]->rooms[2]->roomCategory;?> <?php echo $availHotelss[$index]->rooms[3]->roomCategory;?></p>
</div>
<div>
<span class="price"><small>De la</small>€<?php $pret1 =$hotelPrices[$index];echo round($pret1 + ($pret1 * 0.2)); ?></span>
<a class="button btn-small full-width text-center" title="" href="Hotel-Detalii.php?hotel=<?php echo $hotelCodes[$index];?>">DETALII</a>
</div>
</div>
</div>
</article>
<?php endforeach?>
</div>
I found only pagination plugin for MYSQL records.

Categories