Jump to content

Recommended Posts

like on any forum... how is this done?  forms? ajax?

 

i've tried javascript but it only takes the last result in the loop.  instead of the message i clicked on.

 

what i'm trying to do is e.g. click on quote button in message 5, then message 5 in quote tags show in the text area.

 

 

the part i'm having trouble on is passing the information from the button to the textarea without changing page

 

any help...

 

 

If you check the way this website works as for qotes...

 

The link Quote to your upper right of the post is a link to itself but it passes a quote ID which is likely the database link if you will to the data of that post. Then simply put the set the value of the textarea to the value of the post that you $_Get[] sent and place the quotes around it.

i have reply.php?id=$id , where id is distinguished by the thread, so all the replies in the thread have e.g. id=44 which is part of the table Threads.

 

 

and for quotes they have id in the table Reply.   

 

how do i add this on to url?

 

i know for reply id its reply.php?id=$id

 

reply.php?id=$id.......

 

 

what goes after that to distinguish the id of the quote... should be easy after this..

 

how do i add on a quote id after that?

 

do i use &..

 

You can do it that way, but that won't be dynamic (IE you will have to reload the page for the quote to actually show up) If i'm not mistaken (and I might be) I believe these forums use javascript to get the quote. The way I would do it is wrap every post in its own unique div tag (IE the div id would be the post number) and use the getElementByID function to get the innerHTML of the div tag and voila. A quick example would look like

 

<script type="text/javascript">
function getText(id){
element = getElementById(id);
reply = getElementById("replyBox");//this is the ID of the reply textarea

reply.value = "[quote]"+element.innerHTML+"[/quote]";
}
</script>

and then you would have links like
[code]
<a href="#quickReply" onclick="getText('post124')">Quote</a>

 

a div may look like

<div id="post124">
ZOMG I GET HEDER ERORS HALP
</div>

 

You can probably figure out the rest. But this is how I would go about it if i wanted a dynamic quote system like these forums have

i tried but i think i've gone wrong somewhere, the text area isn't filling

 

 <div id='$number'><img src='http://www.u-stack.com/quote.jpg' alt='Quote!' onclick='getText('$number')' />
    <br><hr size='1'></div>

   

   

<script type='text/javascript'>
function getText(id){
element = getElementById(id);
reply = getElementById('reply');//this is the ID of the reply textarea

reply.value = '[quote]'+element.innerHTML+'[/quote]';

}
</script>

 

<textarea name='reply' cols='50' rows='10' wrap='hard' id='reply'></textarea>

 

where i go wrong?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.