Jump to content

maxxd

Gurus
  • Posts

    1,655
  • Joined

  • Last visited

  • Days Won

    51

Everything posted by maxxd

  1. I have to agree with mac_gyver - a 6-second query is suspect. Post more details (table structure, query, etc.). Also, just because you're moving to an object-oriented approach doesn't mean you need to pull all the information every time you instantiate the object. You can always initially populate the quote object with the data you know you're going to need (customer details, total, and so on) and then grab the more esoteric or specific data when requested or needed. Granted, if the only purpose of the object is to build a quote view or report, then you will actually need all that data at once. However, I fail to see how - in that instance - the object would have to persist across page loads. Admittedly, I'm not a big fan of stuffing objects into session, but that's just me. I've seen some systems in the past where it just blew up everything one way or another. I can't say it wasn't programmer error (I wasn't working closely with that section of the code) so I may be unjustly biased, but there it is.
  2. add_filter('woocommerce_bookings_remove_inactive_cart_time', changeDeleteTime()); function changeDeleteTime(){ return time() + ( 30 * 24 * 60 * 60 ); } That should work. What errors are you getting? By the way, I truly mean should - I've not tested it.
  3. If you're trying to run something from the command line, I think you want shell_exec(). At the same point, why is the company with which you are working not allowed to post to this API with PHP only? Have you tried cURL instead? It would certainly be safer than running a shell command... Either way, you're going to have to assign the response from exec() or shell_exec() to a variable in order to use it.
  4. Do me a favor and explain what you mean by 'raw text'. The widget() function is what renders in the widget area in WordPress. The following part of the code outputs an unordered list of the data. // Construct unorganized list for each row echo '<ul class="mycred-this-weeks-leaderboard">'; foreach ( $leaderboard as $position => $data ) { $avatar = get_avatar( $data->user_id, 32 ); echo '<li>' . $avatar . $data->display_name . ' with ' . $mycred->format_creds( $data->total ) . '</li>'; } echo '</ul>'; If it's not spitting out a list as described, it's possible there's escaping on the content. Look for a line in your functions.php file that starts with the following: add_filter('the_content', ... After the comma is a function name. Find that function in the functions.php file and see what it does. An escape function in WordPress (like esc_attr(), for instance) will convert special characters into HTML entities, so your output would actually be the HTML markup itself. Now, understand that escaping is important and very much needs to be there, but there are several different escape functions in WordPress, and some are more appropriate than others for some situations.
  5. Also, it looks like the widget already outputs an unordered list with the class 'mycred-this-weeks-leaderboard' - you can style that. It's safer than trying to modify a plugin file, because any time the author of the plugin releases an update, your changes will be overwritten.
  6. Then this is a simple JavaScript question, not a PHP question. Create an change event handler to change the background color to the value selected by the user. Note that 'amber' is not recognized by Firefox as a valid color, so you'll probably want to do hex values, but this should get you started: HTML: <tr> <td id='capacity_cell' style='width:300px;height:250px;background-color:grey;'> <label for='capacity'>Capacity</label> <select id='capacity'> <option value=''>Select One</option> <option value='green'>Green</option> <option value='amber'>Amber</option> <option value='red'>Red</option> <option value='black'>Black</option> </select> </td> </tr> jQuery: $(function(){ $('#capacity').change(function(e){ var bg = $(this).val(); $('#capacity_cell').css({ backgroundColor: bg }); }); });
  7. Possibly more importantly, there is a lot of redundant and inefficient code in what you've posted. First and foremost, don't simply 'SELECT *' from a table when you only need three columns. Specify the columns you need. Also, you're running the same query twice. Don't. Run the query once to get the values, store the values in an array, and loop through the array twice. On top of that, you're including the database.php file three separate times. You are at lease using require_once(), but why take the time to do the extra typing? Include the external file at the top of this file and you're good to go. I'm in the same boat as cyberRobot here - until you explain a bit more thoroughly what exactly you're trying to do, we're not going to be able to help you find the correct answer.
  8. Or you can use func_get_args() and not force the function parameter to be a randomly formatted string. Or, pass in an array of values and simply loop through them. Point being, unless you're tied to this data format for the function parameter, there are far easier ways to handle the situation.
  9. There's neither a question nor a drop-down in your post...
  10. @barand - I didn't think of that. Honestly, didn't even know that would work - thanks! I love learning something new.
  11. The problem isn't with the include statement, it's with the SQL query. You've got a comparison in your ORDER BY clause. I think you want SELECT video_categories_id FROM video_categories WHERE video_activated = ? ORDER BY video_categories_id
  12. I can't guarantee it'll make a difference, but it's worth giving it a shot.
  13. Weird. That header is correct. Just for fun, have you tried zipping the files and using the 'Upload Plugin' button?
  14. That could be many things, but we won't know for certain until we get some details from you and see some of the code you've written. There are many, many tutorials out there - some are good, some are not. With the information you've given, we have no way of knowing which kind you're attempting to follow. First thing to come to mind is did you format the comment section at the top the file correctly? Also, the plugin won't show on the dashboard page, you'll have to activate it through the Plugins page first - is that where it's not showing up? Do any other plugins show up on the Plugins page?
  15. If you've got the tables joined, wouldn't you just name the columns in the match? SELECT items.* ,type_1.* FROM items LEFT JOIN type_1 ON items.type_1 = type_1.type_1_id WHERE MATCH(items.item_title, type_1.type_1_name ) AGAINST('$search_query' IN BOOLEAN MODE) ORDER BY items.item_id DESC LIMIT {$limit} OFFSET {$offset} I'm assuming you're validating and sanitizing the variables you're injecting into the query, yes?
  16. I'm with mac_gyver on this - sounds like there's buffering going on somewhere in the system - are you using a CMS or framework, or is this a straight php environment?
  17. The buttons across the top of the post area here are courtesy CKEditor. You would use this or TinyMCE (for instance - there are many, many other options) as the user editor. The resulting user-entered string (html included) is sent to your processing script upon form submission. That's what you would store in the database and present to the user on page load. There's no need for character counts, character positions, or concatenation. Sanitize the string, store it, retrieve it, escape it, and display it. Much simpler.
  18. Your DreamWeaver error message is telling that the site definition is incorrect. Go to Site > Manage Sites, select your site definition in the list, and click the edit button. You'll want to select the 'Servers' panel, select your server in that list, and click the edit button once again. There, update your server location, default path, username, and password, and click 'Test'. This will let you know whether or not the information you entered is valid and able to be used by DW.
  19. What plugin are you using? My point about the image path is that it's being called from the database, assigned to $image_url, then never used - right now, the get_the_post_thumbnail() function call is getting the image path all over again and using it locally to output the image tag.
  20. I have to assume this query is gibberish pseudo-code. The name of your table isn't 'database', and if you've got duplicate values in the ID column, you're using IDs incorrectly. Give us the actual query and we may be able to help you figure out why you're getting a MySQL error.
  21. The function get_the_post_thumbnail() is what outputs the image string. That's what you'll need to change. I do wonder, however, why your script assigns the image path to a variable then never uses it.
  22. You're going to need to do some more work on your media query. Simply 'screen' isn't going to be enough - see here - http://stephen.io/mediaqueries/
  23. While you're following NotionCommotion's advice, look to see if Chrome and Safari are passing the submit button as part of the $_POST data. They probably are, but may not be. If not, you can remove the checks for that and replace it with if($_SERVER['REQUEST_METHOD'] == 'POST'){ @benanamen just beat me to it...
  24. You could run another for() loop, or a foreach() loop. For instance: <div class='links_aggregate'> <?php foreach($pages as $p){ print($p); } ?> </div> Or, if you're gathering the data at the point in the page where you need to output the links, simply print() or echo() them there instead of assigning them to an array. Heck, if you don't care about source readability, you could simply output an implode() on the array echo implode(' ', $pages); That last one hasn't been tested and is the product of a couple beers, so take it with a grain of salt.
  25. I really don't mean to sound mean, but it sounds as though yes - you are totally in over your head. You don't trust the security of the established CMSs out there, so you decide to write one yourself after one course in PHP/MySQL? It doesn't matter what the users you're targeting are capable of, the site will be available on the Internet. Not just your target audience will be able to access it, even if it's password protected. In this case (and believe me, I never thought I'd be saying this) you might be better off using WordPress. Take a few more courses in PHP and MySQL, put together some sites on your local machine, ask some questions, and continue to learn, and I certainly hope you'll build a WP killer; but from what it seems like you're asking I'm not even sure you've got the basics of how and why to use a database under your belt yet, let alone how to protect not only the server upon which you're hosting the site, but the users that will possibly be using that site.
×
×
  • 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.