Printing image from array - php

first off, I'm extremely new to PHP.
I'm using Conrete5, and I have a new template to an image slider. This is what I'm using:
http://codepen.io/altitudems/pen/KdgGLG
There's a placeholder image, which I'm trying to replace by grabbing the first image set in the block itself. Here is my view file from the actual block:
<?php defined('C5_EXECUTE') or die("Access Denied.");
$navigationTypeText = ($navigationType == 0) ? 'arrows' : 'pages';
$c = Page::getCurrentPage();
if ($c->isEditMode()) { ?>
<div class="ccm-edit-mode-disabled-item" style="width: <?php echo $width; ?>; height: <?php echo $height; ?>">
<div style="padding: 40px 0px 40px 0px"><?php echo t('Image Slider disabled in edit mode.')?></div>
</div>
<?php } else { ?>
<script>
$(document).ready(function(){
$(function () {
$("#ccm-image-slider-<?php echo $bID ?>").responsiveSlides({
prevText: "", // String: Text for the "previous" button
nextText: "",
<?php if($navigationType == 0) { ?>
nav:true
<?php } else { ?>
pager: true
<?php } ?>
});
});
});
</script>
<div class="ccm-image-slider-container ccm-block-image-slider-<?php echo $navigationTypeText?>" >
<div class="ccm-image-slider">
<div class="ccm-image-slider-inner">
<?php if(count($rows) > 0) { ?>
<ul class="rslides" id="ccm-image-slider-<?php echo $bID ?>">
<?php foreach($rows as $row) { ?>
<li>
<?php if($row['linkURL']) { ?>
<?php } ?>
<?php
$f = File::getByID($row['fID'])
?>
<?php if(is_object($f)) {
$tag = Core::make('html/image', array($f, false))->getTag();
if($row['title']) {
$tag->alt($row['title']);
}else{
$tag->alt("slide");
}
print $tag; ?>
<?php } ?>
<div class="ccm-image-slider-text">
<?php if($row['title']) { ?>
<h1 class="ccm-image-slider-title"><?php echo $row['title'] ?></h1>
<?php } ?>
<?php echo $row['description'] ?>
</div>
</li>
<?php } ?>
</ul>
<?php } else { ?>
<div class="ccm-image-slider-placeholder">
<p><?php echo t('No Slides Entered.'); ?></p>
</div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
Here is my gallery view file:
<a class="gallery-launcher" href="#gallery1"> // Location of the image
<div class="overlay">
<div class="overlay-content">
<button class="btn btn-default">Open Gallery</button>
</div>
</div>
</a>
<div class="gallery inactive" id="gallery1">
<div class="gallery-item">
//Fullscreen gallery code here
</div>
</div>
Where it says // Location of the image is where I need to have the first image set. I can't figure out what I'd put there? Any help will be appreciated.

You could use the concrete5 file helper to get the file path, like this for example:
$f = File::getByID($row['fID']);
$relpath = $f->getRelativePath();
In general I suggest that you read more about the concrete5 file functions to understand more how it works:

Related

add an incrementing number to id with php

I am making a portfolio site with kirby cms.
my site is a single page website. I want to add an incrementing number after id by using foreach in the part shown in the code below..!
Is there easy way to do..?
regards,
<?php foreach ($pages->listed() as $p): ?>
<div class="slideshow">
<div class="slideshow-box">
<div class="slideshow-holder">
<?php foreach ($p->images() as $workimage): ?>
<div class="slide">
<?= $workimage ?><br><br>
</div>
<?php endforeach ?>
</div>
<div class="tooltip">
<p id="myText📍<here>"><?= $p->worktitle() ?></p>
</div>
<div class="toolbox" id="myDIV📍<here>">
<?= $p->description() ?>
</div>
</div>
<div class="actions">
<span>1/3</span>
</div>
←
→
</div>
<?php endforeach ?>
<script>
var button📍<here> = document.getElementById('myText📍<here>');
var div📍<here> = document.getElementById('myDIV📍<here>');
div📍<here>.style.display = 'none';
button📍<here>.onclick = function () {
if (div📍<here>.style.display !== 'none') {
div📍<here>.style.display = 'none';
} else {
div📍<here>.style.display = 'block';
}
};
</script>
I know I am late to the party, but here is my version.
You can actually just set a $counter Variable before the foreach() and just count it up right before the end of the foreach.
Furthermore I would you data-attributes and query them instead of an id.
Here's my Code. I tested it and it worked fine. If there are any questions let me now.
<?php $counter = 1;
foreach ($pages->listed() as $p): ?>
<div class="slideshow">
<div class="slideshow-box">
<div class="slideshow-holder">
<?php foreach ($p->images() as $workimage): ?>
<div class="slide">
<?= $workimage ?><br><br>
</div>
<?php endforeach ?>
</div>
<div class="tooltip">
<p data-tooltip="<?= $counter ?>"><?= $p ?></p>
</div>
<div class="toolbox" data-toolbox="<?= $counter ?>" style="display: none;">
<?= $p ?>
</div>
</div>
</div>
<?php $counter++; endforeach ?>
<script>
const TOOLTIPS = document.querySelectorAll('[data-tooltip]');
TOOLTIPS.forEach(TOOLTIP => {
TOOLTIP.addEventListener('click', () => {
const TOOLBOX = document.querySelector(`[data-toolbox="${TOOLTIP.dataset.tooltip}"]`);
if (TOOLBOX) {
if (TOOLBOX.style.display !== 'none') {
TOOLBOX.style.display = 'none';
} else {
TOOLBOX.style.display = 'block';
}
}
});
});
</script>

Pagination on Wp-Property not working

I have a Wordpress site that is using Wp-Property and the pagination isn't working, can anyone help fix this please. Please see below the pagination part from the function page.
<?php if($use_pagination) { ?>
if(!wpp_pagination_<?php echo $unique_hash; ?>) {
jQuery("#wpp_shortcode_<?php echo $unique_hash; ?> .wpp_pagination_slider_wrapper").each(function() {
var this_parent = this;
/* Slider */
jQuery('.wpp_pagination_slider', this).slider({
value:1,
min: 1,
max: <?php echo $pages; ?>,
step: 1,
slide: function( event, ui ) {
/* Update page counter - we do it here because we want it to be instant */
jQuery("#wpp_shortcode_<?php echo $unique_hash; ?> .wpp_current_page_count").text(ui.value);
jQuery("#wpp_shortcode_<?php echo $unique_hash; ?> .wpp_pagination_slider .slider_page_info .val").text(ui.value);
},
stop: function(event, ui) {
wpp_query_<?php echo $unique_hash; ?> = changeAddressValue(ui.value, wpp_query_<?php echo $unique_hash; ?>);
}
});
/* Fix slider width based on button width */
var slider_width = (jQuery(this_parent).width() - jQuery(".wpp_pagination_back", this_parent).outerWidth() - jQuery(".wpp_pagination_forward", this_parent).outerWidth() - 30);
jQuery(".wpp_pagination_slider", this_parent).css('width', slider_width);
jQuery('.wpp_pagination_slider .ui-slider-handle', this).append('<div class="slider_page_info"><div class="val">1</div><div class="arrow"></div></div>');
});
wpp_pagination_<?php echo $unique_hash; ?> = true;
}
<?php } ?>
});
</script>
<?php
$js_result = ob_get_contents();
ob_end_clean();
ob_start(); ?>
<div class="properties_pagination <?php echo $settings['class']; ?> wpp_slider_pagination" id="properties_pagination_<?php echo $unique_hash; ?>">
<div class="wpp_pagination_slider_status">
<?php
if(function_exists('WPPFL_getNumberOfFavorites')) {
$num_of_favorites = WPPFL_getNumberOfFavorites();
} else{
$num_of_favorites = 0;
}
$currentTemplate = "";
if (isset($wpp_query['template'])) {
$currentTemplate = $wpp_query['template'];
}
?>
<?php if ($currentTemplate==TEMPLATEPATH . "/list-my-property-content.php") { ?>
<div class="wppcs-sub-menu">
<?php global $post;
$post_name = $post->post_name; ?>
<?php $class='class="active"'; ?>
<ul>
<li <?php if($post_name == 'list-my-property') { echo $class; } ?>>
<a href="<?php echo get_bloginfo('url'); ?>/list-my-property/">
View Listed Properties
</a>
</li>
<li <?php if($post_name == 'add-new-property') { echo $class; } ?>>
<a href="<?php echo get_bloginfo('url'); ?>/list-my-property/add-new-property/">
Add New Property
</a>
</li>
</ul>
</div>
<?php } else { ?>
<ul class="top_part">
<li><a>Search results</a></li>
<li class="favor">My Favourites(<span class="number_of_favorites"><?php echo $num_of_favorites; ?></span>)</li>
</ul>
<?php } ?>
<div class="clear"></div>
</div>
<?php if($use_pagination) { ?>
<div class="wpp_pagination_slider_wrapper">
<div class="wpp_page_numbers_block">
<span class="numbers-title">Pages</span>
<?php
if ($pages < 10) {
for($i=1; $i<=$pages; $i++) {
echo '<span class="page_numbers" data-value="'.$i.'">'.$i.'</span>';
}
} else {
for($i=1; $i<=$pages; $i++) {
if (($i < 4) || ($i>$pages-3)) {
echo '<span class="page_numbers" data-value="'.$i.'">'.$i.'</span>';
}
if ($i==4) {
echo '<span class="middle-pages"><span class="dotted-separator">...</span></span>';
}
}
}?>
</div>
<div class="wpp_pagination_back wpp_pagination_button"><?php _e('Prev', 'wpp'); ?></div>
<div class="wpp_pagination_forward wpp_pagination_button"><?php _e('Next', 'wpp'); ?></div>
<div class="wpp_pagination_slider"></div>
</div>
<?php } ?>
</div>
<div class="ajax_loader"></div>
<?php
$html_result = ob_get_contents();
ob_end_clean();
Thank you in anticaption.
The first thing which can cause your issue is some of third party plugins or your theme. So try firstly to deactivate third party plugins and switch theme to default one to be sure that issue doesn't relate to any of them.
Such request you can also send here
https://wordpress.org/support/plugin/wp-property
or on our site
https://usabilitydynamics.com/contact-us/
Regards.
Usability Dynamics Support

Concrete5 - Custom block not editable, or recognized with the editing tool?

I'm making a site with conrete5. It's the first one I might add. I have made myself a couple of custom blocks. Named News, Teammates and References.
Now News and Teammates are not editable anymore. I will paste the News -blocks sourcecode.
----------- FORM.php ---------------------
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<?php
$al = Loader::helper('concrete/asset_library');
echo $al->file('optional', 'fID', t('Valitse kuva'), $bf, $args);
?>
<div class="form-group">
<?php echo $form->label('otsikko', t('Otsikko'));?>
<?php echo $form->text('otsikko', $otsikko);?>
</div>
<div class="form-group">
<?php echo $form->label('teksti', t('Teksti'));?>
<?php echo $form->text('teksti', $teksti); ?>
</div>
<div class="form-group">
<?php echo $form->label('korkeus', t('Korkeus'));?>
<?php echo $form->select('korkeus', array("108px"=>t("Pieni"),"299px"=>t("Iso")), $korkeus); ?>
</div>
<div class="form-group">
<?php echo $form->label('koko', t('Leveys'));?>
<?php echo $form->select('koko', array("col-md-3"=>t("Pieni"),"col-md-6"=>t("Iso")), $koko); ?>
</div>
<div class="form-group">
<?php echo $form->label('link', t('Linkki'));?>
<?php echo $form->text('link', $link); ?>
</div>
<div class="form-group">
<?php $psh = Loader::helper('form/page_selector');
echo $psh->selectPage('targetCID', $targetCID); ?>
</div>
----------- view.php ---------------------
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
$c = Page::getCurrentPage();
if($size=="col-md-3"){
$class='col-md-3';
$tag = $class;
}else{
$class="col-md-6";
$tag= $class;
}
if ($c->isEditMode()){
$class="editmode";
$editingStyle="padding: 15px; background: #ccc; color: #444; border: 1px solid #999;";
}
else {
$editingStyle = "";
}
$random = rand();
if($korkeus == "299px"){
$padding = '4px';
}else {
$padding = '5px';
}
$p = Page::getByID($targetCID);
$a = new GlobalArea('Header Navigation');
$blocks = $a->getAreaBlocksArray($c);
foreach ($blocks as $block){
if ($block->getBlockTypeHandle()=="autonav"){
$block->setCustomTemplate('cdrop.php'); // it's templates/cdrop.php -check the select option values when you set custom template manually at edit mode. I think you will need just "my_template"
$bv = new BlockView($block);
$bv->render('view');
}
}
?>
<?php $p = Page::getByID($targetCID); ?>
<a href="index.php">
<div class="pull-left <?= $koko;?>" style="padding:<?= $padding ?>;<?php echo $editingStyle;?>">
<div class="col-lg-12 alapalkki box" style="z-index:2;position:relative;">
<div class="image-big" style="background-color:transparent;text-align:center;position:relative;z-index:1;">
<!-- FiGuRe this shit out......... !-->
<?php
if($fID != 0){
$file = File::getByID($fID);
$filePath = $file->getVersion()->getRelativePath();
}
?>
<?php echo '<img src="' . $filePath . '" style="max-height:' . $korkeus . ';width:100%;"/>'; ?>
</div>
<div class="col-lg-12 " style="position:relative;z-index:255;padding:2px 0 0 15px;">
<div class="htitle">
<h4 style="color:white;"><b><?php echo $otsikko; ?></b></h4>
<p style="color:white;"><?php echo $teksti; ?></p>
</div>
</div>
</div>
</div>
</a>
Why is this not being an editable block? Why doesn't the concrete5 even recognize its existence when it is on the page? It just says at the area that it's empty.
$p = Page::getByID($targetCID);
$a = new GlobalArea('Header Navigation');
$blocks = $a->getAreaBlocksArray($c);
foreach ($blocks as $block){
if ($block->getBlockTypeHandle()=="autonav"){
$block->setCustomTemplate('cdrop.php'); // it's templates/cdrop.php -check the select option values when you set custom template manually at edit mode. I think you will need just "my_template"
$bv = new BlockView($block);
$bv->render('view');
}
}
?>
There's the problem. No idea what so ever what that is doing there..... Removed it. Worked like a charm.
-Kevin

Magento - How to show realted products block in my product page?

I have this and i think this is a code for block which displays releated products for the product in the product page here it is.
/template/catalog/product/list/releated_products.phtml :
<?php if($this->getItems()->getSize()): ?>
<div class="related-products">
<h2><?php echo $this->__('Related Products') ?></h2>
<ol class="products-grid row" id="block-related">
<?php foreach($this->getItems() as $_item): ?>
<li class="item span3">
<?php if(!$_item->isComposite() && $_item->isSaleable()): ?>
<?php endif; ?>
<div class="product"> <img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(590,714) ?>" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" />
<div class="product-details">
<p class="product-name"><?php echo $this->htmlEscape($_item->getName()) ?></p>
<?php echo $this->getPriceHtml($_item, true, '-related') ?>
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<?php echo $this->__('Add to Wishlist') ?>
<?php endif; ?>
</div>
</div>
</li>
<?php endforeach ?>
</ol>
<script type="text/javascript">decorateList('block-related', 'none-recursive')</script>
<script type="text/javascript">
//<![CDATA[
$$('.related-checkbox').each(function(elem){
Event.observe(elem, 'click', addRelatedToProduct)
});
var relatedProductsCheckFlag = false;
function selectAllRelated(txt){
if (relatedProductsCheckFlag == false) {
$$('.related-checkbox').each(function(elem){
elem.checked = true;
});
relatedProductsCheckFlag = true;
txt.innerHTML="<?php echo $this->__('unselect all') ?>";
} else {
$$('.related-checkbox').each(function(elem){
elem.checked = false;
});
relatedProductsCheckFlag = false;
txt.innerHTML="<?php echo $this->__('select all') ?>";
}
addRelatedToProduct();
}
function addRelatedToProduct(){
var checkboxes = $$('.related-checkbox');
var values = [];
for(var i=0;i<checkboxes.length;i++){
if(checkboxes[i].checked) values.push(checkboxes[i].value);
}
if($('related-products-field')){
$('related-products-field').value = values.join(',');
}
}
//]]>
</script>
</div>
<?php endif ?>
So how i can display this block in my view.phtml which display the info for the product view page. I want to paste it bellow the product description.
Thanks in advance!
Try this https://magento.stackexchange.com/questions/3177/showing-related-products-in-product-view-page
Make sure your current product has related product.

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