The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Is it possible to parse php code in templates? Need help with PHP needs.
I am clueless on this. I have a program that I run along side vBulletin that I have integrated commenting into the forums for. This uses ezSQL to pass the data from one db to another.
What I need is to add this to my header: Code:
<?php // Include ezSQL in order to use it.. include_once '/home/mobility/domain.com/ez_sql.php'; $vb_db_prefix = '<MTVBDBPrefix>'; $vb_reply_abc = '<MTVBForumURL>'.'showthread.php?t='; $vb_reply_xyz = '&goto=newpost'; ?> Code:
<?php $vb_thread_id = <MTVBThreadID>; $vb_reply_cnt = $db->get_var("SELECT count(*)-1 FROM {$vb_db_prefix}post WHERE threadid = '$vb_thread_id'"); $vb_reply_url = $vb_reply_abc.$vb_thread_id.$vb_reply_xyz; ?> and <?php $vb_thread_id = <MTVBThreadID>; $vb_reply_cnt = $db->get_var("SELECT count(*)-1 FROM {$vb_db_prefix}post WHERE threadid = '$vb_thread_id'"); $vb_reply_url = $vb_reply_abc.$vb_thread_id.$vb_reply_xyz; if ($vb_thread_id) { ?> | <a href="<?php echo $vb_reply_url; ?>">Comments (<?php echo $vb_reply_cnt; ?>)</a> <?php } else { ?> <MTIfCommentsActive>| <a href="<$MTEntryPermalink$>#comments">Comments (<$MTEntryCommentCount$></a></MTIfCommentsActive> <?php } ?> What is happening if I add these to the header and templates now is the code is shown with some stuff stripped. Signed, Clueless |
#2
|
||||
|
||||
No, you cannot put php code in templates.
|
#3
|
|||
|
|||
Are there any alternatives?
|
#4
|
||||
|
||||
Use Hooks.
|
#5
|
|||
|
|||
Any linkable resources someone has bookmarked that can teach me a bit about Hooks? I pick up fast, but this is past my current knowledge. Thanks!
|
#6
|
||||
|
||||
Tutorial List: https://vborg.vbsupport.ru/showthread.php?t=99570
Hook Writing: https://vborg.vbsupport.ru/showthread.php?t=82625 |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|