View Single Post
  #1366  
Old 03-08-2006, 03:47 AM
Langly Langly is offline
 
Join Date: Dec 2005
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is to help others that might want to use LDM to post on the portal like vbportal as a center block. It will display the latest uploads/links submitted. The code is 100% by Nitro at vbportal; I'm just copying it here so others might be able to use it as well.

Add a new php Center block in portalCP
Uses templates: Yes
Name: what you like

PHP Code:
global $db$vboptions$vbulletin$vbphrase$vbpoptions;

$link_query $db->query_read("SELECT * 
                FROM " 
TABLE_PREFIX "local_linkslink 
                WHERE linkmoderate = 0 
                ORDER BY linkdate DESC LIMIT 20"
);

while (
$linkinfo $db->fetch_array($link_query))
{
    
$linkname $linkinfo['linkname'];
    
$linkdate date("d-m-y"$linkinfo['linkdate']);
    
$linkuser $linkinfo['linkusername'];
    
$linksize $linkinfo['linksize']/1000/1000;
    
$linkid $linkinfo['linkid'];
    {
    if (
$link_cats $db->query_read("SELECT local_linkscat.catid, local_linkscat.catname FROM " TABLE_PREFIX "local_linkscat
                    LEFT JOIN " 
TABLE_PREFIX "local_linksltoc AS local_linksltoc ON local_linksltoc.catid = local_linkscat.catid 
                    WHERE local_linksltoc.linkid = " 
$linkid ""));

        {
        while (
$catinfo $db->fetch_array($link_cats))

            {
            
$linkcatid $catinfo['catid'];
            
$linkcatname $catinfo['catname'];
            eval(
'$latestldm_new .= "' fetch_template('P_ldm_new') . '";');
            }
        }
    }
}

return <<<EOT
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr align="center">
<td class="thead">&nbsp;</td><td class="thead">Name</td><td class="thead">Date</td><td class="thead">Submitter</td><td class="thead">Filesize</td><td class="thead">Categroy</td></tr>

<tr align="center">
    
$latestldm_new
</tr>
</table>
EOT;
$db->free_result($link_query$link_cats); 
PS ignore the "<?php BEGIN__VBULLETIN__CODE__SNIPPET " portion at the begining theres a bug in vb's php bbcode wrapper which does this its not supposed to be visible


Add a new template P_ldm_new

Code:
<tr><td width="20" class="alt1"><img src="$stylevar[imgdir_attach]/attach.gif" alt=""></td><td class="alt1">$linkname<br /><smallfont>Hits: $linkinfo[linkhits]&nbsp;Rating: $linkinfo[totrate]</smallfont></td><td class="alt2">$linkdate</td><td class="alt1">$linkuser</td><td class="alt2">$linksize&nbsp;MB</td><td class="alt1"><a href="$vbpoptions[bbdir]/local_links.php?catid=$linkcatid">$linkcatname</a></td></tr>
To change the amount listed first query "LIMIT 20" change the 20 to what you want

If you want to order by rating or hits first query again the "ORDER BY linkdate" change linkdate to linkhits for hit count or totrate for top rated.

I use it on my site and it works great. Thanks for working on that for me Nitro.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01266 seconds
  • Memory Usage 1,794KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete