Soldato
- Joined
- 12 Feb 2006
- Posts
- 17,589
- Location
- Surrey
ok so lets say i have a comments system in that user posts comments which consist of title and description.
i have 20 selected at a time order by the timestamp and a link (which is the title) is shown which will link to the full description.
now the trouble i'm having is displaying the date as a header if it changes, so all the comments with today date have header saying todays date and they are listed under it, then ones with yesterday have yesterday date and are listed under, repeat until the 20 are all shown
now i can't seem to get my head round the logic behind how i am trying to do this.
atm i have a while loop going, which first displays todays date, the first comment title, then say for the next do you have same date, if yes display, if not display yesterday date as a header and then display title.
the trouble is then as it will do the same for any not with todays date and i can't think how to say if you are not todays date but have you already been put as a header.
hope i have been clear in what i'm doing. probably done it a very illogical way so if there is a better please suggest, i find best to learn from my mistakes rather then suggestions which is why i have done it first how i tihnk to do it.
i have 20 selected at a time order by the timestamp and a link (which is the title) is shown which will link to the full description.
now the trouble i'm having is displaying the date as a header if it changes, so all the comments with today date have header saying todays date and they are listed under it, then ones with yesterday have yesterday date and are listed under, repeat until the 20 are all shown
now i can't seem to get my head round the logic behind how i am trying to do this.
atm i have a while loop going, which first displays todays date, the first comment title, then say for the next do you have same date, if yes display, if not display yesterday date as a header and then display title.
the trouble is then as it will do the same for any not with todays date and i can't think how to say if you are not todays date but have you already been put as a header.
hope i have been clear in what i'm doing. probably done it a very illogical way so if there is a better please suggest, i find best to learn from my mistakes rather then suggestions which is why i have done it first how i tihnk to do it.