Jump to content

jgd12345

Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

jgd12345's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. No one :'(. Plzzzzzz (all them z's making me tired)
  2. Hi i'm trying to create a rewrite 2 rewrite rules one which goes to index.php and one that goes to info.php. Here's some examples of urls which should go to index.php: /news/ (with or without trailing slash) /news/cat1/ (with or without trailing slash) /news/cat1/sub1/ (with or without trailing slash) /news/cat1/sub1/index.htm Here's some examples of urls which should go to info.php: /news/page.htm /news/cat1/page.htm /news/cat1/sub1/page.htm So far i have: RewriteRule ^news/?(.*?)?/?(index\.htm)?$ /news/index.php [NC,QSA,L] RewriteRule ^news/(.*?)\.htm$ /news/info.php [NC,QSA,L] But the first rule picks up any urls for the second rule aswell so /news/index.php is always shown. If i change the first rule to (removing the ? after the last /): RewriteRule ^news/?(.*?)?/(index\.htm)?$ /news/index.php [NC,QSA,L] It works but means that i must specify a trailing slash which is not what i am after. Really appreciate if someone could help. Thanks
  3. Hi, cheers i think i'll go for option 1 then. I've been researching on whether it was efficient enough but it appears that it's quite a common way of doing it so i guess it is. Thanks again.
  4. Hi, i'm in the process of building my own small forum. One of the features i feel i can't live without is displaying the read/unread posts icon next to each topic. I thought of a couple ways of doing this but none seem good enough: 1. Create a table in my database to store the topic id and the user id for each topic a user views. This will easily allow me to detect whether a user has viewed a topic. However this could lead to a potentially massive table. 2. Create a cookie for each post a user views but again this could create to too many cookies. As you can see neither of my ideas seem to work. Really appreciate it if someone could suggest an alternative.
  5. Hi, I have the following SQL query setup to return all the forums including no. of posts/topics and the last poster in each forum. I have the following database structure: forums - forum_id - category_id - forum_name - display_order topics - topic_id - forum_id - subject - last_post (date last post made) posts - post_id - topic_id - date_line (date posted) Here's the final query i came up with (with abit of help): SELECT f.forum_id , f.category_id , f.forum_name , f.display_order , COUNT(DISTINCT t.topic_id) AS num_topics , COUNT(p.topic_id) AS num_posts , MAX(p.date_line) AS last_post , (SELECT post_id FROM " . posts WHERE topic_id = (select topic_id FROM topics WHERE forum_id = f.forum_id ORDER BY last_post DESC LIMIT 0, 1) ORDER BY date_line DESC LIMIT 0, 1 ) AS last_post_id , (SELECT user_id FROM posts WHERE topic_id = (select topic_id FROM topics WHERE forum_id = f.forum_id ORDER BY last_post DESC LIMIT 0, 1) ORDER BY date_line DESC LIMIT 0, 1 ) AS last_poster_id , (SELECT u.username FROM posts p LEFT OUTER JOIN users u ON p.user_id = u.user_id WHERE p.topic_id = (select topic_id FROM topics WHERE forum_id = f.forum_id ORDER BY last_post DESC LIMIT 0, 1) ORDER BY p.date_line DESC LIMIT 0, 1 ) AS last_poster FROM forums f LEFT OUTER JOIN topics t ON f.forum_id = t.forum_id LEFT OUTER JOIN posts p ON t.topic_id = p.topic_id GROUP BY f.forum_id , f.category_id , f.forum_name , f.display_order ORDER BY f.display_order It seems to be working fine but the idea of the 3 sub queries within, seems abit long winded. I was just wondering if there was an easier and more efficient way. Appreciate the help. Thanks
  6. Hi, i'm useless at regular expressions and having trouble implement mod_rewrite to make my site search engine friendly. The url I want to rewrite is: /products/index.php?category_id=$cid(&page=$page)? to: /products/[a-zA-Z0-9-/]*/([0-9]+)$/? (something like this - i've read alot of tutorials but can't get my head around it) eg /products/cat-1/subcat-1/subcat-2/12/ or /products/cat-1/subcat-1/subcat-2/12 (with or without the ending slash) or /products/cat-1/subcat-1/subcat-2/12/1 (including the page number - again with or without the ending slash) note: the 12 is the category_id and the 1 is the page and: /products/product.php?product_id=$pid to: /products/cat-1/subcat-1/subcat-2/product-name/19 (again with or without the ending slash) note: the 19 is the product_id. Would appreciate it if someone could help. Thanks
×
×
  • 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.