how to hide a div in php else statement - php

samcheckdb.php
$sql1="select subtitle,descript from dessert where itemId='oepd1007'";
$result1=mysqli_query($dbhandle,$sql1);
$sql2="select subtitle,descript from dessert where itemId='oepd5148'";
$result2=mysqli_query($dbhandle,$sql2);
<div id="d0"><?php if($result1) { echo $descript1 ;} ?></div>
<div id="s0"><?php if($result1) { echo $subtitle1 ;} ?></div>
<div id="d11"><?php if($result2) {echo $descript2; } ?></div>
<div id="s11"><?php if($result2) { echo $subtitle2 ;} ?></div>
customer
<html>
<li> <img src="getdesserticecreamimage.php?itemId=oepd1007" alt="image" id="img1" onclick="get_detail('oepd1007');"></li>
<li> <img src="getdesserticecreamimage.php?itemId=oepd5148" alt="image" id="img2"></li>
</html>
i need to display only 1 subtitle and descript in the page at a time, when the user clicks on the image,only the corresponding info of the particular image get displayed,not the rest..

another neater approach is to use the : block
<?php if ($result1): ?>
<div id="d0"><?php echo $descript1 ; ?></div>
<div id="s0"><?php echo $subtitle1 ; ?></div>
<?php elseif($result2): ?>
<div id="d11"><?php echo $descript2 ; ?></div>
<div id="s11"><?php echo $subtitle2 ; ?></div>
<?php endif; ?>

<?php if($result1) { ?>
<div id="0"><?php echo $descript1; ?></div>
<div id="s0"><?php echo $subtitle1; ?></div>
<?php } else { ?>
<div id="d11"><?php echo $descript2; ?></div>
<div id="s11"><?php echo $subtitle2; ?></div>
<?php } ?>

Always remember that you can echo all HTML Elements in PHP.
<?php
if($result1) {
echo '<div id="d0">' . $descript1 .'</div>';
echo '<div id="s0">' . $subtitle1 .' </div>';
}
if($result2) {
echo '<div id="d11">' . $descript2 .'</div>';
echo '<div id="s11">' . $subtitle2 .'</div>';
}
?>

try
echo (isset($result1) ? '<div id="d0">'. $descript1 .'</div><div id="s0">'.$subtitle1 .'</div>': '<div id="d11">'.$descript2 .'</div><div id="s11">'.$subtitle2 .'</div>');

Related

How to insert html tags using foreach

I having some problem on how to put my html tags to my php foreach.
First I have this code and works fine with the layout.
foreach ($query->result() as $row)
{
echo '<div class="col-md-6">';
echo '<div class="additional-amenities">';
echo '<span class="available"><i class="fa fa-check-square"></i></span> <strong>{lang_bname}:</strong><span>'.$row->comminame.'</span>';
echo '</div>';
echo '<div class="additional-amenities">';
echo '<span class="available"><i class="fa fa-check-square"></i></span> <strong>{lang_yrlaunched}:</strong><span>'.$row->mdeveloper.'</span>';
echo '</div>';
echo '<div class="additional-amenities">';
echo '<span class="available"><i class="fa fa-check-square"></i></span> <strong>{lang_yrcompletion}:</strong><span>'.$row->gatedcommunity.'</span>';
echo '</div>';
echo '<div class="additional-amenities">';
echo '<span class="available"><i class="fa fa-check-square"></i></span> <strong>{lang_tfloors}:</strong><span>'.$row->theme.'</span>';
echo '</div>';
echo '<div class="additional-amenities">';
echo '<span class="available"><i class="fa fa-check-square"></i></span> <strong>{lang_bheight}:</strong><span>'.$row->resbuilding.'</span>';
echo '</div>';
echo '</div>';
echo '<div class="col-md-6">';
echo '<div class="additional-amenities">';
echo '<span class="available"><i class="fa fa-check-square"></i></span> <strong>{lang_developer}:</strong><span>'.$row->commbuilding.'</span>';
echo '</div>';
echo '</div>';
}
Now I change my code(check below) and got confused how to put html code like from my previous code.
Here's my code below
<div class="col-md-6">
<?php foreach ($treefields as $key=>$item): ?>
<?php if($key==0)echo '<div class="additional-amenities">' ?>
<?php if($item['title'] == $estate_data_option_1057): ?>
<span class="available"><i class="fa fa-check-square"></i></span><?php _che($item['title']); ?>
<?php if (count($item['childs']) > 0):
end($item['childs']);
$lastElementKey = key($item['childs']);
foreach ($item['childs'] as $key_c=>$child): ?>
<?php if(!empty($child['url'])): ?>
<span class="available"><i class="fa fa-check-square"></i></span><a href='<?php _che($child['url']); ?>'><?php _che($child['title']); ?></a>
<?php else:?>
<span class="available"><i class="fa fa-check-square"></i></span><span><?php _che($child['title']); ?></span>
<?php endif;
if($lastElementKey != $key_c)echo ' - ';?>
<?php endforeach;endif; ?>
<?php echo '</div>';?>
<?php else: ?>
<?php ?>
<?php endif;?>
<?php endforeach; ?>
</div>
Thank you!
I don't have problem with my values, Just having trouble Inserting html tags
Mixing HTML and PHP is always a pain. Best is to use PHP only within PHP tags, and HTML outside of these. Like this:
And you forgot one endif;.
<div class="col-md-6">
<?php foreach($treefieldsas as $row):
if($row['id'] == 0): ?>
<div class="additional-amenities">'
<?php if($row['title'] == $estate_data_option_1057): ?>
<span class="available"><i class="fa fa-check-square"></i></span><?php _che($row['title']); ?>
<?php if(count($row['childs']) > 0):
end($row['childs']);
$lastElementKey = key($row['childs']);
foreach($row['childs'] as $row2):
if( !empty($row2['url'])): ?>
<span class="available"><i class="fa fa-check-square"></i></span><a
href='<?php _che($row2['url']); ?>'><?php _che($row2['title']); ?></a>
<?php else: ?>
<span class="available"><i class="fa fa-check-square"></i></span>
<span><?php _che($row2['title']); ?></span>
<?php endif;
if($lastElementKey != $key_c):?>
-
<?php endif;
endforeach;
endif;
endif; ?>
</div>
<?php else: ?>
<?php endif;
endforeach; ?>
</div>
If have no clue what you code is doing. So I changed it a bit, feel free to change it back to the values you are using. But something like this should work.
Harder to read:
For example this piece of code would be harder to read, since everything is within PHP:
<?php if($row['title'] == $estate_data_option_1057):
{
echo '<span class="available" ><i class="fa fa-check-square" ></i ></span >'. _che($row['title']);
}?>
Because the HTML code is within the PHP tags. I prefer to use : in stead op {}, because it's easier to read.
Another fact:
<?php endif; ?>
<?php endforeach;
endif;
endif; ?>
Is not clean. You should use this:
<?php endif;
endforeach;
endif;
endif; ?>
(Staring and ending PHP tags).
Hope this clears something up.
You should do it something like this:
$html = "FIXED_HEAD_ELEMENT";
foreach ($query->result() as $row) {
$html .= 'YOUR_HTML';
if (condition == TRUE){
$html .= 'THIS';
} else {
$html .= 'THAT';
}
}
$html .= "FIXED_BOTTOM_ELEMENT";
echo $html;
I always do it like this. It's very clean and readable.

Create outer div if counter is divisible by 4

I have a problem looping my html tags. My goal is to enclose every 4 div with class "item" inside the class of "item-wrap". So far here's my code:
$speakers will return 8 rows so "item-wrap" class will be display twice with 4 "item" class inside
<?php
$speaker_ctr = 0;
if(count($speakers) > 0){
?>
<div class="item-wrap">
<?php foreach($speakers as $speaker){ ?>
<div class="item"> <img class="lazy" data-lazy-src="<?php echo $speaker['imagepath']; ?>" />
<h5 class="txt-18 bold-font text-uppercase no-mbt mt-20"><?php echo $speaker['name']; ?></h3>
<p class="no-mn"><?php echo $speaker['position']; ?></p>
<?php echo $speaker['company']; ?>
</div>
<?php } ?>
</div>
<?php
$speaker_ctr++;
}
?>
Try below code:-
<?php
if(count($speakers) > 0){
for($i=0;$i<=count($speakers);$i++){
if($i%4==0){
echo '<div class="item-wrap">';
}
?>
<div class="item"> <img class="lazy" data-lazy-src="<?php echo $speakers[$i]['imagepath']; ?>" />
<h5 class="txt-18 bold-font text-uppercase no-mbt mt-20"><?php echo $speakers[$i]['name']; ?></h3>
<p class="no-mn"><?php echo $speakers[$i]['position']; ?></p>
<?php echo $speakers[$i]['company']; ?>
</div>
<?php
if($i%4==0){
echo '</div>';
}
}
}
Try with -
$speaker_ctr = 0;
if(count($speakers) > 0){
?>
<div class="item-wrap">
<?php
foreach($speakers as $speaker){
$speaker_ctr++; // increment
?>
<div class="item"> <img class="lazy" data-lazy-src="<?php echo $speaker['imagepath']; ?>" />
<h5 class="txt-18 bold-font text-uppercase no-mbt mt-20"><?php echo $speaker['name']; ?></h3>
<p class="no-mn"><?php echo $speaker['position']; ?></p>
<?php echo $speaker['company']; ?>
</div>
<?php
// print if divisible by 4
// every 4th element
if($speaker_ctr%4 == 0 && $speaker_ctr != count($speakers)) {
echo "</div><div class='item-wrap'>";
}
}
?>
</div>
<?php
}

If Field is empty then show certain divs

I have the following code but it is not working.
Basically I want it so if the field movie_title_2 is empty I want it to add the , but if it is not empty to show just . I am using wordpress and Advanced Custom Fields plugin. Thanks!
<div class="homepage-opacity">
<div class="movie-container">
<?php if (get_field('movie_title_2') && get_field('movie_title_2') != "") { ?>
<div class="movie-area alone">
<div class="movie-poster">
<?php if ( get_field('movie_image_poster') ) : ?>
<img src="<?php the_field('movie_image_poster'); ?>" alt="<?php the_field('movie_image_poster'); ?>}">
<?php endif; ?>
</div>
<div class="movie-info">
<?php
if(get_field('movie_title'))
{
echo '<h1 class="movie-title">' . get_field('movie_title') . '</h1>';
}
?>
<?php
if(get_field('movie_dates_&_times'))
{
echo '<p class="movie-times">' . get_field('movie_dates_&_times') . '</p>';
}
?>
<?php if ( get_field('trailer_link') ) : ?>
<a class="movie-trailer" href="<?php the_field('trailer_link'); ?>" target="_blank">View the Trailer</a>
<?php endif; ?>
</div>
</div>
<?php } ?>
<?php if (get_field('movie_title_2') && get_field('movie_title_2') == "") { ?>
<div class="movie-area">
<div class="movie-poster">
<?php if ( get_field('movie_image_poster') ) : ?>
<img src="<?php the_field('movie_image_poster'); ?>" alt="<?php the_field('movie_image_poster'); ?>}">
<?php endif; ?>
</div>
<div class="movie-info">
<?php
if(get_field('movie_title'))
{
echo '<h1 class="movie-title">' . get_field('movie_title') . '</h1>';
}
?>
<?php
if(get_field('movie_dates_&_times'))
{
echo '<p class="movie-times">' . get_field('movie_dates_&_times') . '</p>';
}
?>
<?php if ( get_field('trailer_link') ) : ?>
<a class="movie-trailer" href="<?php the_field('trailer_link'); ?>" target="_blank">View the Trailer</a>
<?php endif; ?>
</div>
</div>
<div class="movie-area">
<div class="movie-poster">
<?php if ( get_field('movie_image_poster_2') ) : ?>
<img src="<?php the_field('movie_image_poster_2'); ?>" alt="<?php the_field('movie_image_poster_2'); ?>}">
<?php endif; ?>
</div>
<div class="movie-info">
<?php
if(get_field('movie_title_2'))
{
echo '<h1 class="movie-title">' . get_field('movie_title_2') . '</h1>';
}
?>
<?php
if(get_field('movie_dates_&_times_2'))
{
echo '<p class="movie-times">' . get_field('movie_dates_&_times_2') . '</p>';
}
?>
<?php if ( get_field('trailer_link_2') ) : ?>
<a class="movie-trailer" href="<?php the_field('trailer_link_2'); ?>" target="_blank">View the Trailer</a>
<?php endif; ?>
</div>
</div>
<?php } ?>
</div>
</div>
try:
<?php
$variable = get_field('movie_title_2');
if ($variable) { ?>
<h1>Add html just like you would normally do</h1>
<?php } else { ?>
<h1>Add different html here when the variable is empty</h1>
<?php } ?>

Magento, showing payment of a product conditions on the homepage

have a phtml file riding the payment of the value of a product, the function responsible for it automatically puts on every page of the product installment conditions, but does not appear the payment terms on the homepage where I coloto one "carousel "for featured products.
Someone would have a hint of what I do?
Note 1: I use a AllPago the module to set the conditions only that I can not use the stand for the value that do not have access.
Note 2: according to the source code that assembles the installments for me (file name in magento to find looks like this: allpago_installments / productviewtable.phtml
<?php foreach ($this->getInstallments() as $installment): ?>
<?php $result = count($this->getInstallments()); ?>
<?php if($installment->getValue()==$result):?>
<div class="product-view-parcel">
<?php echo $installment->getValue() . ' x ' . $installment->getInstallment() . ' ' . $installment->getMessage(); ?>
</div>
<?php endif;?>
<?php endforeach; ?>
Note 3: a part of the home page code where I try to call the price and conditions (heeding the price appears correctly only the payment terms that do not):
<div id="ripplesslider" class="ripplesslider" style="height: 470px!important;">
<?php foreach ($_productCollection_slider as $_product): ?>
<div id="slide" style="text-align: center !important;height: 470px!important;"
class="latest-slider-item slide slider<?php echo $_product->getId() ?>">
<a href="<?php echo $_product->getProductUrl() ?>"
title="<?php echo $this->htmlEscape($_product->getName()) ?>">
<div style="height: 200px!important;">
<img onmouseover="mouseover(<?php echo $_product->getId() ?>)"
onmouseout="mouseout(<?php echo $_product->getId() ?>)"
style="width:<?php echo $t ?>px;
height:<?php echo $imageheight ?>px; "
src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image'); ?>"
alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>
</div>
</a>
<div class="desc-item">
<div class="carousel-name-product"> <?php echo $_product->getName() ?></div>
<div class="latest-price">
<?php if ($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php $this->getPriceHtml($_product, true) ?>
<?php echo '<span czlass="price">' . str_replace('R$','', $this->getPriceHtml($_product, true)) . '</span>'; ?>
</div>
</div>
</div>
<?php endforeach ?>
</div>
haha staff already got, I'll post here what I did to perhaps help others.
<div>
<?php echo '<span class="price">' . str_replace('R$','', $this->getPriceHtml($_product, true)) . '</span>'; ?>
<?php // object reference?>
<?php $reference = Mage::getStoreConfig('allpago/installments/active'); ?>
<?php//returns a new object. references ?>
<?php $installmentModel = Mage::getModel('installments/'.$reference); ?>
<?php //access the parameters to get the conditions have to function "getInstallmentHighest" to return the plots?>
<?php $installmentModel->setValue($_product->getFinalPrice()); ?>
<?php $installment = $installmentModel->getInstallmentHighest(); ?>
<span style="text-align: left;color: #A8A0A8;position: absolute;margin-top: -46px !important;margin-left: -78px !important;font-size: 12px;">
<?php echo $installment->getValue().' x '. $installment->getInstallment() . ' ' . $installment->getMessage(); ?>
</span>
</div>

PHP Collection - Code Duplication upon refresh or page change

I have created some custom code (lines 287-309 in the code below)It is a duplicate function of 313-345 but with a few changes.
Although the function works perfectly well for some reason the page upon change or refresh duplicate the collection at the bottom of the page.
If I move lines 287-309 to line 347 onwards this does not happen. I'm assuming I a creating some sort of loop here or am I not closing the PHP correctly?
Any help would be hugely appreciated.
The Code:
<?php
include "../include/db.php";
include "../include/authenticate.php";
include "../include/general.php";
include "../include/resource_functions.php";
include "../include/collections_functions.php";
hook("homeheader");
include "../include/header.php";
if (!hook("replacehome")) {
if (!hook("replaceslideshow")) {
# Count the files in the configured $homeanim_folder.
$dir = dirname(__FILE__) . "/../" . $homeanim_folder;
$filecount = 0;
$checksum=0; # Work out a checksum which is the total of all the image files in bytes - used in image URLs to force a refresh if any of the images change.
$d = scandir($dir);
sort($d, SORT_NUMERIC);
$reslinks=array();
foreach ($d as $f) {
if(preg_match("/[0-9]+\.(jpg)/",$f))
{
$filecount++;
$checksum+=filesize($dir . "/" . $f);
$linkfile=substr($f,0,(strlen($f)-4)) . ".txt";
$reslinks[$filecount]="";
if(file_exists("../" . $homeanim_folder . "/" . $linkfile))
{
$linkref=file_get_contents("../" . $homeanim_folder . "/" . $linkfile);
$linkaccess = get_resource_access($linkref);
if (($linkaccess!=="") && (($linkaccess==0) || ($linkaccess==1))){$reslinks[$filecount]=$baseurl . "/pages/view.php?ref=" . $linkref;}
}
}
}
$homeimages=$filecount;
if ($filecount>1) { # Only add Javascript if more than one image.
?>
<script type="text/javascript">
var num_photos=<?php echo $homeimages?>; // <---- number of photos (/images/slideshow?.jpg)
var photo_delay=5; // <---- photo delay in seconds
var link = new Array();
<?php
$l=1;
foreach ($reslinks as $reslink)
{
echo "link[" . $l . "]=\"" . $reslink . "\";";
$l++;
}
?>
var cur_photo=2;
var last_photo=1;
var next_photo=2;
flip=1;
var image1=0;
var image2=0;
function nextPhoto()
{
if (!document.getElementById('image1')) {return false;} /* Photo slideshow no longer available (AJAX page move) */
if (cur_photo==num_photos) {next_photo=1;} else {next_photo=cur_photo+1;}
image1 = document.getElementById("image1");
image2 = document.getElementById("photoholder");
sslink = document.getElementById("slideshowlink");
linktarget=link[cur_photo];
if (flip==0)
{
// image1.style.visibility='hidden';
//Effect.Fade(image1);
jQuery('#image1').fadeOut(1000)
window.setTimeout("image1.src='<?php echo $baseurl . "/" . $homeanim_folder?>/" + next_photo + ".jpg?checksum=<?php echo $checksum ?>';if(linktarget!=''){jQuery('#slideshowlink').attr('href',linktarget);}else{jQuery('#slideshowlink').removeAttr('href');}",1000);
flip=1;
}
else
{
// image1.style.visibility='visible';
//Effect.Appear(image1);
jQuery('#image1').fadeIn(1000)
window.setTimeout("image2.style.background='url(<?php echo $baseurl . "/" . $homeanim_folder?>/" + next_photo + ".jpg?checksum=<?php echo $checksum ?>)';if(linktarget!=''){jQuery('#slideshowlink').attr('href',linktarget);}else{jQuery('#slideshowlink').removeAttr('href');}",1000);
flip=0;
}
last_photo=cur_photo;
cur_photo=next_photo;
timers.push(window.setTimeout("nextPhoto()", 1000 * photo_delay));
}
jQuery(document).ready( function ()
{
/* Clear all old timers */
ClearTimers();
timers.push(window.setTimeout("nextPhoto()", 1000 * photo_delay));
}
);
</script>
<?php } ?>
<div class="HomePicturePanel"
<?php if (isset($home_slideshow_width)) {
echo "style=\"";
$slide_width = $home_slideshow_width + 0;
echo"width:" . (string)$slide_width ."px; ";
echo "\" ";
}
?>>
<a id="slideshowlink"
<?php
$linkurl="#";
if(file_exists("../" . $homeanim_folder . "/1.txt"))
{
$linkres=file_get_contents("../" . $homeanim_folder . "/1.txt");
$linkaccess = get_resource_access($linkres);
if (($linkaccess!=="") && (($linkaccess==0) || ($linkaccess==1))) {$linkurl=$baseurl . "/pages/view.php?ref=" . $linkres;}
echo "href=\"" . $linkurl ."\" ";
}
?>
\>
<div class="HomePicturePanelIN" id='photoholder' style="
<?php
if (isset($home_slideshow_height)){
echo"height:" . (string)$home_slideshow_height ."px; ";
}
?>
background-image:url('<?php echo $baseurl . "/" . $homeanim_folder?>/1.jpg?checksum=<?php echo $checksum ?>');">
<img src='<?php echo $baseurl . "/" . $homeanim_folder?>/2.jpg?checksum=<?php echo $checksum ?>' alt='' id='image1' style="display:none;<?php
if (isset($home_slideshow_width)){
echo"width:" . $home_slideshow_width ."px; ";
}
if (isset($home_slideshow_height)){
echo"height:" . $home_slideshow_height ."px; ";
}
?>">
</div>
</a>
<div class="PanelShadow"></div>
</div>
<?php } # End of hook replaceslideshow
?>
<?php if (checkperm("s")) {
hook("homebeforepanels");
?>
<?php if ($home_themeheaders && $enable_themes) { ?>
<div class="HomePanel"><div class="HomePanelIN">
<h2><a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/themes.php"><?php echo $lang["themes"]?></a></h2>
<?php echo text("themes")?>
<br /> <br />
<select style="width:140px;" onChange="CentralSpaceLoad(this.value,true);">
<option value=""><?php echo $lang["select"] ?></option>
<?php
$headers=get_theme_headers();
for ($n=0;$n<count($headers);$n++)
{
?>
<option value="<?php echo $baseurl_short?>pages/themes.php?header=<?php echo urlencode($headers[$n])?>"><?php echo i18n_get_translated(str_replace("*","",$headers[$n]))?></option>
<?php
}
?>
</select>
<br />> <?php echo $lang["viewall"] ?>
</div>
<div class="PanelShadow"></div>
</div>
<?php } ?>
<?php if ($home_themes && $enable_themes) { ?>
<div class="HomePanel"><div class="HomePanelINtopA">
<div class="HomePanelINtopHeader"><?php echo $lang["themes"]?></div>
<div class="HomePanelINtopText"><?php echo text("themes")?></div>
</div>
<div class="PanelShadow"></div>
</div>
<?php } ?>
<?php if ($home_mycollections && !checkperm("b") && $userrequestmode!=2 && $userrequestmode!=3) { ?>
<div class="HomePanel"><div class="HomePanelINtopB">
<div class="HomePanelINtopHeader"> <?php echo $lang["mycollections"]?></div>
<div class="HomePanelINtopText"><?php echo text("mycollections")?></div>
</div>
<div class="PanelShadow">
</div>
</div>
<?php } ?>
<?php if ($home_advancedsearch) { ?>
<div class="HomePanel"><div class="HomePanelINtopC">
<div class="HomePanelINtopHeader"> <?php echo $lang["advancedsearch"]?></div>
<div class="HomePanelINtopText"><?php echo text("advancedsearch")?></div>
</div>
<div class="PanelShadow"></div>
</div>
<?php } ?>
<?php if ($home_mycontributions && (checkperm("d") || (checkperm("c") && checkperm("e0")))) { ?>
<div class="HomePanel"><div class="HomePanelINtopD">
<div class="HomePanelINtopHeader"><?php echo $lang["mycontributions"]?></div>
<div class="HomePanelINtopText"><?php echo text("mycontributions")?></div>
</div>
<div class="PanelShadow"></div>
</div>
<?php } ?>
<?php if ($home_helpadvice) { ?>
<div class="HomePanel"><div class="HomePanelINtopE">
<div class="HomePanelINtopHeader"><?php echo $lang["helpandadvice"]?></div>
<div class="HomePanelINtopText"><?php echo text("help")?></div>
</div>
<div class="PanelShadow"></div>
</div>
<?php } ?>
<?php if ($home_themes && $enable_themes) { ?>
<div class="HomePanel"><div class="HomePanelINtopIntro">
<div class="HomePanelINtopHeader"><?php echo text("welcometitle")?></div>
<div class="HomePanelINtopText"><?php echo text("welcometext")?></div>
</div>
<div class="PanelShadow"></div>
</div>
<?php } ?>
<?php
/* ------------ Customisable home page panels ------------------- */
if (isset($custom_home_panels))
{
for ($n=0;$n<count($custom_home_panels);$n++)
{
if (!hook("panelperm")) {
?>
<div class="HomePanel"><div class="HomePanelIN" <?php if ($custom_home_panels[$n]["text"]=="") {?>style="min-height:0;"<?php } ?>>
<h2><a href="<?php echo $custom_home_panels[$n]["link"] ?>" <?php if (isset($custom_home_panels[$n]["additional"])){ echo $custom_home_panels[$n]["additional"];} ?>> <?php echo i18n_get_translated($custom_home_panels[$n]["title"]) ?></a></h2>
<?php echo i18n_get_translated($custom_home_panels[$n]["text"]) ?>
</div>
<div class="PanelShadow"></div>
</div>
<?php
} // end hook 'panelperm'
}
}
?>
<!-- THIS IS LINE 287 please refer to question -->
<?php
if(!hook("EditorsPick")):
/* ------------ Collections promoted to the home page ------------------- */
$home_collectionsx=get_home_page_promoted_collectionsx(16);
foreach ($home_collectionsx as $home_collectionx)
{
?>
<div class="EditorsPick">
<div class="HomePanel"><div class="HomePanelINtopEditors">
<div class="HomePanelINtopHeader">Editors Pick</div>
<div class="HomePanelINtopText">This is the editors pick of Asset Space...</div>
<div class="EditorsPicImage"><div style="padding-top:<?php echo floor((155-$home_collectionx["thumb_height"])/2) ?>px; margin-top: -24px; margin-bottom: -15px;">
<a href="<?php echo $baseurl_short?>pages/search.php?search=!collection<?php echo $home_collectionx["ref"] ?>" onClick="return CentralSpaceLoad(this,true);"><img class="ImageBorder" src="<?php echo get_resource_path($home_collectionx["home_page_image"],false,"thm",false) ?>" width="<?php echo $home_collectionx["thumb_width"] ?>" height=" <?php echo $home_collectionx["thumb_height"] ?>" /></div>
</div></div>
</div>
</div>
</div>
<?php
}
endif; # end hook homefeaturedcol
?>
<!-- THIS IS LINE 309 please refer to question -->
<!-- THIS IS LINE 313 please refer to question -->
<?php
if(!hook("homefeaturedcol")):
/* ------------ Collections promoted to the home page ------------------- */
$home_collections=get_home_page_promoted_collections(16);
foreach ($home_collections as $home_collection)
{
?>
<div class="ResourceOfTheDay"></div>
<div class="HomePanel HomePanelPromoted"><div class="HomePanelIN HomePanelPromotedIN">
<div class="MyCollectionsHighlite"></div>
<div class="HomePanelPromotedImageWrap">
<div style="padding-top:<?php echo floor((155-$home_collection["thumb_height"])/2) ?>px; margin-top: -24px; margin-bottom: -15px;">
<a href="<?php echo $baseurl_short?>pages/search.php?search=!collection<?php echo $home_collection["ref"] ?>" onClick="return CentralSpaceLoad(this,true);"><img class="ImageBorder" src="<?php echo get_resource_path($home_collection["home_page_image"],false,"thm",false) ?>" width="<?php echo $home_collection["thumb_width"] ?>" height="<?php echo $home_collection["thumb_height"] ?>" /></div>
</div>
<p style="font-size:14px; font-weight:bold"><?php echo i18n_get_translated($home_collection["home_page_text"]) ?></p>
<p style="font-size:12px; font-weight:normal">Click to view this collection</p>
</div>
<div class="PanelShadow"></div>
</div>
<?php
}
endif; # end hook homefeaturedcol
?>
<!-- THIS IS LINE 345 please refer to question -->
<!-- THIS IS LINE 347 please refer to question -->
<div class="clearerleft"></div>
<?php }
} // End of ReplaceHome hook
include "../include/footer.php";
?>
From your comment above I would say this line is to blame:
if(!hook("homefeaturedcol")):
I'm assuming that this is running as well as your new code above it when it's not the homepage
You may also want to have a look at your HTML structure

Categories