Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

  • Days Won


Lou last won the day on August 16 2011

Lou had the most liked content!

Lou's Achievements


Newbie (1/14)



  1. Mod Rewrite is pretty great. You can change all your .php pages, like register.php, to just register. I'm going to mess around with it tonight and get a feel for how it works.
  2. Let me try to write this in some kind of psuedo code. 1 On my pages link the individual blog posts with their title, like articles/row(from database)/title-of-post (from the database row), not just details.php?article_id 2 Create a rewrite rule that matches the link (articles/whatever ever comes after it), stores the row and title in a variable like $1 and $2, then run details.php?article_id=$1. I guess I only need the article id then. 3 The details.php script executes like before, but the user sees the pretty URL, not the mess with the query string
  3. Reading your stuff Hartley, makes me realize this has too many layers of abtraction for me to ever completely understand.To really make a complete and useful website you've got to be a master, and all of these master details aren't covered in any one book (or ten books) and only a small percentage could ever understand it anyway.
  4. I think I see now. the details.php script still runs whenever the regular expression for the link is matched.
  5. Okay I went back to read some. Stupid me. I'm thinking that the links have to be details.php?article_id=2 instead of just inserting the title of the post into the link like Hartley showed me. I don't know why I thought the first way was the only way. Probably because in one of the books I'm reading they do it that way, and instead of trying to solve the issue in a different way I stayed rigid in the original link format. Another question though. If I change the links to the blog posts to the article id/name of blog post format, what happens to details.php that originally handled whatever post I pulled up, let it be article_id 1, 2, 3, 4, 5, or 100? How would I get to the details.php page if the link is already the name of the article?
  6. Still confused but getting there. Say you have your details.php page and it's showing article 2. details.php?article_id=2 You do your rewrite rule to change the url to articles/my-article-title, taking the info from details.php?article_id=2. I still don't get how you get the title of the article into that new URL. Where does it come from? It seems to be going in the wrong order. How does your regular expression pull the title out if the link is article_id=2?
  7. Makes more sense now Hartley. Thanks for taking the time.Thanks also Buttercream.
  8. And whether to use PDO, MySQLIi, it's crazy. All those options and you basically just insert, update, delete and select information.
  9. I am building a dating site. Figured I'd start simple, but the few things I don't understand have stopped me from completing it thus far. Clean URLs for the blog section (mod rewrite) Database structure (user table, profile table, etc). I find it really hard to figure out what's going into the database and specific tables. I know how to make a user's image gallery, but how do you let them define a main photo? do you put that main photo in their profile table, or just in the photos table? Can you define a main photo by say, a 0 or 1 in the photos table, or always keep their main photo in their profile table? If you store sessions in a database using procedural mysql (Larry writes the six functions in the advanced book), can you connect to the database for other tasks using PDO or object oriented? I can get distances between users from my zip code database, but how would I implement users from other countries? i see on other dating sites they let users sign up from different countries and territories. do you have to determine distances for those users as well, and if so, how? Or should I just keep the site USA only? See I have these weird questions one needs to actually complete a site but is rarely covered in any book.
  10. I understand one thing better. Sites don't actually have the directory structure they appear to have... like Yahoo. It's just mod rewrites.
  11. I think I'm confused because the rewrite rule part always has blog.php?t=title&a=article_id. Is that the part that's going to be the new URL? I don't see specifically where the new URL is going to be the title of the blog post. I see you're using the regex's parenthesis and assigning them $1 and $2 but I don't see where this comes into play to assign the new URL.
  12. I'm going to look at the E-Commerce book, I have that one as well. Never got to the second project in that book, so if the mod_rewrites section is there, that's why I missed it.
  13. No I haven't completed any site yet. I've been reading PHP, MySQL, HTML5 books for 3 years and haven't come close to completing a real site yet. I have every one of Larry's books except this new Advanced one. I can code, but I lack a plan for putting it all together. Basically, it's a database problem.
  14. I don't see how this RewriteRule works. I'd like the title of the blog post to be part of the URL of the blog post, I don't want the URL to be article_id=2. It looks like these rules make sure the URL is in the format I don't want. Can you explain each line?
  15. Hehe... I'm going to study this more tomorrow. I am tired and nothing is making sense. I'm sure we can figure it out. And I will buy the new edition of the book soon as well.
  • Create New...