Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. I was thinking maybe using the dropbox API to put the original image into an account and then remove it from the web server. If a script needed the original image it could use the API to fetch it from dropbox.
  2. I was asked a question recently which I couldn't give a definitive yes or no answer, so I have decided to throw it out there. Lets say we have a website where the admin or users or both can upload images into various sections i.e a photo galleries. When an upload is performed, the code will rename the file, crop the image to the required sizes, add watermarks, copy to various folders, and save the file name to the database, etc. All is good, however a few years down the line, the website owner wants a revamp and the new design uses different size images to the current design. So, the question is, when an image upload is performed, is it a good idea to store and keep the original image in case of a re-design. In this case a script can be written to generate new images from the original as opposed to the admin having to re-upload new images. The obvious issue is disk space as original images taken from digital cameras can be a few mb in size.
  3. 1. Do you have any experience using PHP? If not pay someone using the freelance board to do it for you 2. Don't ask how to do things and expect someone to post a whole load of code for you to just cut & paste. At least try using Google to find what you are after and if you get stuck, post what you have tried and people will point you in the right direction. Posts like, 'how do I program something that will do xyz' will only aggravate forum members. Start Here! http://blog.ryanrampersad.com/2008/11/get-remote-html-with-curl-and-php/
  4. Surely the code that sharethis generates must contain a url parameter. You can ammend this so the like button references the actual url of the post. Seems pretty straight forward to me.
  5. I agree, however, will namespaces be used in this persons project? Large scale projects, yes. guestabc1, if you are using PHP 5.3 then you can find more info here: http://www.sitepoint.com/php-53-namespaces-basics/
  6. You can pass a database object into the SystemUser login method as a parameter if you like i.e. [code]public function loginSystemUser($db, $e_mail, $password) { $db->query(""); // Checks the user login credentials and sets up a login session if they are valid } // calling code $db = new Database(); $user->loginSystemUser($db, $email, $pass); [/code] There is also no issue in creating objects inside class methods. You do not need to extend the database class every time. i.e public function loginSystemUser($e_mail, $password) { $db = new Database(); // Checks the user login credentials and sets up a login session if they are valid }
  7. Sounds good, whats the problem?
  8. This is not how it should work. The like buttons that you can use on your own website must contain the url of the current page. If you have a bunch of articles on a single url then you cannot add a unique like button for each. They must be on their own urls. As far as I know, you cannot relate like buttons on an external website to data contained within facebook i.e posts you have made within your profile. See the following http://www.guardian.co.uk/politics/2012/dec/18/andrew-mitchell-deputy-chief-whip http://www.guardian.co.uk/commentisfree/2012/dec/18/britain-detaining-immigrants-indefinitely Each article is on its own URL. The social media buttons, including the facebook one, reference that URL. You can see this when you hover over them. You can generate the code for the buttons here: http://sharethis.com/publishers/get-sharing-tools
  9. Welcome to the Forum Matthew
  10. That isn't going to help with the page layout. When using Javascript you should always first make the page function and display properly without any JS code. Once this is done the Javascript can then be added to manipulate the DOM elements. For instance, if I have a navigation bar with a link on that I want to open a sub menu when a user moves their mouse over it, I would make the sub menu hidden to the user using CSS (display:none;). If Javascript is disabled then they can only click on the link in the navigation that will take them to a page containing further links that would normally have been displayed in the sub menu. With Javascript enabled the sub menu is displayed using the onmouseover action.
  11. I would sort out the character encoding. I see a lot of malformed characters probably where you have used quotation marks in the text.
  12. Google cache has saved my ass a couple of times when one of our servers blew up and there was no backup of a few old static websites. I simply scraped the cache files from Google and had the sites back up and running really quickly.
  13. If you have folders that contain files that you are commonly including in your scripts such as a lib folder, then rather than using the full server path to a file every time you want to include it I would setup an include path in a config file using set_include_path(). So, in a config.php file I would do the following: <?php set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/lib/'); ?> Now, if I want to include a file that is in the lib folder, lets say foobar.php. All I need to do from any file in the website is simply write: <?php include($_SERVER['DOCUMENT_ROOT'] . '/config.php'); include('foobar.php'); ?>
  14. Only really started playing about with it today. I think it is fantastic. It's really fast. I think it's one of the fastest tabs on the market. The screen looks really good. Don't know why so many reviews go on about the display because it doesn't do as high a res as an iPad 3,456.7 but who gives a sh**, 1080p movies look fantastic. The speakers are good, the pen thing and the touchscreen are really responsive. It's on the shelves at tesco for £318 and then you get £50 cashback from Samsung after 15 days by putting your receipt and s/n into their website. So, £270 for a quad core tab you can't argue. Apple, go f*** yourselves.
  15. boooooo! Just to let you know, if you are interested in a tablet for gaming they have some great deals on Samsungs at Tesco at the moment. I picked up a 10.1 Note for £270
  16. Sack the Vita & Call of Duty Off. Go get yourself an XBOX & Halo 4 and i'll woop your ass The problem with having a handheld on a train is that you get so engrossed in it, when you look up you realise that you have gone three stops past where you are supposed to get off. I have done that many a time! I think handhelds are really expensive at the moment. I couldn't pay the same for a handheld as it costs for an actual console. I think for £200 I would rather put a bit more in and get a Samsung Galaxy Tab and use that for games aswell as other stuff.
  17. http://schlueters.de/blog/archives/125-Do-not-use-PHP-references.html
  18. One thing to note on this subject is that passing variables around by reference is really a depreciated / clumsy way of doing things. So is using global variables inside of functions. A functions job is to contain its workings so that it it can be used over and over again without having any affect on code outside of its scope. A function should return information and work with any information that is passed into it. So, your capitalize function should be written as follows: <?php function capitalize($str) { $str = strtolower($str); return ucwords($str); } ?> And the calling code is <?php $string = "HEllo WOrld"; $new_string = capitalize($string); echo $string . '<br />' . $new_string; ?>
  19. The word to describe this behavior is, 'scope'. Variables that are used inside a function are not in the same scope as variables defined in the global scope i.e the page calling the function. Therefore a variable set in the global scope cannot be affected by setting the value of a variable of the same name inside a function UNLESS it is passed into the function by reference, 'using & as a prefix to the variable name does this'. Read this http://php.net/manual/en/language.variables.scope.php
  20. If you are talking about the last mysql database primary key then you can use mysql_insert_id() after you run your insert query. To obtain the last id for a specific result you could use the MAX statement in a query i.e mysql_query("SELECT MAX(fieldname) AS last_id FROM table WHERE user_id=1");
  21. Simple answer, no. A script runs from top to bottom. You could get the session value into your javascript by using ajax to make a server side call. You will need the call to be made only after you have set the session value. Im guessing that your javascript is event driven such as a form being submitted, so it can make the call at that point.
  22. Used to be on Blackfriars off Deansgate. Now in Preswich. I'm familiar with Kudos.
  23. Sounds good. Might attend the next one. I actually work in Manchester so there is no issue with it being too far.
  24. Possibly. Just noticed on your board that you attended the php conf in Manchester recently. I never knew that this was on. Was it worth it? What days did you do? Did you take anything from it? May look at going to the next one out of curiosity. Just a shame it's on a weekend though.
  25. Nope. Not seeing that one in any browser.
×
×
  • 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.