Forums / Templates, Stylesheets, Page Layout / Custom Text Below Featured Product on Home Page

Custom Text Below Featured Product on Home Page

Results 1 to 12 of 12
07 Sep 2010, 01:04
#1
susb8383 avatar

susb8383

Zen Follower

Join Date:
Feb 2008
Posts:
129
Plugin Contributions:
0

Custom Text Below Featured Product on Home Page

Hi,

I'm trying to put custom text on my home page but I want it to be below the product sections (featured products, etc.)

Here's what I did:

I put my custom text in define_main_page.php

This made the text show up on the home page above the Featured Products.

So then I edited (mytemplate)/tpl_index_default.php

I found this section that controls displaying the defined text (when I delete these lines, the defined text disappears):
<?php if (DEFINE_MAIN_PAGE_STATUS >= 1 and DEFINE_MAIN_PAGE_STATUS <= 2) { ?>
<?php
/**
 * get the Define Main Page Text
 */
?>
<div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div>
<?php } ?>


Now it would be logical to assume that if I move that entire section to below the code which displays the featured products, I should get the result I want, right? wrong.

For some reason when I move that block of code to below this block of code:
<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_FEATURED_PRODUCTS') { ?>
<?php
/**
 * display the Featured Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?>
<?php } ?>


it has the odd and frustrating behavior of displaying my custom text TWICE--once below the featured section and once above it.

I double-checked that I actually moved the code, not copied it.

Can anyone shed some light on this?
07 Sep 2010, 01:11
#2
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Posts:
7,017
Plugin Contributions:
12

Re: Custom Text Below Featured Product on Home Page

susb8383:

Hi,

I'm trying to put custom text on my home page but I want it to be below the product sections (featured products, etc.)

Here's what I did:

I put my custom text in define_main_page.php

This made the text show up on the home page above the Featured Products.

So then I edited (mytemplate)/tpl_index_default.php

I found this section that controls displaying the defined text (when I delete these lines, the defined text disappears):
<?php if (DEFINE_MAIN_PAGE_STATUS >= 1 and DEFINE_MAIN_PAGE_STATUS <= 2) { ?>
<?php
/**
 * get the Define Main Page Text
 */
?>
<div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div>
<?php } ?>


Now it would be logical to assume that if I move that entire section to below the code which displays the featured products, I should get the result I want, right? wrong.

For some reason when I move that block of code to below this block of code:
<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_FEATURED_PRODUCTS') { ?>
<?php
/**
 * display the Featured Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?>
<?php } ?>


it has the odd and frustrating behavior of displaying my custom text TWICE--once below the featured section and once above it.

I double-checked that I actually moved the code, not copied it.

Can anyone shed some light on this?


Did you also make this change to (mytemplate)/tpl_index_categories.php
07 Sep 2010, 22:21
#3
susb8383 avatar

susb8383

Zen Follower

Join Date:
Feb 2008
Posts:
129
Plugin Contributions:
0

Re: Custom Text Below Featured Product on Home Page

clydejones:

Did you also make this change to (mytemplate)/tpl_index_categories.php


I just tried that--no difference. It still shows my defined text twice, once above and once below the featured products section.
08 Sep 2010, 04:59
#4
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Posts:
7,017
Plugin Contributions:
12

Re: Custom Text Below Featured Product on Home Page

susb8383:

I just tried that--no difference. It still shows my defined text twice, once above and once below the featured products section.


Sounds like you copied the section to a new location but didn't delete it from the old location.
08 Sep 2010, 05:50
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

Re: Custom Text Below Featured Product on Home Page

The whole rest of the file after the define page output is a while() loop, so moving the define content anywhere inside that will display it as many times as the loop executes.You need to put it at the bottom of the file, just above the </div>.[php]<?php
$show_display_category->MoveNext();
} // !EOF
?>
</div>[/php]
[php]<?php
$show_display_category->MoveNext();
} // !EOF end of while loop
?>

<?php if (DEFINE_MAIN_PAGE_STATUS >= 1 and DEFINE_MAIN_PAGE_STATUS <= 2) { ?>
<?php
/**
* get the Define Main Page Text
*/
?>
<div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div>
<?php } ?>

</div>[/php]
11 Sep 2010, 16:57
#6
susb8383 avatar

susb8383

Zen Follower

Join Date:
Feb 2008
Posts:
129
Plugin Contributions:
0

Re: Custom Text Below Featured Product on Home Page

gjh42:

The whole rest of the file after the define page output is a while() loop, so moving the define content anywhere inside that will display it as many times as the loop executes.You need to put it at the bottom of the file, just above the </div>.


Bingo!! Thanks, Glenn!

--Susie
12 Sep 2010, 21:00
#7
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Custom Text Below Featured Product on Home Page

Just thought I'd mention that I just used one of the Footer Banners to put content below my featured products on the homepage.

Didn't really want to go customising code for something this basic.

See: http://rawrocks.com
13 Sep 2010, 23:31
#8
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Custom Text Below Featured Product on Home Page

Oops, but unfortunately it puts the text (banner) on the bottom of all pages!

Is there a way of excluding the banners from showing on certain pages (i.e. all pages other than the home page)?
13 Sep 2010, 23:43
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

Re: Custom Text Below Featured Product on Home Page

One of the banner's files (module or template, I don't know which in this case) will most likely have a conditional for determining whether the banner displays, something like

if (SHOW_BANNER_WHATEVER...){
//execute banner code
}

You can add to the conditional a test for whether it is the home page

if (SHOW_BANNER_WHATEVER and $this_is_home_page){
//execute banner code
}

This principle would have to be tailored to the actual code in your banner file.
14 Sep 2010, 19:52
#10
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Custom Text Below Featured Product on Home Page

Thanks GJH,

I didn't really want to change code, but I did in the end. Here's what I opted for...


In /includes/templates/[my template]/common/tpl_main_page.php

I changed line 133 from:

[PHP]<div id="bannerFour" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>[/PHP]

To:

[PHP]<div id="bannerFour" class="banners"><?php eval("?>" . zen_display_banner('static', $banner) . "<?php "); ?></div>[/PHP]

Putting the 'eval' function in there allows me to write PHP code into my banner itself. This is a slight security risk, but as I'm not offering external advertising or whatnot it shouldn't be an issue as I have sole control over the banner content.

Now, in my banner, I put the following:

[PHP]<?php if ($this_is_home_page){ ?>

<div style="padding-left: 30px; clear: both;">
Some html and stuff here.
</div>

<?php
}
?>[/PHP]

So now I can control where the banner is shown from within the banner itself. Job's a good'un!
22 Feb 2011, 00:24
#11
wsterling avatar

wsterling

New Zenner

Join Date:
Feb 2011
Posts:
4
Plugin Contributions:
0

Re: Custom Text Below Featured Product on Home Page

That works!

Thank you so much.
22 Feb 2011, 00:38
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

Re: Custom Text Below Featured Product on Home Page

If you want to dedicate bannerWhatever to this homepage output, it would be simpler to just add
and $this_is_home_page
to this as shown:
[php]<?php
if (SHOW_BANNERS_GROUP_SET4 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET4) and $this_is_home_page) {
if ($banner->RecordCount() > 0) {
?>
<div id="bannerFour" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
<?php
}
}[/php]No other code/work required.