Jump to content
xisto Community
Sign in to follow this  
ewcreators

Help In 2 Parts

Recommended Posts

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 :D or :P will get a smiley pic instead of just :) or :D.:P How to divide mysql results into pages~Thanks!

Share this post


Link to post
Share on other sites

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_replace
Here 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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.