Everything posted by PowerfulTrueRam
-
Selecting UNIX timestamps by year
I understand that much. I'm a fairly advanced PHP developer so understand SQL ect, I'm just not sure how to go about refining a unix timestamp to a certain year. Thanks for the help anyway though. Dan
-
Selecting UNIX timestamps by year
Hey guys, I have a database full of news articles with corresponding UNIX timestamps for the time each was published. I would like to use PHP in order to form an SQL statement to select all posts that were published within a certain year. I'm not sure how to go about this though. Any ideas? Regards, Dan
-
Building Large Scale PHP Applications
Evening folks, I have been using PHP for a number of years and have gradually built up my skills by learning things such as OOP to a pretty high standard. I am looking into building quite a large scale PHP application but am not sure where to start. I have all the skills, just not sure what design pattern to use. I have built applications in the past but as they have gradually become larger and larger, they have become complicated and confusing due to the maze of links and files and have eventually become unmanageable. If you were to build a large application for example an intranet system for 50+ users featuring bulletin boards, payment trackers, bulletins etc using OOP techniques, in what way would you lay out the code for it to be as logical and modulated as possible. I am planning on using .htaccess to run everything through an index.php file which will then route to the correct methods for the task. I have looked into design patterns such as the MVC (Model-View-Controller) pattern but this seems far too complicated and pointless for what I am planning to build. Any ideas appreciated. Regards, Dan
-
Returning MySQL results from a class
Thanks a bunch that works great. Such a simple idea, makes me think why I couldn't think of that in the first place! Dan
-
Returning MySQL results from a class
Thanks for the response, I don't think it's quite what I'm after though. I am looking to perform the following script: $article = new article('id_here'); $fetch = article->fetch_array(); I would like $fetch to contain an associative array for each row of the result so an example would be: $fetch[1]['id'] = 1; $fetch[1]['title'] = 'Lorem Title'; $fetch[1]['body'] = 'Lorem body'; $fetch[2]['id'] = 2; $fetch[2]['title'] = 'Lorem Second Title'; $fetch[2]['body'] = 'Lorem second body'; I hope this makes sense, Dan
-
Returning MySQL results from a class
Hey guys, I am trying to create a class with a function that returns the results from a MySQL query. However, I'm not sure how to go about doing it. I have tried simply returning the mysql_fetch_array() variable but have since discovered that this only stores the first row before moving the result pointer. I can see that the flickr API achieves this but am not sure how. Any help appreciated. All i want is for the function to perform the query and return all of the results in the form of an associative array. E.g. $article = $articles->fetch(); foreach($article as $fetch) { //output here } Cheers in advance. Regards, Dan
-
Clear Float Issue
Fixed. I just floated the entire container and then cleared that also before the footer section. Slightly more source than I would of liked but gets the job done. Cheers.
-
Clear Float Issue
I am almost certain the the bug is the same bug described here http://www.brunildo.org/test/IEFloatClearPadding.html
-
Clear Float Issue
Adding display: inline; doesn't seem to solve it either. I did a bit of research and that fix is applied to problems whereby there is a double padding either side of the element. Not on the bottom. Hmmm....
-
Clear Float Issue
No luck. Added the content and the gap is still there. Dan
-
How do I setup a dedicated server
Well you can either transfer to a good host (plenty of them out there), rent a dedicated server or run your own dedicated server from your house. If you're heading for the first option, I would HIGHLY reccomend http://www.dream-hosting.co.uk/. They are reliable, their customer service is brilliant (ticket responses in under 30 minutes max), fantastic prices (£9.99 a year for 500MB) and a monkey could set it up. On the other hand, if you're looking to setup your own server (great fun) then I would grab yourself an old computer thats lying around and take a look through this great tutorial. Bear in mind that you will be limited by the amount of upload and download bandwidth that you're ISP allows. The chances are your internet package will not be designed for hosting a website. Good luck! Dan
-
What does this line do?
The problem with using * as a css reset is that all the useful formatting done by the browser is lost for example form buttons and input fields. It is much more productive to use a CSS Reset that targets each of the problem elements individually. You will hear many different opinions on various different CSS resets available on the net but I prefer to use the CSS reset provided by Yahoo. It's compact and gets the job done. http://developer.yahoo.com/yui/reset/#code Just paste that at the top of your default stylesheet and jobs a gooden! Dan
-
div fixed to bottom
This is a good example http://ryanfait.com/resources/footer-stick...bottom-of-page/
-
Clear Float Issue
Hey guys, I am in the process of building a small website for a gaming clan and have come across a small CSS issue. I can remember experiencing this problem before but for the life of me can't remember how I solved it. http://dangreaves.com/eagles/ As you can see from the source, there is a left column and right column inside a "content" container. I have used an empty div with the clear: both to clear the two columns in order to stretch the content container. This displays brilliantly in FF but as always IE is being a bitch. IE seems to render a larger padding on the bottom of the content container. I have set the clear div to height: 0 and width: 0 but to no avail. Any ideas? Dan
-
Storing return output from constructor function?
okay, thankyou very much, you're a big help!
-
Storing return output from constructor function?
Hey, I'm in the process of building a social network website and am building the user system. However, I've come across a bit of an obstacle. On every page requiring user interaction I define the user class. $user = new user(); In this case, the class searches the PHP session and looks for the users id, if found it then populates the class with the users information. $user = new user(235); In this case, the class simply populates the class with the information of the user with id "235". class user { var $type; var $userid; var $username; var $password; var $email; var $status; var $about; var $activation; function user($userid = false) { if($userid == false) { if(!empty($_SESSION['cn_userid'])) { $this->setUserid($_SESSION['cn_userid']); $this->setType(0); } else { return false; } } else { $this->setUserid($userid); $this->setType(1); } $query = mysql_query("SELECT * FROM users WHERE id = '".$this->getUserid()."' LIMIT 1"); if (mysql_num_rows($query) > 0) { $result = mysql_fetch_array($query); $this->setUsername($result['username']); $this->setEmail($result['email']); $this->setStatus($result['status']); $this->setAbout($result['about']); $this->setActivation($result['activation']); return true; } else { return false; } } //Rest of class snipped } However, I need to capture the output of the constructor (it returns false when the user isn't found). I have tried the following: $user = new user(); if(!$user) { blah blah } but this doesn't work as the variable isnt stored. Any help is appreciated. Dan
-
PHP vs HTML
This page has quite a good explanation on the difference between the two. (although alot of it has been repeated about 600 times in this single thread)
-
Screen size
I always use 900px as a good baseline width and depending on the requirements of the client, maybe increase that to 100% width on projects that require it.
-
Can you make my festival site look decent?
nothing in life is free
-
Image Maps
I'm not sure about compatibility with them these days. They're kind of an old technology which explains why Myspace still uses them. Dan
-
I sad
These are the errors that I picked up in the validation on the various pages of your site: On line 13, you haven't linked your CSS correctly, you cannot have a space in the filename, should be iridium_style.css insetad or simply style.css On line 22 to 26, you have empty <span> tags. Empty elements are not allowed in XHTML. Consider placing an invisible character in them such as I also noticed that on the "about" page, you have referenced an alternative stylesheet ("form2.css"). Was this intentional? Hope this helps, Dan
-
Undesired link from another site
If you were really intent on redirecting the link from the blog, you could place the following PHP at the top of the header of your application (should be named "overall_header.php" or something similar in the templates folder). <?php if ($_SERVER['HTTP_REFERER'] == 'http://user-experience.iterating.net/' || $_SERVER['HTTP_REFERER'] == 'http://user-experience.iterating.net/?p=63') { header('Location: redirect.php'); exit; } ?> I haven't tested it but it should work. Remember it has to go at the very top of the overall header document as the header function must be parsed before any html is output. Hope this helps, Dan
-
Looking for a basic content management system
Drupal and Joomla are hardly "basic"? I have started using textpattern, although it has an extremely steep learning curve as it works like no other CMS, it's perfect once it's setup and running. Dan
-
What should I put in "About Me"?
okie cheers
-
specifying the language of a page
Yep, using the following properties in your opening <html> tag: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> The code for french is "fr" and the code for german is "de". Hope this helps, Dan P.S. W3 make everything so bloody complicated! It took me about 10 minutes just to sift out the ISO language codes.