ewcreators 0 Report post Posted September 13, 2007 Please HElp.Can you teach me :a) How to use smilies with php so that if i want to create a post office or forum , a person who posts with or will get a smiley pic instead of just or . How to divide mysql results into pages~Thanks! Share this post Link to post Share on other sites
galexcd 0 Report post Posted September 13, 2007 For your smilies you can just use a php replace function. You could use preg_replace, but thats kind of a waist because smilies aren't as complex as bbcode so I suggest using str_replaceHere is an example of how you would do this: $string=str_replace(array(":)",":P",":D",":("),array("<img src='/emoticons/happy.gif","<img src='/emoticons/toungue.gif","<img src='/emoticons/grin.gif","<img src='/emoticons/sad.gif"),$string);echo $string; or if you find it easier to write it out you could write it like this:$search=array(":)",":P",":D",":(");$replace=array("<img src='/emoticons/happy.gif","<img src='/emoticons/toungue.gif","<img src='/emoticons/grin.gif","<img src='/emoticons/sad.gif");$string=str_replace($search,$replace,$string);echo $string; I found the best way to divide sql results into pages is by using limit. Take in a variable lets say "page" through the url via get, and use this code:$rowsperpage=5; mysql_query("SELECT * FROM whatever your sql query is goes here LIMIT ".($_GET['page']*$rowsperpage-$rowsperpage).",".($_GET['page']*$rowsperpage-1));You should also add checks to make sure that $_GET['page'] is greater than 0 Share this post Link to post Share on other sites
Saint_Michael 3 Report post Posted September 13, 2007 Well to start off I would check out this tutorial how up to set up a smilie system for your website, and since the posts is only a few months old it "should" work. Now to get the smilies to work besides using php would be images, what I suggestion is google emoticons, then click on images, then click small images and then download away which ones that work best for you.Now for your second problem I would check out these tutorials and see which one works the most effectively.http://forums.xisto.com/no_longer_exists/http://forums.xisto.com/no_longer_exists/https://www.nicksays.co.uk/I would start with the second tutorial first as it seems less confusing as the others, and the fact its all on one page. Share this post Link to post Share on other sites