same problem.
Code:
Parse error: syntax error, unexpected T_STRING in /home/*****/public_html/forums/global.php(523) : eval()'d code(1) : eval()'d code on line 1
|
(01-21-2012 08:14 AM)ZiNgA BuRgA Wrote: [ -> ]Revert your headerinclude, gobutton, htmldoctype and header templates.
ask :
What template are you referring to? GoMobile or default template that is used?
^@
In GoMobile template -> htmldoctype
Delete this code:
Code:
<?xml version="1.0" encoding="UTF-8"?>
|
I am trying to use PHP to call something from the database, find a SteamID, search this in another table and put it out.
This is my current code, template: (prefix)_postbit_first:
Code:
{$ignore_bit}
<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
<tbody>
<tr>
<td class="tcat">
<div class="float_left smalltext">
{$post['postdate']}, {$post['posttime']} <span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span>
</div>
{$post['posturl']}
</td>
</tr>
<tr>
<td class="trow1 {$unapaproved_shade}">
<table cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
<tr>
<td class="post_avatar" width="1" style="{$post['avatar_padding']}">
{$post['useravatar']}
</td>
<td class="post_author">
<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
<span class="smalltext">
{$post['usertitle']}<br />
{$post['userstars']}
{$post['groupimage']}
</span>
</td>
<td class="smalltext post_author_info" width="165">
{$post['user_details']}
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="trow2 post_content {$unapproved_shade}">
<span class="smalltext"><strong>{$post['subject']} | {$GLOBALS['threadfields']['b_reason_short']}<br />{$post['subject_extra']}</strong></span>
<div class="post_body" id="pid_{$post['pid']}">
<table cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
<tr>
<td class="trow1" valign="top" width="25%"><strong>Name: </strong></td><td class="trow1" valign="top" width="75%">{$post['subject']}</td>
</tr>
<tr>
<td class="trow2" valign="top" width="25%"><strong>SteamID: </strong></td><td class="trow2" valign="top" width="75%">{$GLOBALS['threadfields']['b_steamid']}</td>
</tr>
<tr>
<td class="trow1" valign="top" width="25%"><strong>Reason to be banned (short): </strong></td><td class="trow1" valign="top" width="75%">{$GLOBALS['threadfields']['b_reason_short']}</td>
</tr>
<tr>
<td class="trow2" valign="top" width="25%"><strong>Reason to be banned: </strong></td><td class="trow2" valign="top" width="75%">{$GLOBALS['threadfields']['b_reason']}</td>
</tr>
<tr>
<td class="trow1" valign="top" width="25%"><strong>Evidence: </strong></td><td class="trow1" valign="top" width="75%">{$GLOBALS['threadfields']['b_evidence']}</td>
</tr>
<tr>
<td class="trow2" valign="top" width="25%"><strong>Note to moderator: </strong></td><td class="trow2" valign="top" width="75%">{$GLOBALS['threadfields']['b_note']}</td>
</tr>
<tr>
<td class="trow1" valign="top" width="25%"><strong>Previous bans: </strong></td><td class="trow1" valign="top" width="75%">
<?php
$SQLquery =
"
SELECT
b_steamid
FROM
mybb_threadfields_date
WHERE
tid = '" . mysql_real_escape_string($_GET['tid']) . "'
";
$resultaat = mysql_query($SQLquery) or die(mysql_error());
if(mysql_num_rows($resultaat) == 1)
{
$SQLquery =
"
SELECT
CONCAT('toggle[ban_', banid, ']') AS db_banid,
name,
steamid,
banlength
FROM
excl_bans
WHERE
steamid = '" . mysql_result($resultaat, 0, 'b_steam_id') . "'
";
$resultaat = mysql_query($SQLquery) or die(mysql_error());
if(mysql_num_rows($resultaat) > 0)
{
?>
<div id="banlist">
<div>
<table width="100%" cellspacing="0" cellpadding="0" align="center" class="listtable">
<tr>
<td width="14%" height="16" class="listtable_top" align="center"><b>Date</b></td>
<td height="16" class="listtable_top"><b>Name</b></td>
<td width="20%" height="16" class="listtable_top"><b>Admin</b></td>
<td width="10%" height="16" class="listtable_top" align="center"><b>Length</b></td>
</tr>
</table>
</div>
<?php
while ($rows = mysql_fetch_assoc($resultaat))
{
echo "<a href=\"#\" rel=\"". $rows['db_banid'] . "\"><div>\n";
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" class=\"listtable\">\n";
echo "<tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n";
echo "<td width=\"14%\" height=\"16\" align=\"center\" class=\"listtable_1\">". $rows['banlength'] . "</td>\n";
echo "<td height=\"16\" class=\"listtable_1\">". $rows['name'] . "</td>\n";
echo "<td width=\"20%\" height=\"16\" class=\"listtable_1\">Excl</td>\n";
echo "<td width=\"10%\" height=\"16\" align=\"center\" class=\"listtable_1\">". $rows['banlength'] . "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div></a>\n";
echo "<div id=\"ban_". $rows['banid'] . "\" align=\"center\">\n";
echo "<table width=\"80%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" class=\"listtable\">\n";
echo "<tr>\n";
echo "<td width=\"100%\" height=\"16\" class=\"listtable_top\" align=\"center\" colspan=\"2\"><strong>Ban Details</strong></td>\n";
echo "</tr>\n";
echo "<tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n";
echo "<td height=\"16\" width=\"20%\" class=\"listtable_1\">Name</td><td width=\"80%\" class=\"listtable_1\">". $rows['name'] . "</td>\n";
echo " </tr>\n";
echo " <tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n";
echo "<td height=\"16\" width=\"20%\" class=\"listtable_1\">SteamID</td><td width=\"80%\" class=\"listtable_1\">". $rows['steamid'] . "</td>\n";
echo " </tr>\n";
echo " <tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n";
echo " <td height=\"16\" width=\"20%\" class=\"listtable_1\">CommunityID</td><td width=\"80%\" class=\"listtable_1\">546354321354</td>\n";
echo " </tr>\n";
echo " <tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n";
echo "<td height=\"16\" width=\"20%\" class=\"listtable_1\">Banlength</td><td width=\"80%\" class=\"listtable_1\">". $rows['banlength'] . "</td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "</div>\n";
}
}
}
?>
</td>
</tr>
</table>
</div>
<div class="post_meta" id="post_meta_{$post['pid']}">
{$post['iplogged']}
</div>
</td>
</tr>
<tr>
<td class="trow1 post_buttons {$unapproved_shade}">
<div class="author_buttons float_left">
{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}
</div>
<div class="post_management_buttons float_right">{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
</div>
</td>
</tr>
</tbody>
</table>
|
For some reason the PHP doesn't work.
I get these errors:
Parse error: syntax error, unexpected $end in /home/casualbananas.com/public_html/inc/functions_post.php(645) : eval()'d code(102) : eval()'d code on line 34
Parse error: syntax error, unexpected '}' in /home/casualbananas.com/public_html/inc/functions_post.php(645) : eval()'d code(153) : eval()'d code on line 34
What am I doing wrong?
http://puu.sh/w1gJ
This is what SHOULD happen, one or multiple records (Previous bans field)
EDIT:
This problem has been solved. I accidently closed PHP after a {, because I wanted to include something that I didn't edit yet, so I wanted to place raw HTML there. Anyways, it works now!
Hey, it's me again
I was wondering if you could help me out with two snippets of code as I have absolutely no idea where to start!
Basically in the postbit and the member profile page I'm looking to establish an if conditional which will look something like this:
<if the poster/member is in X usergroup>
Content specific to that usergroup here (this is not important, I can code this)
< if poster/member is in Y usergroup>
Content specific to that usergroup here (this is not important, I can code this)
</if>
So essentially I'm looking to establish conditionals in both the postbit and the member profile page that allows different content to be shown depending on whether the poster or the member's page we're visiting is in a certain usergroup.
You can use $post['usergroup'] for postbit and $memprofile['usergroup'] for profile page.
Sorry, please excuse my ineptitude. Could you possibly help me formulate the code?
<if $mybb->$memprofile['usergroup'] == 'Administrators' then>
Content here
</if>
Have i got that way off?
Something like this (for profile page):
Code:
<if $memprofile['usergroup'] == X then>
Content for user in usergroup 4 here
</if>
|
where X is a usergroup ID.
Worked perfectly, thank you
Just a second question, I'm using the edit built on this mod which allows certain profile fields to be hidden to certain usergroups, below is the code:
PHP Code:
<?php
$groups = array('4', '6'); if ($profilefield['fid'] == FIELD_ID) {
if (in_array($mybb->user['usergroup'], $groups))
{
echo "
<tr>
<td><span class=\"smalltext\">
<a title=\"{$profilefield['description']}\" style=\"text-decoration: none;\">{$profilefield['name']}</a>:</span></td>
</tr>
<tr>
<td>{$code}</td>
</tr>
";
}
}
else {
echo "
<tr>
<td><span class=\"smalltext\">
<a title=\"{$profilefield['description']}\" style=\"text-decoration: none;\">{$profilefield['name']}</a>:</span></td>
</tr>
<tr>
<td>{$code}</td>
</tr> ";
}
?>
|
Now I have quite a lot of fields I'd like to use this on, however I'd have to repeat/else every single field. I was wondering if there was a way I could array the "if ($profilefield['fid'] == FIELD_ID)" (ie ['fid'] == 1, 2, 3, 4) to save myself a lot of hassle?
Just look at the line with in_array
PHP Code:
if (in_array($profilefield['fid'], array(1,2,3,5,8))
|