Making tutorials - your wishlist

Reply

Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso
 
1
  #81
Oct 15th, 2009
Both players are ok. The default.html one has that flvplayer image in the upper right hand corner which is annoying.

As for the content of the tutorial, I have noticed some errors.

The entire tutorial is suppose to be about a blog, not a blog commenting system. Blogs don't allow anyone to add their own post. There should be an admin area where the blog owner updates and adds blog entries. You just have shown how to add comments.

HTML:

You didn't declare a doctype.
You are missing the <html></html> tags.
Your form tag is missing the action attribute which is required.
Your textarea is missing the cols and rows attributes which are required.
You are using inline styling which isn't good.
Indent your html so its easier to read.

PHP:
The method of post separation you used doesn't make sense to me. You are adding unnecessary data to the file.

Your code doesn't allow for line breaks. They are forgotten when the post is submitted. If you replace those with nl2br() and then store the posts with a new line between them you can just use file() to get the data.

You need to show how to open up files with fopen,fread,fclose because not all of the viewers will have php5 for the file_get_contents.

The alternating colors could be handled differently. Why not use the % operator?

Checking if $_POST is set will always return true. I wouldn't use that. You should check to see that the submit button name is in the post array.

There were some other things that didn't quite make sense to me. I will look through it again to see if I understand what you were trying to do.
Last edited by kkeith29; Oct 15th, 2009 at 8:02 am.
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,473
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso
 
0
  #82
Oct 15th, 2009
I shall fix all of that in the next version of the tutorial and the only part of kkeith29's comment that I would disagree with is the following:
Your textarea is missing the cols and rows attributes which are required.
Well what I did there was I used css to set the box size instead of using cols and rows. So css took over that job making it more efficient. So I as I said, thanks for the comment on that and I have just discovered a new flv player which is free (others cost hundreds with a doggy license) and should do the job. You will be able the view the viewer I am going to use at
http://www.syntax.cwarn23.info/media/new.html
Wonder what other negative comments there will be on this video?
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso
 
0
  #83
Oct 15th, 2009
Sorry, I might of sounded at bit harsh there. Its 6:13am here and I haven't been to bed yet. I was just listing what I saw. I figured since others will be viewing and learning from it, the tutorial must be as simple as possible using the best techniques.

The rows and cols comment comes from the fact the w3 validator says they are required.

I am recoding the tutorial using the stuff I mentioned earlier. I will post it here for you to look at and see if you want to implement any of it.
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,473
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso
 
0
  #84
Oct 15th, 2009
Sorry, I might of sounded at bit harsh there. Its 6:13am here and I haven't been to bed yet.
I think you misunderstood part of my text. I actually like the negative feedback because then I know what to change for next time. So it is great that you posted so many questions and statements. Just for that I'll add + to your rep.

The rows and cols comment comes from the fact the w3 validator says they are required.
Ok, then I shall read the w3 documentation to see how they recommend using both css and html (cols/rows) usage.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso
 
0
  #85
Oct 15th, 2009
The new player you are using has a flaw in it. When I press play it starts the video, but doesn't show a pause button. I just goes directly back to play. So when I try to pause it, it darkens the screen and keeps playing the video. Its like the button is inverted.
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,473
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso
 
0
  #86
Oct 15th, 2009
Doh.
Version 10 of Flash is so incompatible with version 9 designed apps. With version 9 of Flash the bar is perfect but as soon as I go into Internet Explorer which has version 10 then the bar as you said is backwards. I guess I have another long journey finding a free flv player ahead of me.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso
 
0
  #87
Oct 15th, 2009
Here is my version of your tutorial. The css styling is incomplete as I didn't feel like doing it. This is xhtml strict validated. The php is untested but looked like it would work.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  3. <head>
  4. <title>My Blog</title>
  5. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  6. <style type="text/css">
  7. body {
  8. font-family: arial,"arial black","sans serif";
  9. font-size: 12px;
  10. }
  11. #container {
  12. width: 500px;
  13. }
  14. .gray {
  15. background-color: #999;
  16. }
  17. .light-gray {
  18. background-color: #ccc;
  19. }
  20. #container .entry {
  21. width: 500px;
  22. margin-top: 15px;
  23. border: 1px #333 solid;
  24. }
  25. #container .entry .name {
  26. /*style the name here*/
  27. }
  28. #container .entry .content {
  29. /*style the content here*/
  30. padding: 5px;
  31. }
  32. .form .form-row {
  33. /*style form rows here*/
  34. }
  35. .form .form-label,.form-data {
  36. padding: 5px;
  37. /*style form labels and inputs here*/
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <div id="container">
  43. <?php
  44.  
  45. $data = array_chunk( file('data.txt'),2 );
  46.  
  47. $i = 0;
  48. foreach( $data as $entry ) {
  49. list( $name,$content ) = $entry;
  50. $color = ( ( $i % 2 ) == 0 ? 'gray' : 'light-gray' );
  51. echo <<<ENTRY
  52. <div class="entry {$color}">
  53. <div class="name">Name: {$name}</div>
  54. <div class="content">{$content}</div>
  55. </div>
  56. ENTRY;
  57. $i++;
  58. }
  59.  
  60. if ( isset( $_POST['submit'] ) ) {
  61. $name = htmlentities( $_POST['name'],ENT_QUOTES );
  62. $entry = str_replace( array('\r\n','\r','\n'),'<br />',htmlentities( $_POST['data'],ENT_QUOTES ) );
  63. //can add error handling here, check for duplicate entries
  64. file_put_contents( 'data.txt',"{$name}\n{$entry}\n",FILE_APPEND );
  65. }
  66.  
  67. ?>
  68. <div class="form">
  69. <form action="index.html" method="post">
  70. <div class="form-row">
  71. <div class="form-label">Name:</div>
  72. <div class="form-data"><input type="text" name="name" /></div>
  73. </div>
  74. <div class="form-row">
  75. <div class="form-label">Entry:</div>
  76. <div class="form-data"><textarea cols="30" rows="7"></textarea></div>
  77. </div>
  78. </form>
  79. </div>
  80. </div>
  81. </body>
  82. </html>
Last edited by kkeith29; Oct 15th, 2009 at 8:59 am.
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,473
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso
 
0
  #88
Oct 15th, 2009
I shall make some new code with yours being a guide of what features should be implemented (example: I see you added a name field for each poster). Also I'm not sure if this applies in your script but the file function can be a bit buggy because at the end of each array it appends the string "\r\n" which is the new line in the text file. I will post new code in the next 1 or 2 days on this thread to see if it is good enough to be aired.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso
 
0
  #89
Oct 15th, 2009
I have never had that problem (I must not of noticed it). You can just read the file and use explode with "\n" kind of like you did before. Or use array_filter right after the file() call.
Last edited by kkeith29; Oct 15th, 2009 at 9:04 am.
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,473
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso
 
0
  #90
Oct 16th, 2009
I just found a free flv player and can be previewed at
http://www.syntax.cwarn23.info/media/new.html
Are you able to spot any obvious bug that I didn't see. I know the full screen mode doesn't work but other than that is it all ok? Thanks.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC