MOD Display new links on index page - eSyndiCat User Forums
eSyndiCat User Forums esyndicat directory software esyndicat support

Go Back   eSyndiCat User Forums > eSyndiCat Directory Software [FREE] > Modifications

Modifications Simple to complex modifications, made by users or by our team, applied to logic or presentation, all kinds of modifications are discussed and requested here.

Reply
 
Thread Tools Display Modes
Old 05-29-2006   #1
Greg
Super Moderator
 
Greg's Avatar
 
Join Date: Oct 2005
Location: Phoenix,Arizona (Valley of the Sun)
Posts: 5,358
Greg is a jewel in the roughGreg is a jewel in the roughGreg is a jewel in the roughGreg is a jewel in the rough
Default MOD Display new links on index page

Mod by "Vincent Wright"

Here is a quick mod that displays new links on index page. But first, let me explain how it works. It uses the same mechanism to display a list of links that is used in any subcategory. But instead of subcategory links we substitute new links. Only slight changes are necessary to achieve the effect.

Ok, let's jump straight to the gory details.

1. Open index.php in your directory script root folder. Go to the very bottom. Right before the last two lines of code:

Code:
$gDirSmarty->display("index{$templ}.tpl");
?>
insert this snippet:

Code:
if (0 == $category['id'])
{
    $new_links =& $gDirDb->getNewLinks(0, 5);
    $gDirSmarty->assign_by_ref('links', $new_links);
    $gDirSmarty->assign('show_as_new', true);
}
The condition 0 == $category['id'] means this is ROOT category, or index page. In the block below new links are fetched. I used 5 as the number of new links to return from getNewLinks() function call. You can vary this number if you need more or less new links on index page.

The next two lines assign Smarty variables. An important variable here is 'show_as_new' -- this is a flag to differentiate between regular and new links because the same template is used to display both. Well, it's use is described below. Read on....

... but before, save changes to index.php and close the file.

2. The next step is to slightly adjust template file. Go to your template folder. By default it is templates/GreenLeaves. Open index.tpl file.

Find the piece of code that displays links. In my distribution it is line 20 and starts like this:

Code:
{if $links}
    <div class="box">
        <div class="box-caption-right">
            <div class="box-caption-left">
                <div class="box-caption">{$lang.links}</div>
            </div>
        </div>
        <div class="box-content">
The line in bold gets replaced with the line below (in bold as well):

Code:
{if $links}
    <div class="box">
        <div class="box-caption-right">
            <div class="box-caption-left">
                <div class="box-caption">{if $show_as_new}{$lang.new_links}{else}{$lang.links}{/if}</div>
            </div>
        </div>
        <div class="box-content">
You see, we only had to change one line of code in the template file to complete this mod. This line displays block title correctly -- "Links" for regular pages (subcategory pages) and "New Links" for index page.

Save changes, close the index.tpl file and give it a try!

Is it what you wanted to see? Yes? Great!

P.S.
If you have trouble implementing this mod feel free to ask.
__________________
Please don't ask me about script questions or sales issues through "Private Messages". Thanks!
Greg is offline   Reply With Quote
Old 06-07-2006   #2
Vasily B.
Administrator
 
Vasily B.'s Avatar
 
Join Date: Sep 2005
Posts: 9,291
Vasily B. is on a distinguished roadVasily B. is on a distinguished roadVasily B. is on a distinguished roadVasily B. is on a distinguished roadVasily B. is on a distinguished roadVasily B. is on a distinguished road
Default

I have just sticked this thread. It seems to be useful
__________________
Subrion CMS - free open source php content management system
Business Directory Script - powerful php business directory software, Yellow Pages Script - the most advanced yellow pages php software
Vasily B. is offline   Reply With Quote
Old 11-25-2006   #3
David Marshall
 
Join Date: Feb 2006
Location: Canada
Posts: 8
David Marshall
Thumbs up version 2.0.01

Excellent info,have just used this with version 2.0.01 and works great.........
http://linkerman.com
__________________
http://LinkerMan.com
David Marshall is offline   Reply With Quote
Old 12-05-2006   #4
Cris Santos
 
Join Date: May 2006
Posts: 172
Cris Santos is an unknown quantity at this point
Default

Having problem with this mod in my v.2 greenleaves template.

I have the following layout :
{if $category.id == 0} my article {/if}

<div>{if $links}
{if $show_as_new}{$lang.new_links}{else}{$lang.links}{/if}
</div>


{if $category.id == 0} my 2nd article {/if}

All worked fine til i added this mod.
Now i'm getting the following error :

Quote:
Fatal error: Smarty error: [in index.tpl line 94]: syntax error: unclosed tag {if} (opened line 34). (Smarty_Compiler.class.php, line 320) in /home/cristina/public_html/news/smarty/Smarty.class.php on line 1095
Thing is, all {if}'s are closed...why is smarty not recognizing this?
Cris Santos is offline   Reply With Quote
Old 12-05-2006   #5
Dave Baker
 
Join Date: Jul 2006
Location: St. Petersburg
Posts: 2,567
Dave Baker is on a distinguished road
Default

Hello Cris,
This modification made for version 2.0:
http://www.esyndicat.com/forum/about7600.html
Please try to check it.
Dave Baker is offline   Reply With Quote
Old 12-05-2006   #6
Cris Santos
 
Join Date: May 2006
Posts: 172
Cris Santos is an unknown quantity at this point
Default

Hi Dave - The mod you mention doesnt work for me since, as explained, the links should appear in the middle of the index (between 2 articles)...


David Marshall made it work...
Anybody??

Last edited by Cris Santos; 12-05-2006 at 04:33 PM.
Cris Santos is offline   Reply With Quote
Old 12-05-2006   #7
Dave Baker
 
Join Date: Jul 2006
Location: St. Petersburg
Posts: 2,567
Dave Baker is on a distinguished road
Default

It seems the code selected with red color is "unclosed tag"
Code:
{if $category.id == 0} my article {/if}

<div>{if $links}
{if $show_as_new}{$lang.new_links}{else}{$lang.links}{ /if}
</div>

{if $category.id == 0} my 2nd article {/if}
Maybe your code must be similar to the following:
Code:
{if $category.id == 0} my article {/if}

<div>{if $links}
{if $show_as_new}{$lang.new_links}{else}{$lang.links}{ /if}
{/if}</div>

{if $category.id == 0} my 2nd article {/if}
Dave Baker is offline   Reply With Quote
Old 12-19-2006   #8
Joe Boxer
 
Join Date: Nov 2006
Posts: 10
Joe Boxer is on a distinguished road
Default

Very nice mod, thanks.

Joe
Joe Boxer is offline   Reply With Quote
Old 02-21-2007   #9
webvivre
 
Join Date: Nov 2006
Posts: 45
webvivre is on a distinguished road
Default

How can we have this feature in v2.1?
__________________
Howard

mySer
mySER - Links Directory | Bid for Position Directory
webvivre is offline   Reply With Quote
Old 02-23-2007   #10
Shunny
 
Join Date: Jan 2007
Location: Sydney
Posts: 83
Shunny is on a distinguished road
Default

Yes this is a feature I am looking for too can someone give the details for 2.1.01
Shunny is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How I can display "new links" at index page? ultimate Common Questions 14 08-23-2006 08:18 AM
Adding New Links display on index page is it possible? 90210 Modifications 10 05-30-2006 02:36 AM
Links on index page? nunio Common Questions 9 05-29-2006 01:49 AM
modify design on the index page and category page tadisaus2 User interface 2 05-19-2006 04:22 PM
How to don't redirect on index page if 404 error. Satyapal Common Questions 3 01-01-1970 12:31 AM


All times are GMT. The time now is 02:26 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Testimonials | Articles | Support | Documentation | Privacy Policy | License | Affiliates | Contact Us