Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 04-07-2009, 03:52 PM
decipher442 decipher442 is offline
 
Join Date: Jan 2009
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
You cannot put php in a template. You need to put the php into a plugin and then put the results from the plugin into your template.
What php hook location would I select to have this display in my category bar by the collapse image?

Thanks
Reply With Quote
  #12  
Old 04-07-2009, 05:14 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Look in the forumdisplay.php page to see some hook locations and pick one that is evaled before those templates are evaled. I run my test site in debug mode which puts a list of all hook locations available on the page at the bottom. That helps a lot when trying to figure out which hook location to use.
Reply With Quote
  #13  
Old 04-08-2009, 11:57 PM
decipher442 decipher442 is offline
 
Join Date: Jan 2009
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm just not haveing any luck with this at all. :|

I know the template to edit i just do not know what hook to choose nor how to add the hook into that template where I want it displayed.

I am sure if I had the experience you had it would be more simple... but I don't.

Isn't there an easier an easier way of doing this?

maybe doing it something like seen here...
http://www.vbulletin.com/forum/showthread.php?t=113870

but obiousely displaying total threads and posts instead of a sponsor link.

Quote:
Does anyone know how I can do this?

NOTE: (Here is an example of what I would like my category bar(s) to look like...)
__________________________________________________ ______________________
[__Category_Title___________________________Threads : X,XXX, Posts: XX,XXX__[^]_]


** Threads: X,XXX, Posts: XX,XXX = Total amount of Threads and Post from all sub-forums of the category.
** [^] = category collapse image


I see that this is the PHP code I need to add.. (That displays total threads and posts)

PHP Code:
<?php 

$totalthreads 
0;  
$totalposts 0;  
if (
is_array($vbulletin->forumcache))  
{  
    foreach (
$vbulletin->forumcache AS $forum)  
    {  
        
$totalthreads += $forum['threadcount'];  
        
$totalposts += $forum['replycount'];  
    }  
}  
$totalthreads vb_number_format($totalthreads);  
$totalposts vb_number_format($totalposts);  
            </
a
  
?>



And this is the template I need to edit... (forumhome_forumbit_level1_nopost)

HTML Code:
<if condition="!$show['collapsable_forums']"> 
<tbody> 
</if> 
    <tr> 
        <td class="tcat" colspan="<if condition="$vboptions[showmoderatorcolumn]">6<else />5</if>"> 
            <if condition="$childforumbits"> 
            <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumbit_$forumid')"><img id="collapseimg_forumbit_$forumid" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a> 

            </if> 
            <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a> 
            <a style="float:$stylevar[right]"> 
            <if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if> 
            <if condition="$show['subforums']"><div class="smallfont"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if> 
        </td> 
    </tr> 
<if condition="!$show['collapsable_forums']"> 
</tbody> 
</if> 
<if condition="$childforumbits"> 
<if condition="!$show['collapsable_forums']"> 
<tbody id="collapseobj_forumbit_$forumid" style="{$collapseobj_forumid}"> 
</if> 
$childforumbits 
<if condition="!$show['collapsable_forums']"> 
</tbody> 
</if> 
</if>

From my understanding.... all I need to do now is create the plugin...
1. I DO NOT KNOW what hook to choose when creating the plugin, "Do you know?"
2. After the plugin is created what code snippet to I add into forumhome_forumbit_level1_nopost template to make the plugin work?


Quote:
NOTE: (Here is an example of what I would like my category bar(s) to look like...)
__________________________________________________ ______________________
[__Category_Title___________________________Threads : X,XXX, Posts: XX,XXX__[^]_]


** Threads: X,XXX, Posts: XX,XXX = Total amount of Threads and Post from all sub-forums of the category.
** [^] = category collapse image
Thanks!
Reply With Quote
  #14  
Old 04-09-2009, 02:55 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually, that is not the php code you need to add. I simply copied the code from index.php that shows how to get the posts and threads from the forumcache. You will need to modify that to get just the posts and threads from specific forum ids. As for plugin location, you can try forumhome_start. Like I said, look at the index page and find one that is eval before the template gets evaled.

Sorry I can't be more specific than that but I really don't know any specifics myself.
Reply With Quote
  #15  
Old 04-10-2009, 01:49 AM
decipher442 decipher442 is offline
 
Join Date: Jan 2009
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks

One question though...

After I create the plugin what line of plugin call code do I add to that template?

Thanks
Reply With Quote
  #16  
Old 04-10-2009, 02:14 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In the plugin, you will do some code and then assign the results to a variable, like $totalposts and $totalthreads. Then you would use those variables in the template.
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


All times are GMT. The time now is 03:34 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03612 seconds
  • Memory Usage 2,221KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_html
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete