Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,970 members, 7,817,847 topics. Date: Saturday, 04 May 2024 at 09:08 PM

Timeline With Comment Box Attached To Each Post - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Timeline With Comment Box Attached To Each Post (1651 Views)

I Need A Work Solution On Pythons Question Attached Here. / Check Out My Recently Programmed Platform And Comment On It / Pls I Need Pcb Board Control Panel**picture Attached Too The Post (2) (3) (4)

(1) (Reply) (Go Down)

Timeline With Comment Box Attached To Each Post by cbrass(m): 11:18pm On Jul 27, 2015
How Did Mark Zuckerberg Do This?

Am wondering how Facebook did their timeline with comment box attached to each post.am trying to do something similar only that my comments shows on other posts due too
Re: Timeline With Comment Box Attached To Each Post by DonSegmond(m): 7:12am On Jul 28, 2015
javascript
Re: Timeline With Comment Box Attached To Each Post by wharley01(m): 6:42pm On Jul 28, 2015
Sql query
Re: Timeline With Comment Box Attached To Each Post by cbrass(m): 2:03pm On Jul 29, 2015
wharley01:
Sql query

Yea I know that nw..
Re: Timeline With Comment Box Attached To Each Post by wharley01(m): 2:25pm On Jul 29, 2015
cbrass:


Yea I know that nw..
then to do that, include comment box when looping though posts, submit comment with ajax
Re: Timeline With Comment Box Attached To Each Post by cbrass(m): 2:59pm On Jul 29, 2015
wharley01:
then to do that, include comment box when looping though posts, submit comment with ajax

When I comment on each post it shows on the other comments since it's in a loop, am using a div to show users their comments immediately else they will have to refresh the page before they see the comment, (it's Ajax am using to post the comments )
Re: Timeline With Comment Box Attached To Each Post by wharley01(m): 3:06pm On Jul 29, 2015
cbrass:


When I comment on each post it shows on the other comments since it's in a loop, am using a div to show users their comments immediately else they will have to refresh the page before they see the comment, (it's Ajax am using to post the comments )
when you post with ajax, then you should refresh comments with ajax too, and to avoid comment appearing in other people's post except the one you are commenting on, create table for comments, then create a colomn specifying the post id in the comment's table, now when inserting your comment insert post's id too, and when fetching comments fetch with the post's id
Re: Timeline With Comment Box Attached To Each Post by cbrass(m): 3:29pm On Jul 29, 2015
wharley01:
when you post with ajax, then you should refresh comments with ajax too, and to avoid comment appearing in other people's post except the one you are commenting on, create table for comments, then create a colomn specifying the post id in the comment's table, now when inserting your comment insert post's id too, and when fetching comments fetch with the post's id

What am saying is, it's not like those comments tie to another Id in the database but am just trying to let users know that their comments have been posted since Ajax will not refresh the page so in my own wisdom or folly I decided to tied the $_Post[post ] to a div element and later added it to the loop so as you post a comment you see your comment immediately but since it's a loop it will show in all the loops but in truth it's not like that in the db because if the user refresh the browser they will see the comment under the exact post it should be but I don't want them confused and beside that doesn't look professional since Facebook doesn't behave like that when you comment on a wall post. So is there a way out of this
Re: Timeline With Comment Box Attached To Each Post by wharley01(m): 4:52pm On Jul 29, 2015
cbrass:


What am saying is, it's not like those comments tie to another Id in the database but am just trying to let users know that their comments have been posted since Ajax will not refresh the page so in my own wisdom or folly I decided to tied the $_Post[post ] to a div element and later added it to the loop so as you post a comment you see your comment immediately but since it's a loop it will show in all the loops but in truth it's not like that in the db because if the user refresh the browser they will see the comment under the exact post it should be but I don't want them confused and beside that doesn't look professional since Facebook doesn't behave like that when you comment on a wall post. So is there a way out of this
do you know much about json ? Before i proceed
Re: Timeline With Comment Box Attached To Each Post by Djtm(m): 2:25am On Jul 30, 2015
Make sure the comment sections under each post has a unique id e.g
For post one
Div class= comments id=1
Comment1
comment 2
comment 3
/div

For post two
Div class =comments id=2
comment1
comment 2
comment 3
/div


You get my drift? Don't mind me, I'm too lazy to post correct html in mobile. Find a way to tie the comment with the id you gave the comment area. Something like this


Div class=post
div class=post-content> bla bla</div
div class= comments id=1
comment 1
comment 2
comment 3
/div
textarea data-id=1></textarea


Once the user submits the comment, get the data-id with JavaScript and make sure the comment is appended in div class= comments where id is the same as the data -id obtained from the comment submitted which is 1 in this case.
Re: Timeline With Comment Box Attached To Each Post by cbrass(m): 10:07am On Jul 30, 2015
wharley01:
do you know much about json ? Before i proceed

Yea
Re: Timeline With Comment Box Attached To Each Post by cbrass(m): 10:11am On Jul 30, 2015
Djtm:
Make sure the comment sections under each post has a unique .g
For post one
Div class= comments id=1
Comment1
comment 2
comment 3
/div

For post two
Div class =comments id=2
comment1
comment 2
comment 3
/div


You get my drift? Don't mind me, I'm too lazy to post correct html in mobile. Find a way to tie the comment with the id you gave the comment area. Something like this


Div class=post
div class=post-content> bla bla</div
div class= comments id=1
comment 1
comment 2
comment 3
/div
textarea data-id=1></textarea


Once the user submits the comment, get the data-id with JavaScript and make sure the comment is appended in div class= comments where id is the same as the data -id obtained from the comment submitted which is 1 in this case.

It can't work like that nw, reason because the form is coming from a loop. So as the posts are echoed from the db the comment box is echoed with them so having a unique id will only work for the first comment box in the loop
Re: Timeline With Comment Box Attached To Each Post by Djtm(m): 11:37am On Jul 30, 2015
cbrass:


It can't work like that nw, reason because the form is coming from a loop. So as the posts are echoed from the db the comment box is echoed with them so having a unique id will only work for the first comment box in the loop

No it will, I've done something like this before. Make sure reach comment box has a unique id. You can tie the comment box id with the post's id from the database.

Each post you're getting from the database has an id right? And I'm sure you know how to retrieve that id in your loop so that each post can show its id. Just pass the id into the comment box. Simple. This isn't difficult at all.
Re: Timeline With Comment Box Attached To Each Post by cbrass(m): 2:01pm On Jul 30, 2015
Djtm:

No it will, I've done something like this before. Make sure reach comment box has a unique id. You can tie the comment box id with the post's id from the database.

Each post you're getting from the database has an id right? And I'm sure you know how to retrieve that id in your loop so that each post can show its id. Just pass the id into the comment box. Simple. This isn't difficult at all.

But how will you be able to use that with ajax, you know id is unique in js
Re: Timeline With Comment Box Attached To Each Post by Djtm(m): 10:40pm On Jul 30, 2015
cbrass:


But how will you be able to use that with ajax, you know id is unique in js
Use another attribute. You can use id for the post and data-id for the comment box.
Re: Timeline With Comment Box Attached To Each Post by Nobody: 11:54pm On Jul 30, 2015
cbrass:


But how will you be able to use that with ajax, you know id is unique in js

ive once done that though i cant recall all the processes i followed then, also it is not in PHP, i did it in ASP.NET (C#). I must state categorically here, that i did not use ajax, just webforms......


I created a database table for name, date and comment.

So i created a webform; connect it database and attached appropriate textboxes and textarea. However, i disabled my datetime texbox visibility. So the user dont get to see the datetime textbox........so when i wrote my insert statement for datetime, i used 'insert into user_rec values(..........., + ' DateTime.Now.ToString()'


So......after that, i now applied hashtable and sort a datagrid table binded to my database.

I think i sorted the date header in my datagrid, in descending order...........i cant remember exactly how i did but it worked......updating the datagrid with latest post each time the submit button is clicked and page refreshed.......


I dont know whether it solved your problem but i believe you will find it helpful.
Re: Timeline With Comment Box Attached To Each Post by cbrass(m): 4:25am On Jul 31, 2015
Djtm:

Use another attribute. You can use id for the post and data-id for the comment box.

Yea, you are right, I actually converted it to class attributes
Re: Timeline With Comment Box Attached To Each Post by cbrass(m): 4:28am On Jul 31, 2015
It's not like I really need help but just created this thread so others can learn especially beginers, have noticed that WordPress guys have taken over the webmaster section and no o one is posting code problems again so I ran here. cheesy

(1) (Reply)

Integrate Voguepay Gateway Payment Into Your Android App / who Can Help Me With Countries State And Cities Sql / Mentorship For Beginner Web Developers.

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 35
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.