MyBB Hacks

Full Version: PHP in Templates / Complex Templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
I downloaded your plugin recently and after I added some codes it shows up this error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /*******/boards/inc/functions_post.php(714) : eval()'d code on line 8

and here is the code:

Code:
<br />{$attachment['icon']}&nbsp;&nbsp;<a href="attachment.php?aid={$attachment['aid']}" target="_blank">{$attachment['filename']}</a> ({$lang->postbit_attachment_size} {$attachment['filesize']} / {$lang->postbit_attachment_downloads} {$attachment['downloads']} 
<?php

   $affected_fids = explode(',', $mybb->settings['newpoints_atcost_forums']);
   if (in_array($fid, $affected_fids)){

   $attach_id = $attachment['aid'];
   $attach_check = $db->query("SELECT * FROM mybb_newpoints_attachments WHERE AID='$attach_id'");
   $rows = $db->num_rows($attach_check);
   if ($rows > 0){
    $attach_cost = $db->fetch_field($attach_check, "cost");
    $attachment_cost_points = "/ <font color='red'>Cost:</font> ".$attach_cost;
}
}
?>
)


from template "postbit_attachments_attachment"

i don't know why but there maybe something wrong with my code? i try using that code in a separate php and it shows no errors.. I also try using the global variables like $mybb and $db still same error occurs on the same line.

What might be the error?? or a mis code function maybe?

I tried your exact code and I don't get that issue here. (you do need to global $db)

Can you try it on a clean/test forum? (you'll probably get a query error, but that's okay)
i try using it in a test forum

and MyBB Shows me this error:

Error Type:
Catchable Fatal Error (4096)
Error Message:
Object of class MyBB could not be converted to string
Location:
File: inc/functions_post.php(714) : eval()'d code
Line: 4

EDIT:
I try using
$db->simple_select() and the errors are remove but it does not output anything T_T (or the value what I want to be printed)

@__________@
(11-16-2010 03:01 PM)jim7777 Wrote: [ -> ]i try using it in a test forum

and MyBB Shows me this error:

Error Type:
Catchable Fatal Error (4096)
Error Message:
Object of class MyBB could not be converted to string
Location:
File: inc/functions_post.php(714) : eval()'d code
Line: 4
I suspect you've miscopied the above code...

(11-16-2010 03:01 PM)jim7777 Wrote: [ -> ]EDIT:
I try using
$db->simple_select() and the errors are remove but it does not output anything T_T (or the value what I want to be printed)
No, your code doesn't output anything.
You need to use echo before you see any output.
i get this variable: $attachment_cost_points and nothing comes

anyways I managed to fix it by re-uploading it again

tnx!
A variable is a variable.  It's just a piece of data unless you tell the system you want this piece of data displayed.

You probably want to add this somewhere.

PHP Code:
echo $attachment_cost_points;

Abother usefull plugin
Thank so much
After activating plugin, I get fellowing error:

Code:
Fatal error: Cannot redeclare phptpl_parsetpl() (previously declared in H:\xampplite\htdocs\mybb\inc\plugins\pl9forumicons.php:74) in H:\xampplite\htdocs\mybb\inc\plugins\phptpl.php on line 102

If you are using the original pl9forumicons plugin, maybe this post will help you:
http://mybbhacks.zingaburga.com/showthre...http://mybbhacks.zingaburga.com/showthread.php?tid=288&pid=20
Thans RateU
Worked fine !!!!
Does this plugin supports arrays Yumi ?? Like <if in_array($allowed,$denied)>THEN DO SOMETHING</if>
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Reference URL's