Jump to content

Braxton

Members
  • Posts

    15
  • Joined

  • Last visited

About Braxton

  • Birthday 09/11/1986

Profile Information

  • Gender
    Male
  • Location
    North Carolina

Braxton's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am working with MVC and I am working on writing register method for my user class. The question I have though is: when validating the register form, should the if statements for checking length of username and password take place inside of the controller or is that something that the model should handle?
  2. I have recently restructed my local web server and implemented VirtualHosts for using a subdomain. Currently the public_html is the directory for my domain and dev.domain.com lands in the dev directory, this is all working correctly. however, when I am working in my index.html in the dev directory and call for layout.css which is in static, it retreived the layout.css from the static folder in public_html/ and not the static directory in dev. How can I get around this issue? I have included the directory structure before if that helps. Sorry if my wording for explaining this is confusing. -root --public_html ---static ---etc --subdomains ---dev ----static ----etc ---fate Is the block in the vhost conf NameVirtualHost *:80 <VirtualHost *:80> serverName domain.com DocumentRoot "E:\root\public_html" </VirtualHost> NameVirtualHost *:80 <VirtualHost *:80> ServerName dev.domain.com ServerAlias dev.domain.com DocumentRoot "E:\root\subdomains\dev" <Directory "E:\root\subdomains\dev"> AllowOverride All order allow,deny Allow from all </Directory> </VirtualHost>
  3. Thanks mate. That helped much. If I have the following line. Do I then have to JOIN the status_collective table again to get the posts of the user(id 1) maybe I was doing something wrong cause I would get each status message sometimes twice and even three times. JOIN status_collective sc ON sc.uid = fc.receiver
  4. Well that part i did misunderstand, reading back at it I'm still kinda confused how its worded, but that is irrelevant. I get what you are saying now and I see how it works some what. I've been reading over the sticky about joins and I'm still kinda "lolwut?"
  5. yes and of course the null value. user 1 is friends with user 3 but user 3 have no status messages. So it returns a null result.
  6. Okay this has got me on the right track. Perfect actually. The only thing that I don't understnad is how I can add in a second Join or Left join to also return my status posts. What I have so far. SELECT u.username, sc.status_message AS status, sc.time_posted AS time FROM friend_collective fc JOIN user_collective u ON u.id = fc.receiver LEFT JOIN status_collective sc ON sc.uid = fc.receiver WHERE fc.sender = 1 AND fc.friend_flag = 'Y' ORDER BY sc.time_posted DESC LIMIT 20; This does return results of the friends of id 1 but not id 1's own status messages. if a friend doesn't have a status posted though, returns null. Upon trying to play around with adding a second own join I got some really nasty lookin errors in my client.
  7. Logic? I have no idea when it comes to this, but I will explain as best I can and then if someone could point my into the right direction as to where I could read more about this, that would be super! I would search google or even the forums for this, but I have no idea of how I would even really word this or what keywords. I have table?(friend_collective) with the columns id|receiver|sender|friend_flag the receiver and sender columns are simply user ids where as friend_flag is purely either Y or N. now then I have a second table(status_collective) with the columns id|uid|status_message|time_posted the uid being the user id, the rest are pretty obvious. Now what I am basically trying to do is get all the status messages for the friends of a specific user. I know how I can achieve this in PHP, but for my own learning purposes and also cause I want to know if this is even possible to achieve with mysql, meaning less php. Hope this makes sense. Not even sure if I worded this correctly.
  8. Let's say the user simply supplies "domain.com", Should I just check for http:// within the string and if it does not exist within, then add it? I just tested using "domain.com" and when I click on it, I am taken to "http://localhost/domain.com" I used the term "break" as I didn't know how else to say it.
  9. I am currently writing a simple blog script for my website and I have reached the point where I am writing in the commenting feature. I want to allow the author of a comment to also provide their url much like how wordpress comments work. The thing that I'm unsure about is the url. Some users like to simply type domain.com and other http://domain.com. My question is, is there a function or method of which would be good to use here to make sure that when a user submits the info, the url won't break or anything like that. I hope this makes sense.
  10. Thanks for all the feedback and the link regarding best practices. Greatly appreciate it.
  11. Sometimes I read that folks include the script tag(with javascript files) between head tags and other times I read about folks placing the script tags directly before the closing body tag. Which is the more sufficient way to do this? Does it really even matter?
  12. if (last_login + 86400 < server_time) {
  13. Thank you so much for your explanation.
  14. This is the method I generally use for wrapping paragraphs. Hope this helps. function wrapBody($body){ $temp = ''; $lines = explode("\r\n", $body); foreach($lines as $line){ if(!empty($line)){ $temp .= "<p>".$line."</p>\n"; } } return $temp; }
  15. I am trying to familiarize myself with using classes and I have a question regarding the use of __construct and __destruct. When using both, should the functions be public or private?
×
×
  • 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.