Jump to content

immanuelx2

Members
  • Posts

    96
  • Joined

  • Last visited

    Never

Everything posted by immanuelx2

  1. Thanks for the responses guys, really helpful. I suppose I will have to carefully plan and figure out which size thumbnails I will need in advance. Staying on topic, do you guys have any links to any good public PHP image handling / manipulation classes? Or perhaps any batch-processing thumbnail creation techniques Thanks again
  2. Fellow PHP Coders, I am working on a blogging system that will involve the use of images. Most images will be fairly large so thumbnails are a must. Is there too much overhead to dynamically generate the thumbnails on-the-fly, each page load, or should the thumbnails be generated once upon upload and then saved as a separate file. The reason I ask is because there will be times when I'd like thumbnails to be bigger than others (headline stories). Thanks in advance for all input!
  3. I deliberately left this out so you can test the dynamic rule Now you just need the default ive changed it so it wont conflict with any other rule. #default for all sections -> http://site.com/type=news or http://site.com/type=forum RewriteRule ^type=(.*) index.php?type=$1 [L,QSA] I see... so no way to make it ^(.*)/ because it's the root and it can't be dynamic? I have to do ^news/, and any other sections, explicitly correct?
  4. Thanks. I realized I wasn't calling the damn functions right forgot the trailing ()
  5. For example: class Post { function __construct() {} function getRelatedPosts() { // get related posts through query while ($post = mysql_fetch_assoc($query)) { $post = new Post(); $post->getTitle; } } } Reason I ask is that I am having trouble getting it to output anything using the getRelated type function. Or is there a better way of trying to accomplish something like this?
  6. Hmm... site.com/news/ does not work site.com/news/cat/ works site.com/news/cat/12053-the-article-title works Is there a separate line I should add for just site.com/news/ to work?
  7. What if I can get the entire string (eg. "news/category/id-title") through a $_GET[] variable and just parse it via explode() in PHP? That way PHP can handle all the redirecting... is this possible?
  8. Didn't work So how come some sites can have rewrites for /news, /news/category and even /news/category/articleid ??
  9. Hmm.. It appears as though only the website/news/ works... if I add category or id ( website/news/category/ ) it says page does not exist.. Also, if the url is website/news instead of website/news/ (with the ending slash), it doesn't work.
  10. I think I'm starting to understand... So you are saying I need something like this: RewriteRule ^news/$ index.php?type=news RewriteRule ^news/(.*?) index.php?type=news&category=$2 RewriteRule ^news/(.*?)/([0-9]+)-(.*?)$ index.php?type=news&category=$2&id=$3 RewriteRule ^forum/$ index.php?type=forum RewriteRule ^forum/(.*?) index.php?type=forum&category=$2 RewriteRule ^forum/(.*?)/([0-9]+)-(.*?)$ index.php?type=forum&category=$2&id=$3 Is that correct?
  11. Thanks for the reply. I'm a bit confused on what you mean by interface and anchor.. Could you briefly explain those for me please?
  12. Currently, I have: RewriteEngine on # Turn http://mydomain.com into http://www.mydomain.com/ RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC] RewriteRule ^(.*)$ http://www.mydomain.com/$1 [N,R=301] RewriteRule ^(.*?)/(.*?)/([0-9]+)-(.*?)$ index.php?type=$1&category=$2&articleid=$3&name=$4 An example page would be: http://www.mydomain.com/news/category/12345-this-is-the-article/ So if someone pointed to http://www.mydomain.com/news it should take them to index.php?type=news Or if someone pointed to http://www.mydomain.com/news/hardware it should take them to index.php?type=news&category=hardware How should I set up my other Rewrite rules? I'm thinking of some sort of hierarchy/tree structure like: RewriteRule ^(.*?)$ index.php?type=$1 RewriteRule ^(.*?)/(.*?) index.php?type=$1&category=$2 RewriteRule ^(.*?)/(.*?)/([0-9]+)-(.*?)$ index.php?type=$1&category=$2&articleid=$3 ..But I'm not sure if that would work or if I'm even on the right track. Any help is greatly appreciated!
  13. Thanks a lot for the example. Actually, that Numb3rs to numbers was an error on my part lol.. I just wanted to include a number to allow them in the output as well, but I forgot to put the 3 in the output!! Thanks again!!
  14. Hi all. I am looking to generate SEO-url-friendly titles. I'm guessing some sort of preg_replace function will be able to get the job done. Unfortunately I'm still a beginner with regular expressions.\ I'm looking to do something like the following: from: This Is a Great Article Title; With 'Quotes,' Numb3rs, commas, and Semicolons to: this-is-a-great-article-title-with-quotes-numbers-commas-and-semicolons Basically strip out EVERYTHING except for numbers and letters, and replace the spaces with dashes. Is this possible? Thanks in advance.
  15. Thanks. Handy website, although I am very new to Regexp. If someone could provide me with an example that could strip out any special characters and just leave letters, numbers, and dashes in place of spaces I will give you a cookie Or should I post this in the Regexp subforum?
  16. Hey guys. I'm trying to get my site SEO-ready and have got the mod rewrite in the works, but I was wondering what the best way is to construct an SEO URL-friendly article title. I was thinking the PHP could handle this and store it in the database. Example: This Is a Great Article Title; With 'Quotes' and Semicolons to this-is-a-great-article-title-with-quotes-and-semicolons I'm thinking some sort of preg_replace or str_replace functions might do the job? Thanks in advance
  17. what you are looking to do is called "pagination" I would google "php pagination" there should be a tutorial somewhere out there (maybe even on here?)
  18. Thanks, this does clear up quite a bit. So all enum does is restrict a table to the values you specify. Wouldn't it be more efficient to store integers as representations of the enumerations (1-3), and have PHP parse them out(Car, Truck SUV)?
  19. bump. I suppose my question is why I would use MySQL enums when I could use PHP to handle those, and at the same time, how are MySQL enum values stored and manipulated?
  20. This might be a very noobish question, but I have always wondered how the mysql ENUM type works. I understand the enumeration concept( I think) Vehicle enumeration: 1=>Car 2=>Truck 3=>SUV So my question is, using that above scenario, how (or better yet why) would I use the Mysql ENUM type to store that. Why not just store them as '1', '2' or '3' and let the PHP figure out what those enumerations stand for? Thanks in advance
  21. SELECT * FROM table WHERE tag != 'tag1' AND tag != 'tag2' AND tag != 'tag3' AND tag != 'tag4' AND tag != 'tag5' Can i do something like.. WHERE tag NOT IN ('tag1','tag2','tag3','tag4','tag5') ?
  22. Sorry, let me add that the contents originate from an HTML textarea and are then stored in a MySQL text field.
  23. Hi all. Quick run down: Basically, I have a comment system on my website that has the ability to quote other peoples comments and reply to them (much like on these forums). Now the problem is that a lot of people like to hit the enter button after quoting somebody, to separate the quote from their own text, example: [quote]quote text[/quote] reply text The problem is that by quote BBcode (seen above) is converted to a div block element on output, and therefore line breaks are added before and after the block quote. Here is my question: How can I remove the extra newline (since I use nl2br() to convert it to breaks) after the quote? The following does not work: <?php $comment = str_replace("[/quote]\n","[/quote]",$comment); // no worky preg_replace('@\[/quote\]\\n@si', '[/quote]',$comment); // no worky Help is much appreciated!
  24. Hey guys, I have a form that is being processed via $_POST variables and was wondering if there is a regexp way of removing a newline char (\n) if it is the very last thing that was inside a textarea. Also, any idea why this isn't working? <?php $comment = str_replace("[/quote]\n","[/quote]",$comment); ?> Thanks in advance!
×
×
  • 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.