Go Back   PHP Link Directory Forum > PHP Link Directory (phpLD) > Mods and contribution Discussion

Mods and contribution Discussion This forum is only for discussion of modding phpLD. For specific mod releases, please see the appropriate forum.

Closed Thread
 
Thread Tools Display Modes
Old 03-01-2006   #1
Jappi
 
Join Date: Feb 2006
Location: Berlin
Posts: 6
Default [Mod] Add Statistics to Homepage

Hi,

I don't know, if anybody use tis small Mod.

{image broken and removed}

By this way, thanks to all people who develop mods and send tips.

Jappi

Sorry, that I announce myself only today

At first create a new File like "statistic.php", insert following Code:
Code:
<?PHP
//Statistik
$total_links = $db->GetOne("SELECT COUNT(*) FROM `{$tables['link']['name']}` WHERE `STATUS` = 2");
$tpl->assign('total_links', $total_links);
 
$pending_links = $db->GetOne("SELECT COUNT(*) FROM `{$tables['link']['name']}` WHERE `STATUS` = 1");
$tpl->assign('pending_links', $pending_links);
 
$today_links = $db->GetOne("SELECT COUNT(*) FROM `{$tables['link']['name']}` WHERE `DATE_ADDED` >= CURRENT_DATE");
$tpl->assign('today_links', $today_links);
 
$categorys = $db->GetOne("SELECT COUNT(*) FROM `{$tables['category']['name']}` WHERE `PARENT_ID` = 0 ");
$tpl->assign('categorys', $categorys);
 
$subcategorys = $db->GetOne("SELECT COUNT(*) FROM `{$tables['category']['name']}` WHERE `PARENT_ID` > 0 ");
$tpl->assign('subcategorys', $subcategorys);
//Ende Statistik
?>
next open index.php and search for:

// Paging 4
$tpl->assign('list_total', count($count));
// End Paging 4

and insert Code below.

Code:
require_once 'statistic.php';
Now you can use the 5 variables in your templates whereever you want.

For example in my left.tpl:

<p id="statistic">
<span class="statistic">
{$categorys}

{$subcategorys}


{$total_links}

{$pending_links}

{$today_links}

</span>
{l}Categorys:{/l}

{l}Subcategorys:{/l}

{l}Entries{/l}

{l}Total:{/l}

{l}Pending:{/l}

{l}Today:{/l}
</p>

If you want use this Layout, insert in your main.css:

#statistic {
margin: 0px;
padding: 13px;
border: 1px solid #8B008B;
font-size: 7pt;
line-height: 12px;
}
.statistic {
float: right;
font-weight: bold;
padding-right: 5px;
text-align: right;
}

Ok, have fun

I hope phpLD 3.0 use the same tablefields as 2.0

Jappi

Last edited by David; 08-17-2009 at 08:02 PM.
Jappi is offline  
Old 03-02-2006   #2
Jappi
 
Join Date: Feb 2006
Location: Berlin
Posts: 6
Default Correction

Sorry, i mean naturally, need and not to use.

Simply Integration.
Sorry for my bad english, look at my sign :roll:

Jappi
Jappi is offline  
Old 03-13-2006   #3
bobby9101
 
bobby9101's Avatar
 
Join Date: Sep 2005
Posts: 678
Default

i would use it if you could send the code
__________________
Please check your sig links
bobby9101 is offline  
Old 03-14-2006   #4
tomsa
Mentor
 
Join Date: Feb 2006
Posts: 257
Default

yes, if you release a mod i think i will use it
tomsa is offline  
Old 03-17-2006   #5
Jappi
 
Join Date: Feb 2006
Location: Berlin
Posts: 6
Default

Sorry, that I announce myself only today

At first create a new File like "statistic.php", insert following Code:
Code:
<?PHP
//Statistik
$total_links = $db->GetOne("SELECT COUNT(*) FROM `{$tables['link']['name']}` WHERE `STATUS` = 2");
$tpl->assign('total_links', $total_links);

$pending_links = $db->GetOne("SELECT COUNT(*) FROM `{$tables['link']['name']}` WHERE `STATUS` = 1");
$tpl->assign('pending_links', $pending_links);

$today_links = $db->GetOne("SELECT COUNT(*) FROM `{$tables['link']['name']}` WHERE `DATE_ADDED` >= CURRENT_DATE");
$tpl->assign('today_links', $today_links);

$categorys = $db->GetOne("SELECT COUNT(*) FROM `{$tables['category']['name']}` WHERE `PARENT_ID` = 0 ");
$tpl->assign('categorys', $categorys);

$subcategorys = $db->GetOne("SELECT COUNT(*) FROM `{$tables['category']['name']}` WHERE `PARENT_ID` > 0 ");
$tpl->assign('subcategorys', $subcategorys);
//Ende Statistik
?>
next open index.php and search for:

// Paging 4
$tpl->assign('list_total', count($count));
// End Paging 4

and insert Code below.

Code:
require_once 'statistic.php';
Now you can use the 5 variables in your templates whereever you want.

For example in my left.tpl:

<p id="statistic">
<span class="statistic">
{$categorys}

{$subcategorys}


{$total_links}

{$pending_links}

{$today_links}

</span>
{l}Categorys:{/l}

{l}Subcategorys:{/l}

{l}Entries{/l}

{l}Total:{/l}

{l}Pending:{/l}

{l}Today:{/l}
</p>

If you want use this Layout, insert in your main.css:

#statistic {
margin: 0px;
padding: 13px;
border: 1px solid #8B008B;
font-size: 7pt;
line-height: 12px;
}
.statistic {
float: right;
font-weight: bold;
padding-right: 5px;
text-align: right;
}

Ok, have fun

I hope phpLD 3.0 use the same tablefields as 2.0

Jappi
Jappi is offline  
Old 06-11-2006   #6
Momo
 
Join Date: May 2006
Posts: 29
Default

Thanks a lot for this mod, I have used this for the statistics on my directory: http://ipage.info
Momo is offline  
Old 06-19-2006   #7
rogue
 
Join Date: May 2006
Posts: 18
Default

many thanks, a complete script idiot like me got this up and running!
rogue is offline  
Old 06-19-2006   #8
anon
Supporter
 
anon's Avatar
 
Join Date: Feb 2006
Location: As far from you as humanly possible!
Posts: 2,893
Send a message via Yahoo to anon
Default

bah! don't be so hard on yourself. Just think of it as not being versed enough(yet)

Last edited by David; 08-17-2009 at 08:02 PM.
anon is offline  
Old 06-19-2006   #9
bobby9101
 
bobby9101's Avatar
 
Join Date: Sep 2005
Posts: 678
Default

yeah i once was terrible at scripting i am not really that good yet
but hey i am coming along
__________________
Please check your sig links
bobby9101 is offline  
Old 06-23-2006   #10
kentuckyslone
 
Join Date: May 2006
Posts: 66
Default

I am using 3.0.4 I could not locate

// Paging 4
$tpl->assign('list_total', count($count));
// End Paging 4

anywhere in index.php

Am I missing something or is this for a different version?
I would like to use this if I can make it work.

Thanks!
kentuckyslone is offline  
Old 06-24-2006   #11
neurosis4u
Moderator
 
neurosis4u's Avatar
 
Join Date: Mar 2006
Location: Germany
Posts: 1,056
Send a message via MSN to neurosis4u Send a message via Yahoo to neurosis4u
Default

i have it working with a little change...

instead of building a new php file called statistics.php i put the code for this file directly in index php, right above
echo $tpl->fetch('main.tpl', $id);
__________________
If you want to make me happy, send much money with PayPAl to: admin(@)ohneschufaweb.de
Mein Spendenkonto ist bei PayPal zu erreichen: admin(@)ohneschufaweb.de

http://www.ohneschufaweb.de


neurosis4u is offline  
Old 06-29-2006   #12
mrbadgolf
 
Join Date: May 2006
Posts: 89
Default

I cannot find that in 3.04 either
__________________
-------------------------
Mrbadgolf

Note to mrbadgolf: the links in your sig were removed because they were not working or incomplete. Feel free to re-add them when everything working okay again.
mrbadgolf is offline  
Old 06-29-2006   #13
neurosis4u
Moderator
 
neurosis4u's Avatar
 
Join Date: Mar 2006
Location: Germany
Posts: 1,056
Send a message via MSN to neurosis4u Send a message via Yahoo to neurosis4u
Default

look at the end of the file

//Make output
echo $tpl->fetch ('main.tpl', $id);
__________________
If you want to make me happy, send much money with PayPAl to: admin(@)ohneschufaweb.de
Mein Spendenkonto ist bei PayPal zu erreichen: admin(@)ohneschufaweb.de

http://www.ohneschufaweb.de


neurosis4u is offline  
Old 06-29-2006   #14
mrbadgolf
 
Join Date: May 2006
Posts: 89
Default

Im sorry, didnt make myself clear, I cannot locate

// Paging 4
$tpl->assign('list_total', count($count));
// End Paging 4

in the index.php file of 3.0.4
__________________
-------------------------
Mrbadgolf

Note to mrbadgolf: the links in your sig were removed because they were not working or incomplete. Feel free to re-add them when everything working okay again.
mrbadgolf is offline  
Old 07-03-2006   #15
Irka
 
Irka's Avatar
 
Join Date: Jun 2006
Posts: 141
Default

Very coooooool mod!!! Super i'll use it for all my sites !!!!!
__________________
Free PHPLD Templates at PHPLD Your Site
Submit Your Sites: Irka Web Directory | The Squat
Note to irka: a couple of links were removed because they were not working when we checked them
Irka is offline  
Old 07-04-2006   #16
arindra
 
Join Date: May 2006
Location: India
Posts: 253
Send a message via Skype™ to arindra
Default

very nice mod.
__________________
check your links - malware detected
arindra is offline  
Old 07-04-2006   #17
balkanboy
Supporter
 
Join Date: Nov 2005
Posts: 196
Send a message via MSN to balkanboy
Default

I used this mod in new design I am making. It will be available for free at www.phpldtemplates.info
I changed html code and css also to make better control of it. You can see work in progres here: http://img63.imageshack.us/img63/5756/screen0tr.gif
Also tell me your homepage url so I can credit you on my site when I release this one.
balkanboy is offline  
Old 07-06-2006   #18
CyberGrenade
 
Join Date: Jul 2006
Posts: 13
Default Thanks....

Thanks for the MOD. This opens up lots of doors. You can use this to get lots of data and display it on the main pages.

Thanks for the ideas.
__________________
http://www.cybergrenade.com

I also enjoy photography.
CyberGrenade is offline  
Old 07-21-2006   #19
devilishqueen
 
devilishqueen's Avatar
 
Join Date: Jul 2006
Location: down under!!!!!!!!!
Posts: 14
Send a message via Skype™ to devilishqueen
Default

which folder should create that statistic.php file? root?
devilishqueen is offline  
Old 07-21-2006   #20
bobby9101
 
bobby9101's Avatar
 
Join Date: Sep 2005
Posts: 678
Default

yeah in root
__________________
Please check your sig links
bobby9101 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Alter the homepage renfrompenn Support (Version 2) 2 03-22-2006 02:33 PM
Display total number of links on homepage? john34 Support (Version 2) 10 02-25-2006 09:58 PM
Show mod only on homepage ZOMP Support (Version 2) 2 01-09-2006 04:59 AM
Place you banner on my homepage permanently! =) Nobody PHPLD Community 2 10-27-2005 12:11 AM


All times are GMT +1. The time now is 01:05 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.