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
54
Other forums
php slowing my site?
Hi all,
I think that one of the reasons that my site doesn't work fast is that the code is ve
problem with php server update from mid 2009
Hi,
I have this navigation menu on 2 websites which used to work just fine. After a recent up
Opening Multiple Files/Links in Order.
I want to open links in order/one-by-one and check each for a specific string.
Example:
I
check if string contain only a-z/A-Z
Is where any way to check if string contains only a-z/A-Z, without writing an array with all possibl
do while...woes
I'm sure this is childsplay but it is stumping me, everytime i try what I think would make this work
PHP Cannot redeclare class
I have 6 files, and two of them do not seem to want to play well. I keep getting a "Cannot rede
please help me in this update statment
hi every one
if I have table and this data in it
id name
10
array_diff weirdness
I'm using the following bit of code
$diff = array_diff($pids, $pidlist);
$diff = array_va
use an array from 1 class in a second class
I have a class that adds data to an array
Then I have a second class and I need to check if t
Hits this week counter
I have a counter on my site that tracks hits, IP's, etc. into a mySQL database. It also includes the