Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. Yes. I still think your database is a terrible design. Anytime your have fields named something1, something2, something3 and so on it screams poor design.
  2. You really DO NOT want to do this.
  3. I don't believe the question was 'How do I write a wordpress plugin?' But 'how do I write a plugin system?' Unfortunately there is no simple answer to this question as it really depends on your overall applications design. Some applications (such as wordpress) have hooks that are executed at during certain phases of the applications executing. You can then use these hooks to inject third party code. Others use the filter chain pattern to allow injection into specific locations within the execution process. Others might use an observer pattern and broadcast events during execution. There are lot's of ways of doing it. All of which are likely to depend entirely on how your application is designed int he first place. If your application is simply spaghetti code that is tightly coupled and not really using any clearly defined patterns then a plugin system will be quite difficult to implement. Can you describe your architecture?
  4. You need to look into database normalization techniques. You should have a separate table for features.
  5. Because tabs are inconsistent between different IDE's. Take a look at any decent open source project that employs codding guidelines and they all say to use spaces. Most of these projects won't accept a commit that has spaces in it. You can generally configure most editors to replace a tab with a certain number of spaces in order to be able to use the tab key to insert spaces.
  6. Take a look at this: http://framework.zend.com/wiki/display/PLAY/Base+URL+and+subdirectories
  7. It's not exactly clear what you want to do, your .htaccess file needs to be in your public directory. For Zend, you need to direct all traffic (excepting images and css) to your index.php file. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
  8. You should always check your queries succeed and return results before using them. The typical syntax is: $sql = "SELECT foo FROM bar"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { // $result is now good to use } else { // no results returned - handle error } } else { // query failed - handle error } I would watch your variable naming conventions as well. mysql_query() does not return SQL, it returns a result set or false.
  9. mod_rewrite rules can also go in a .htaccess file.
  10. You shouldn't use tabs to indent code in the first place.
  11. You should probably have your own development versions of the site + a testing version. You then commit your changes from your development environments into a version control system which then updates your testing environment. Version control is an essential development tool IMO. Especially if there is more than one developer working on the project. I use version control even when working alone though, it really is an essential tool.
  12. You will need to speak to your host about this error. You don't have permission to write to the session directory. Your still going to have issues with your code. Here: if ($sessWipit != $thisWipit) { echo 'Your session expired from inactivity. Please <a href="index.php">click here to refresh it.</a>.'; exit(); } If $sessWipit wasn't defined in the conditional that checks for $_POST['thisWipit'] your code will error. Your entire piece of code needs to be wrapped in that conditional.
  13. Your would be better off scheduling your script to execute at intervals. This can be done via cron and isn't related to php.
  14. It's not the first time. Google have been doing this on and off with Chrome for a while.
  15. Browsers are unable to access anything above the servers root directory. Use $_SERVER['DOCUMENT_ROOT'] in place of dirname(__FILE__).
  16. Your resetting $+SESSION['tourDates'] to an empty array within each iteration of the loop. $frmTourDates = 1500; $_SESSION['tourDates'] = array(); for($i=0;$i<5;$i++){ $_SESSION['tourDates'][$i] = $frmTourDates; $frmTourDates += 500; }
  17. trq

    code

    See strpos & strrpos.
  18. This is indeed why I suggested reading up on some of the basics first.
  19. Stings need to be surrounded by quotes. So do dates actually. But yeah,, you should always use a date type when dealing with dates, this way if you ever need to sort by date or do any other queries based on dates you can use the date functions.
  20. $today needs to be surrounded by quotes. What datatype is the today_is field?
  21. But do you have any understanding of why or how this works?
  22. Firstly, either use $.get or $.ajax, but not $.get within $.ajax that makes no sense. Also, within the $.get object $(this) refers to the $.get object itself. This line.... user: $(this).attr('user') would need to be.... user: $('#addFriend').attr('user')
  23. $width = $row['width']; if ($width) { $width .= 'in.'; }
  24. You might have read up on some basic OOP before simply copying and pasting code from the tutorial you've linked to. See oop5. In fact, even some simple tutorials on functions and variable scope would come in handy for you. Variables defined within a function are not available outside of that function. The base controller you just posted requires that the model, controller and action are passed into the __construct as params. This is a floored design IMO.
×
×
  • 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.