![]() |
![]() |
![]() |
|
|||||||
| Existing Templates Want to adjust logo or center some piece of text in your directory? Get advice on how to do it in this forum dedicated to pre-installed templates. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Join Date: Sep 2008
Posts: 5
![]() |
Hi,
I've just started playing with omega (esyndicat v 1.6) and I'm using the Glassy template. I've looked through the forums but cannot find how to: - add the latest 4/5 new listings to the homepage so that they're shown under the categories. Could someone please let me know how I could achieve this? Thank you. |
|
|
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi spuby and welcome to our forum!
![]() Please apply directives: Open index.php file Find code: Code:
$gDirSmarty->assign_by_ref('listings', $listings);
Code:
$new_listings = $Listing->getLatest( 0,5 );
$c = count($new_listings);
for($i=0; $i < $c; $i++)
{
if(!empty($new_listings[$i]['path']))
{
$new_listings[$i]['path'] .= '/';
}
}
$gDirSmarty->assign('new_listings', $new_listings);
Then open templates/Your_template/index.tpl file Find categories code there Code:
{if $categories}
{include file="box-header.tpl" caption=$lang.categories}
{$categories}
{include file="box-footer.tpl"}
{/if}
Code:
{if $new_listings}
{include file="box-header.tpl" caption=$lang.new_listings}
<div class="listings">
<table cellspacing="0" cellpadding="0">
{foreach from=$new_listings item=listing}
{include file="listing-display.tpl"}
{/foreach}
</table>
</div>
{include file="box-footer.tpl"}
{/if}
|
|
|
|
#3 |
|
Join Date: Sep 2008
Posts: 5
![]() |
Thank you! This worked perfectly.
|
|
|
|
|
|
#4 |
|
Join Date: Sep 2008
Posts: 5
![]() |
Hi,
Actually I spoke too soon. Now the New listings show on the maing page correctly, but the link for Listing Details gives a 404. I use mod_rewrite so the url should be categorypath/title-something.html, instead on the homepage is categorypathtitle-something.html (the / is missing). Do you have any ideas how I could correct this? Thank you. |
|
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
Add
Code:
$c = count($new_listings);
for($i=0; $i < $c; $i++)
{
if(!empty($new_listings[$i]['path']))
{
$new_listings[$i]['path'] .= '/';
}
}
Code:
$new_listings = $Listing->getLatest( 0,5 ); |
|
|
|
#6 |
|
Join Date: Sep 2008
Posts: 5
![]() |
Hi,
Thank you, that worked and the link is correct now. However, it seems that now the New Listings section shows on every category page too, can it be shown only on the main page? Sorry for troubling you that much. |
|
|
|
|
|
#7 |
|
Join Date: Nov 2007
Location: Earth
Posts: 973
![]() |
Hi,
You should edit index.tpl. Code:
{$category.id eq 0}
{if $new_listings}
{include file="box-header.tpl" caption=$lang.new_listings}
<div class="listings">
<table cellspacing="0" cellpadding="0">
{foreach from=$new_listings item=listing}
{include file="listing-display.tpl"}
{/foreach}
</table>
</div>
{include file="box-footer.tpl"}
{/if}
{if}
|
|
|
|
|
|
#8 |
|
Join Date: Sep 2008
Posts: 5
![]() |
This time it all worked. Thank you.
P.S. Actually in your code there should be a starting {if} for the category match, but I figured it out. Thanks. |
|
|
|
|
|
#9 |
|
Join Date: Nov 2007
Location: Earth
Posts: 973
![]() |
You a welcome.
|
|
|
|
|
|
#10 |
|
Join Date: May 2010
Posts: 2
![]() |
Omega 1.6 - when I use this code page is blank
, what is wrong ? |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|