Help with forum quoting?


Posted on 16th Feb 2014 07:03 pm by admin

Hi im working on a forum and I have alomost finished it but i want a user quote system like twitter and facebook with the @ sign to start it off, however even though im good at php coding and have done a code with preg_match and preg_replace to change them quotes to link.

For example if someone wrote "to quote @123456 which he said this." what would come up is "to quote 123456 which he said this." and the 123456 would be a link to their profile.

I also did the username change and got this to work but when I did that the code only got the first quoted id number and if there was two users quoted in one comment then it would have the same username going to two different profile links.

What I want to do is what facebook does, I want that @123456 link to change to the user's username. Lets say the id "123456" goes to the user "Test User" then the link would be: Code: <a href="http://tester.com/123456">Test User</a>
What I need help with is how to make a function that gets the comment looks through it for each quoted user and looks in the database for that id number and then prints out a link to their profile with the link having their username showing on the page and a link like "http://tester.com/<userid>".

For example if the php function was called "comment" then i would do this:
Code: print comment('to quote @123456 and @654321 which they said this.');

And what prints out on the page is: to quote Test User and Guest User which they said this.

And the html code would be:
Code: to quote <a href="http://tester.com/123456">Test User</a> and
<a href="http://tester.com/654321">Guest User</a> which they said this.

If anyone can help me please reply Thank You.

No comments posted yet

Your Answer:

Login to answer
213 Like 54 Dislike
Previous forums Next forums
Other forums

I think i'm using the syntax incorrectly
Hi Everyone!

I'm new to this forum and a newbie with PHP - I'm glad I found this site - I hop

Using unserialize()
Hi there.

I have some data in my database that is serialized.

e.g.

a:2:{i:0

ereg_replace()
Basically what i need to do is

$title = "This Suck's"

$striped = ereg_repl

Formatting echo from database
So I have a database that stores First and last names, then echos them back to a website, as of now

Mysql query, two times?
Hello to all,

I'm new to php coding and i like it alot. I need help with some noob stuff.

Basic Question about Threading and PHP...
I have a page that I am working on and it is taking several hours to process. The basics of what th

file_put_contents and createimagefromjpeg
All,
I do somethings and then I have the following code:
file_put_contents('./test/'.$filename

mails going in spam??
The mails I sent to folks in my database using mail(function) are going in spam??

Any idea ho

Standard DES encryption script?
Can anybody point me to a tutorial or a short script that shows how to encrypt some text with salt i

Help If user voted, block them
On my Prayer request site, i let users Click a button to Pray for somone that has posted a pray, i g

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash