Jump to content

Colleen78

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

Everything posted by Colleen78

  1. Wow, thank you, that's perfect, and I learned what I am doing wrong.
  2. Thank you, CV. I don't need to include the table start and end, because I have it as you'll see below, and also, this is how I included your code, I tried other ways, but keep getting an error. The error is: Parse error: syntax error, unexpected $end in /home/domain/public_html/template/hctheme/index.php on line 76 My code: <table class="newitems" cellspacing="1" cellpadding="0" border="0" bgcolor="#ffffff" align="center" width="100%" style="border: 1px solid rgb(45, 135, 7);"> <tr><td colspan="3" align="center"><strong>New Products</strong></td></tr> <?php //Specify the query $query = 'SELECT * FROM `tbl_item` where category_id not in (104,105,106,107,108,109,110,111,112,113,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,133,138,139,140) GROUP BY `item_id` ORDER BY `item_id` DESC LIMIT 3'; //Execut the query $result = mysql_query($query) or die ("Error. Unable to perform query."); //Loop through all the results, displaying each one while ($row = mysql_fetch_array($result)) $cols = 0; while ($cols < 20) { echo ($cols % 3 == 0)? "</tr><tr>" : ""; { extract($row); $item_name = str_replace(" ", "_",$item_name); echo "<td width=\"33%\" bgcolor=\"#c2edaa\" style=\"border: 1px solid rgb(45, 135, 7);\">\n"; echo "<a href=\"$URL/item/$item_name/$item_id\"><img src=\"$SSL_URL/item_images/$thumbnail_image\" width=\"110\" height=\"100\" alt=\"$short_description\" border=\"0\" /></a><br />\n"; echo "<b>$row[item_name]</b><br />\n"; echo "$row[short_description]"; echo "</td>\n"; $cols++; } ?></table> I'm not quite sure how to adapt your code into mine. ???
  3. I have this PHP code, it creates 1 row of the 3 latest new items in our shopping cart: <tr align="center" valign="top"> <?php //Specify the query $query = 'SELECT * FROM `tbl_item` where category_id not in (104,105,106,107,108,109,110,111,112,113,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,133,138,139,140) GROUP BY `item_id` ORDER BY `item_id` DESC LIMIT 3'; //Execut the query $result = mysql_query($query) or die ("Error. Unable to perform query."); //Loop through all the results, displaying each one while ($row = mysql_fetch_array($result)) { extract($row); $item_name = str_replace(" ", "_",$item_name); echo "<td width=\"33%\" bgcolor=\"#c2edaa\" style=\"border: 1px solid rgb(45, 135, 7);\">\n"; echo "<a href=\"$URL/item/$item_name/$item_id\"><img src=\"$SSL_URL/item_images/$thumbnail_image\" width=\"110\" height=\"100\" alt=\"$short_description\" border=\"0\" /></a><br />\n"; echo "<b>$row[item_name]</b><br />\n"; echo "$row[short_description]"; echo "</td>\n"; } ?></tr> But now I'd like to display 9 items, so 3 rows of 3 items per row... I don't know how to include the <tr> tag into the php to make it loop per each 3 items, does anyone have an idea how to do this? Thanks
  4. Wow, that did the trick, the errors are gone and everything's still working. Thanks so much!
  5. I am not sure what you mean, but I did notice this is happening when someone views a page which contains a link that is not an amazon link, if they view a page with an amazon link in the post, no errors, and it works fines, but if I view a post with a link to anything else I get these errors. I think it needs to be coded in what to do if it's a normal link and not an amazon link.
  6. Hello, The creator of a modification I am using for my SMF 1.1.5 board seems to have stopped offering support so I'd like to fix this issue myself. The modification takes Amazon links in my forum and adds my associate ID. Here's a link to the modification if it helps, http://custom.simplemachines.org/mods/index.php?mod=893 The error I am getting in the error log is this: This is that line: if (preg_match('/(.*)amazon\.(com|co.uk|de|fr|co.jp|ca)+/i', $parsed['host'])) { Here is the rest of the code from around and including that line: // CYCLE THROUGH EACH LINK foreach($links as $link) { $parsed = parse_url($link); // MATCH ANY AMAZON LINKS AND CREATE REPLACEMENTS if (preg_match('/(.*)amazon\.(com|co.uk|de|fr|co.jp|ca)+/i', $parsed['host'])) { $parsed['host'] = str_replace('www.','',$parsed['host']); $parsed['host'] = str_replace('amazon.','',$parsed['host']); // IF THE DOMAIN EXTENSION IS VALID if(isset($temp[$parsed['host']])) { $search[] = '<a href="'. $link. '"' ; $replace[] = '<a href="'. str_replace($parsed['host'], $modSettings['amazonlinksassociatestore'], $link) . ((strpos($link,'?') === FALSE) ? '?' : '&') . 'tag='. $modSettings['amazonlinksassociateid'].'"' ; } } // TIDY UP unset($parsed); } No other parts of the modification mention "$parsed" so I believe the error is limited to these few lines and am guessing it's not coded properly. If anyone has any ideas how to fix this, please let me know. Thanks!
  7. Well there's this bit, which looks like it was meant to handle the situation if there was no change: if ($shareinfo['change'] == 0) $change = "$changenum ($shareinfo[perchange])"; else if ($shareinfo['perchange'] > 0) $change = "<font color=green>$changenum ($shareinfo[perchange])</font>"; else if ($shareinfo['perchange'] < 0) $change = "<font color=red>$changenum ($shareinfo[perchange])</font>"; And there's this for the gainper part. $gaintxt = number_format($gain,3); $gainpertxt = number_format($gainper,3); if ($gain > 0) { $gaintxt = "<font color=green>$gaintxt</font>"; $gainpertxt = "<font color=green>$gainpertxt%</font>"; } elseif ($gain < 0) { $gaintxt = "<font color=red>$gaintxt</font>"; $gainpertxt = "<font color=red>$gainpertxt%</font>"; } else { $gainpertxt .= '%'; }
  8. Thank you, you guys are like miracle workers here. I had to make a minor adjustment to get it to work. if($mktval <= "0") { $change = "None"; } else { $gainper = number_format((($gain/$mktval)*100),3); } I had to change the first instance of "$gainper" to the value called in the td row, "$change" and now "None" is displaying there correctly.
  9. Thanks again, one last thing, the error is gone, but "none" is being printed at the top of the page, instead of in the table td row it's meant to be in, which is here "<td align=right>$change</td>" I need to somehow get it to echo "None" there instead of outside the whole page, should I post more code or anything?
  10. Thanks for the response. I'm not a programmer at all, so did I do this wrong? if($mktval <= "0") echo "None"; { $gainper = number_format((($gain/$mktval)*100),3); } Cause it's still displaying the error, but also now with "none" in front of the error.
  11. I have a plugin for my vbulletin forum but the author appears to have abandoned supporting the plugin. I don't know when this issue started, but it was reported by my members today. It's a stock trader plugin, when you go to view a members stocks, any stocks they have with no change, ie; 0, are causing this error at the top of the page: And that error is repeated for each stock with 0 change. You can view what I mean, here: http://www.webtalkforums.com/vbtrade.php?do=viewportfolio&userid=2898 (I don't think you need to be logged in to view it, if you do, let me know) This is line 112 in vbtrade.php $gainper = number_format((($gain/$mktval)*100),3); I'd like to try and fix this, any help/guidance is appreciated, thank you.
  12. I came up with a solution but have one last issue, it's not parsing correctly when using quick reply, it loads in using the image code instead, but on refresh it's fine. I don't have to use plugins or anything, I just did this to my postbit_onlinestatus template: <if condition="$vbulletin->userinfo['field8'] != 'Horizontal Postbit' AND in_array(THIS_SCRIPT, array('showthread','private'))"><if condition="$onlinestatus==0">0</if><if condition="$onlinestatus==1">1</if><if condition="$onlinestatus==2">2</if><else /><if condition="$onlinestatus==0"><img class="inlineimg" src="$stylevar[imgdir_statusicon]/user_offline.gif" alt="<phrase 1="$user[username]">$vbphrase[x_is_offline]</phrase>" border="0" /></if> <if condition="$onlinestatus==1"><img class="inlineimg" src="$stylevar[imgdir_statusicon]/user_online.gif" alt="<phrase 1="$user[username]">$vbphrase[x_is_online_now]</phrase>" border="0" /></if> <if condition="$onlinestatus==2"><img class="inlineimg" src="$stylevar[imgdir_statusicon]/user_invisible.gif" alt="<phrase 1="$user[username]">$vbphrase[x_is_invisible]</phrase>" border="0" /></if></if> My members can choose their postbit, hence the first part of the code. Any ideas how to make this parse right away with quick reply?
  13. By default, vbulletin returns an image to indicate if a user is online, offline, or invisible, I am trying to return text, I could just do that in the default template, but can't because I am using the default template as it is in other areas, such as the members profile page. This is hard code in one of the files to return a users online status. $onlinestatus = 0; // now decide if we can see the user or not if ($user['lastactivity'] > $datecut AND $user['lastvisit'] != $user['lastactivity']) { if ($user['invisible']) { if (($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) OR $user['userid'] == $vbulletin->userinfo['userid']) { // user is online and invisible BUT bbuser can see them $user['invisiblemark'] = '*'; $onlinestatus = 2; } } else { // user is online and visible $onlinestatus = 1; } } if ($setstatusimage) { eval('$user[\'onlinestatus\'] = "' . fetch_template('postbit_onlinestatus') . '";'); } return $onlinestatus; } I hope that helps, I've been trying to figure this out for 2 days.
  14. I am trying to make it so a background image in my postbit changes color depending on if a user is online, offline or invisible. I am doing this by assigning a class which I need to change using conditionals, and I found this bit of code for a plugin: http://www.vbulletin.org/forum/showpost.php?p=1323306&postcount=8 However, it's not working, it's showing everyone as offline. What's the best way to go about doing this? I had my class change depending on the users status, ie "class="online1"... The "1" would be the part that changes to either 0, 1 or 2... any ideas how to get this working? Here's what I have so far. I made a custom template. Title: postbit_onlinestatus_two Inside that template: <if condition="$onlinestatus==0">0</if><if condition="$onlinestatus==1">1</if><if condition="$onlinestatus==2">2</if> I've made a plugin to cache the template. Hook Location: cache_templates Title: cache custom templates Code: $globaltemplates = array_merge($globaltemplates, array('beer','drink','postbit_onlinestatus_two')); (it's caching other templates as well) I've created a plugin to execute the template. Hook Location: postbit_display_complete Title: Postbit Online Status Code: eval('$postbitonlinestatus = "' . fetch_template('postbit_onlinestatus_two') . '";'); And the code in my postbit template: <div class="online$postbitonlinestatus"> It's currently returning a "0" regardless if I am online or not. Can someone please give me a little guidance to get this working? Thank you.
  15. redarrow, your latest code above causes the date to change to "Last Activity: Dec 31st, 1969 7:33 pm" Your earlier code was working fine.
  16. Thanks redarrow, I am going to try that out in a few and let you know what happens.
  17. I am very happy, you went above and beyond, I really appreciate it.
  18. Thanks red, for some reason the echo is making the date come out like this: lastactivity: 31/12/69/ 07:00:00 I won't need to see that anyway since I'll be using a cronjob to run the script, I'll never get to see the result except on the member profile, but it's a nice touch.
  19. I tested your code rajiv and it changes the date to Dec 31st, 1969... redarrow's code is working great.
  20. Wow, you got it! Both fields now read '1199439805' Thank you very much for your time and help, redarrow
  21. Thank you. Ok, I just ran that and here's the data in those fields in the database: lastactivity='0' lastvisit='1199439681'
  22. No, it's one of the default tables that comes with the script. When I use that echo, I get this "311269"
  23. Ok, after running the latest code, this is what's in the database. lastactivity='0' lastvisit='40108'
  24. Here's the database config file <?php /*======================================================================*\ || #################################################################### || || # vBulletin 3.6.8 Patch Level 2 - Licence Number VBFFF3F066 || # ---------------------------------------------------------------- # || || # All PHP code in this file is ©2000-2007 Jelsoft Enterprises Ltd. # || || # This file may not be redistributed in whole or significant part. # || || # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # || || # http://www.vbulletin.com | http://www.vbulletin.com/license.html # || || #################################################################### || \*======================================================================*/ /*-------------------------------------------------------*\ | ****** NOTE REGARDING THE VARIABLES IN THIS FILE ****** | +---------------------------------------------------------+ | If you get any errors while attempting to connect to | | MySQL, you will need to email your webhost because we | | cannot tell you the correct values for the variables | | in this file. | \*-------------------------------------------------------*/ // ****** DATABASE TYPE ****** // This is the type of the database server on which your vBulletin database will be located. // Valid options are mysql and mysqli, for slave support add _slave. Try to use mysqli if you are using PHP 5 and MySQL 4.1+ // for slave options just append _slave to your preferred database type. $config['Database']['dbtype'] = 'mysql'; // ****** DATABASE NAME ****** // This is the name of the database where your vBulletin will be located. // This must be created by your webhost. $config['Database']['dbname'] = 'vbulletin'; // ****** TABLE PREFIX ****** // Prefix that your vBulletin tables have in the database. $config['Database']['tableprefix'] = ''; // ****** TECHNICAL EMAIL ADDRESS ****** // If any database errors occur, they will be emailed to the address specified here. // Leave this blank to not send any emails when there is a database error. $config['Database']['technicalemail'] = 'me@email.com'; // ****** FORCE EMPTY SQL MODE ****** // New versions of MySQL (4.1+) have introduced some behaviors that are // incompatible with vBulletin. Setting this value to "true" disables those // behaviors. You only need to modify this value if vBulletin recommends it. $config['Database']['force_sql_mode'] = false; // ****** MASTER DATABASE SERVER NAME AND PORT ****** // This is the hostname or IP address and port of the database server. // If you are unsure of what to put here, leave the default values. $config['MasterServer']['servername'] = 'localhost'; $config['MasterServer']['port'] = 3306; // ****** MASTER DATABASE USERNAME & PASSWORD ****** // This is the username and password you use to access MySQL. // These must be obtained through your webhost. $config['MasterServer']['username'] = 'xxxxxxx'; $config['MasterServer']['password'] = 'xxxxxxx; // ****** MASTER DATABASE PERSISTENT CONNECTIONS ****** // This option allows you to turn persistent connections to MySQL on or off. // The difference in performance is negligible for all but the largest boards. // If you are unsure what this should be, leave it off. (0 = off; 1 = on) $config['MasterServer']['usepconnect'] = 0; // ****** SLAVE DATABASE CONFIGURATION ****** // If you have multiple database backends, this is the information for your slave // server. If you are not 100% sure you need to fill in this information, // do not change any of the values here. $config['SlaveServer']['servername'] = ''; $config['SlaveServer']['port'] = 3306; $config['SlaveServer']['username'] = ''; $config['SlaveServer']['password'] = ''; $config['SlaveServer']['usepconnect'] = 0; // ****** PATH TO ADMIN & MODERATOR CONTROL PANELS ****** // This setting allows you to change the name of the folders that the admin and // moderator control panels reside in. You may wish to do this for security purposes. // Please note that if you change the name of the directory here, you will still need // to manually change the name of the directory on the server. $config['Misc']['admincpdir'] = 'admincp'; $config['Misc']['modcpdir'] = 'modcp'; // Prefix that all vBulletin cookies will have // Keep this short and only use numbers and letters, i.e. 1-9 and a-Z $config['Misc']['cookieprefix'] = 'bb'; // ******** FULL PATH TO FORUMS DIRECTORY ****** // On a few systems it may be necessary to input the full path to your forums directory // for vBulletin to function normally. You can ignore this setting unless vBulletin // tells you to fill this in. Do not include a trailing slash! // Example Unix: // $config['Misc']['forumpath'] = '/home/users/public_html/forums'; // Example Win32: // $config['Misc']['forumpath'] = 'c:\program files\apache group\apache\htdocs\vb3'; $config['Misc']['forumpath'] = ''; // ****** USERS WITH ADMIN LOG VIEWING PERMISSIONS ****** // The users specified here will be allowed to view the admin log in the control panel. // Users must be specified by *ID number* here. To obtain a user's ID number, // view their profile via the control panel. If this is a new installation, leave // the first user created will have a user ID of 1. Seperate each userid with a comma. $config['SpecialUsers']['canviewadminlog'] = '1'; // ****** USERS WITH ADMIN LOG PRUNING PERMISSIONS ****** // The users specified here will be allowed to remove ("prune") entries from the admin // log. See the above entry for more information on the format. $config['SpecialUsers']['canpruneadminlog'] = '1'; // ****** USERS WITH QUERY RUNNING PERMISSIONS ****** // The users specified here will be allowed to run queries from the control panel. // See the above entries for more information on the format. // Please note that the ability to run queries is quite powerful. You may wish // to remove all user IDs from this list for security reasons. $config['SpecialUsers']['canrunqueries'] = '1'; // ****** UNDELETABLE / UNALTERABLE USERS ****** // The users specified here will not be deletable or alterable from the control panel by any users. // To specify more than one user, separate userids with commas. $config['SpecialUsers']['undeletableusers'] = ''; // ****** SUPER ADMINISTRATORS ****** // The users specified below will have permission to access the administrator permissions // page, which controls the permissions of other administrators $config['SpecialUsers']['superadministrators'] = '1'; // ****** DATASTORE CACHE CONFIGURATION ***** // Here you can configure different methods for caching datastore items. // vB_Datastore_Filecache - for using a cache file // $config['Datastore']['class'] = 'vB_Datastore_Filecache'; // vB_Datastore_Memcached - for using a Memcache server // It is also necessary to specify the hostname or IP address and the port the server is listening on /* $config['Datastore']['class'] = 'vB_Datastore_Memcached'; $i = 0; // First Server $i++; $config['Misc']['memcacheserver'][$i] = '127.0.0.1'; $config['Misc']['memcacheport'][$i] = 11211; $config['Misc']['memcachepersistent'][$i] = true; $config['Misc']['memcacheweight'][$i] = 1; $config['Misc']['memcachetimeout'][$i] = 1; $config['Misc']['memcacheretry_interval'][$i] = 15; */ // ****** The following options are only needed in special cases ****** // ****** MySQLI OPTIONS ***** // When using MySQL 4.1+, MySQLi should be used to connect to the database. // If you need to set the default connection charset because your database // is using a charset other than latin1, you can set the charset here. // If you don't set the charset to be the same as your database, you // may receive collation errors. Ignore this setting unless you // are sure you need to use it. // $config['Mysqli']['charset'] = 'utf8'; // Optionally, PHP can be instructed to set connection parameters by reading from the // file named in 'ini_file'. Please use a full path to the file. // Example: // $config['Mysqli']['ini_file'] = 'c:\program files\MySQL\MySQL Server 4.1\my.ini'; $config['Mysqli']['ini_file'] = ''; // Image Processing Options // Images that exceed either dimension below will not be resized by vBulletin. If you need to resize larger images, alter these settings. $config['Misc']['maxwidth'] = 2592; $config['Misc']['maxheight'] = 1944; /*======================================================================*\ || #################################################################### || # Downloaded: 01:31, Sat Dec 8th 2007 || # CVS: $RCSfile$ - $Revision: 16258 $ || #################################################################### \*======================================================================*/
  25. Thanks, Ok I ran the script with that code and it says "Duplicate entry '503' for key 1"
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.