xoligy Posted June 26, 2008 Share Posted June 26, 2008 Why do i always get more code right when im about to goto bed 0.o Right got the news page 100% working now with bbcode, and authors name taking you to the persons profile. All i need now is to make it so that when a new comment is made the colour of the link changes. So say the link says Comments|0 in blue it go Comments|1 in green? Also is there a way to make new comments be another color from the rest? By that i mean the bg color of the table the comment is in. What code do you require to help with this if you help that is One last thing... how the heck do i add error fields like the one on this forum (i posted with no subject and the post was still here and i was told what was wrong! on mine it goes "Missing Imput" and i loose all the post :'( Quote Link to comment https://forums.phpfreaks.com/topic/112026-change-color-on-new-post/ Share on other sites More sharing options...
.josh Posted June 26, 2008 Share Posted June 26, 2008 1) in your loop that displays it, you just use a variable that acts like a switch. Something as simple as this will work: $x = 0; while/for(....) { $color = (($x % 2) == 0)? "#0000FF" : "#00FF00"; $x++; // your stuff to display here: use $color as the color } 2) The short answer is yes. The long answer depends on what you mean by "new comments". Do you mean x amount of newest comments, based on straight last x posts, or all within x time? Do you mean just the very last comment posted? Regardless, your condition would also be inside your loop that displays them. 3) use 1 and 2 to try and work it out. if you're having issues, post what you've tried 4) on your form validation you're checking posted vars right? and if something is missing/wrong, you spit out an error message and display the form again right? If the form is on the same page as the validation, simply use the posted vars as default values in your form elements. On page load, they will either be blank (because first time coming) or filled out with what you had (because you submitted). If it is on a different page, you can use session vars instead. Quote Link to comment https://forums.phpfreaks.com/topic/112026-change-color-on-new-post/#findComment-575038 Share on other sites More sharing options...
xoligy Posted June 26, 2008 Author Share Posted June 26, 2008 Thanks for the info Crayon i'll give it ago when i get home and see how things go Quote Link to comment https://forums.phpfreaks.com/topic/112026-change-color-on-new-post/#findComment-575040 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.