Need some feedback please on a project

Discuss all aspects of programming here.

Moderator: The Mod Squad

Need some feedback please on a project

Postby Toby B. » Mon Jul 04, 2005 12:06 pm

Ok the object here is to get code on my siite more manageable. I have made quite a bit of progress the past day or so. But need some honest input/feedback on this code (i.e. the comments being detailed enough, etc...

Basically what I did was broke the code up a bit to ease any confusion on what is what and here edits need to be made. I am most likely going to be updating it even more as time goes on, but this is IMHO a good stepping stone for me...

The following code is a test page that I setup using one of the "live" pages from my site. I got notes to explain what each variable does, and the bulk of the code is in a .tpl file since it does not have to be modified. All edits for each page will be made using the code below. Each motherboard page as it stands right now will look like this:
Code: Select all
<?php
/* File revision 7/04/05 @ 4:15AM:- There is an information link at the bottom or this page. PLEASE keep an eye on that thread and post as necessary in that thread!!! */
$meta_title = "Tahiti 2.x - HP OEM Asus A7V-VM Motherboard";
/* $meta_title is what found between the <title></title> */
$content1 = "Spec sheet and downloads for the HP Tahiti motherboard";
/* $content1 is the description portion of the meta tags */
$content2 = "HP, Tahiti 2.x, motherboard, spec sheet, downloads, information";
/* $content2 is the keywords portion of the meta tags */
$page_name = "Tahiti 2.x";
/* $page_name is what shows on the top of the pages NOT the title bar!! */
$image = "/common/noimage.jpg";
/* $image is the code that controls the actual pic on the page. Not the actual size control but the location of the image. */
$processors = "Unknown";
/* $processors is the code that controls the listing for the processor for the board(s) */
$bus = "Unknown";
/* $bus is the code that controls the listing for the bus speed for the board(s) */
$chipset = "Unknown";
/* $chipset is the code that controls the listing for the chipset for the board(s) */
$RAM = "Unknown";
/* $RAM is the code that controls the listing for the RAM for the board(s) */
$video = "Unknown";
/* $video is the code that controls the listing for the Video for the board(s) */
$audio = "Unknown";
/* $audio is the code that controls the listing for the Audio for the board(s) */
$expansion = "Unknown";
/* $expansion is the code that controls the listing for the Expansion Slots for the board(s) */
$part_numbers = "Unknown";
/* $part_numbers is the code that controls the listing for the Spare Part Numbers for the board(s) */
$add_images = "None";
/* $add_images is the code that controls the listing for any additional image(s) such as Front Panel pinouts, etc.. */
$models = "<b>HP</b> - <i>7770(P3052A-ABU), 7830(P3077A-ABN), 7830(P3082A-ABE), 7840(P3066A-ABH),
7850(P3073A-ABS), 7860(P2881A-ABF), 7860(P3085A-ABE), 7861(P2997A-ABM),
7870(P2883A-ABF), 7880(P3061A-ABU), 7880(P3068A-ABH), 7880(P3074A-ABS),
7880(P3079A-ABN), 7890(P2887A-ABF), 7891(P3064A-ABU), 8705(D7205Y-ABA),
8705(D7206A-ABA), 8705(D7206B-ABA), 8705(D7206C-ABA), 8705(D7206D-ABA),
8705(D7206E-ABA), 8705(D7206F-ABA), 8705(D7206G-ABA), 8710(D7206W-ABA),
8710(D7206Y-ABA), 8720(D7206P-ABA), 8720(D7206Q-ABA), 8750(P2882A-ABS),
8760(P2885A-ABS), 8775(P2849A-ABU), 8776C(P2978A-ABA), 8860(P2941A-ABA),
8870(P2942A-ABA), 8890(P3128A-ARS), 9720(P2852A-ABU), 9725(P1433A-ABF),
9726(P2906A-ARS), 9726(P2906A-UUB), 9730(P2864A-ABF), 9740(P2854A-ABU),
T9715(P2862A-ABF), XL844(P3978A-ABA), XL847(P3980A-ABA), XL866(P3945A-ABA),
XL876(P3946A-ABA), 7835, 7865, 7885, FR 7939, UK 7940, US/CAN 7950, FR 7950, NL 7950, NW 7950, UK 7950, LA 7957, SP 7960, xL946 US/CAN, 9720 cfg-PC, AP 8886</i>";
/* $models is the code that controls what systems this board is found in. This particular test file pertains to a board that is only found/reported in HP systems. Please follow the link at the bottom of this page for more detailed information... */
$b_docs = "None";
/* $b_docs is the code that controls what manuals/documentation/etc is availible for this board. */
$retail = "This motherboard is an OEM Asus A7V-VM. <br><i>No retail information availible at this time.</i>";
/* $retail is the code that controls What the manufacturer and model of the board is. Please be sure to keep the code tags intact!! */
$notes = "HP";
/* $notes is what adjusts the Manufacturer in the notes section of each page. You will need to update this accordingly!! */
$f_link = "/forum/viewtopic.php?t=552";
/* $f_link represents the link to the Motherboard Pages Discussions thread */
include ('includes/header2.inc');
include ('includes/template1.tpl');
/* header2.inc is the code that contains the Title, META tags, and HEAD code. You need not worry about this file with the availible adjustments above.
   template1.tpl --->> See http://www.ctechinfo.org/forum/viewtopic.php?t=655 For more information..
 */
?>


So please do not hold back. Tell me what you think. I am ahead of myself in many respects with php code. But I have managed some workarounds to suit my needs... Major limitations right now is no extra MySQL DB space nor do I have the knowlege at this time to get into MySQL programming...

The one nice feature to this new coding setup is that it will reduce the space used on the server since I will be using on .tpl file for all the pages instead of having hundreds of pages containing all the same code....

Thanks in advance
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby Tolemac » Mon Jul 04, 2005 3:16 pm

8O



Ya lost me at the bakery mate.


I've not got a frelling clue about code. Hopefully when Pat sees this he can sort you out. 8)
Tolemac
Mobo-fu Master
Mobo-fu Master
 
Posts: 14276
Joined: Tue Sep 12, 2000 12:01 am
Location: L-1 Bridge

Postby Toby B. » Mon Jul 04, 2005 3:36 pm

Ross, you missed the point of this thread... (I think... 8O )

The notes describing what does what/etc, is what I am looking for feedback on..

The notes are:
Code: Select all
/* This is a note to show what notes in code look like */


In the code I posted above are variables and notes to explain what they mean/do.... So basically if you can look at that code and say "ok this does that, and to make a new page or update an existing page I edit this text here."
:P
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby Tolemac » Mon Jul 04, 2005 8:07 pm

If you say so, then it must be true. :P

No really, I now understand what you are looking for, but I'm just the hardware guy. I gave up doing code, except for some html, back in '77 when it took me over an hour to code basic to have the comp type "hello" across the screen. :roll: (GoTo Sub Routines, anyone? :mb_pcmad:: )

As far as I can tell, it looks like you have everything in there. I take it this will make it easier for you (or someone else?) to imput info into your pages?
Tolemac
Mobo-fu Master
Mobo-fu Master
 
Posts: 14276
Joined: Tue Sep 12, 2000 12:01 am
Location: L-1 Bridge

Postby Toby B. » Mon Jul 04, 2005 8:20 pm

As far as I can tell, it looks like you have everything in there. I take it this will make it easier for you (or someone else?) to imput info into your pages?
That is the proposed end result yes. To ease the confusion for others that want to help... :wink:
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby useless comment » Tue Jul 05, 2005 2:42 am

i'm not into php at all but programming is programming, be it php, C or bash. the only problem i have is that i'm used to comments preceding the statements or sections of code(or trailing the code on the same line for one-liners).

/* This function repeats itself more than my sister. */
beat(dead_horse)
{
.
.
.
}

or

.
.
.
i++; /* Increment i by 1 so that bank worm will never deduct a whole number. */
.
.
.

For preceding comments, if it's alot, i like to manually line break it so it's all nice and neat

/*
$image is the code that controls the actual pic
on the page. Not the actual size control but the
location of the image.
*/
$image = "/common/noimage.jpg";


But this is all really just personal preference.

other than that, were you looking for missing things in your code? like boards with onboard NIC and other extras or is that not the main idea here?

and that's all i really have on the subject.
useless comment
Black Belt 1st Degree
Black Belt 1st Degree
 
Posts: 1344
Joined: Wed Mar 14, 2001 1:01 am

Postby BorderGuard » Tue Jul 05, 2005 5:18 am

I agree with sodsm.

I program VB, C++ and just got into HTML. With most forms of code, I was always taught to put things before but the way I see it if the person looking at the code has done much programming then they will quickly understand your technique as long as you stay consistent and it looks like you have.

Just an input from a beginner in HTML.
BorderGuard
 

Postby Toby B. » Tue Jul 05, 2005 12:18 pm

other than that, were you looking for missing things in your code? like boards with onboard NIC and other extras or is that not the main idea here?

Just looking to see if what I wrote for notes in the code were detailed enough to explain what is what....

This code is easy for me to understand since I wrote it. I am trying to make it easier for others who may or may not choose to assist me in building my site...
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby useless comment » Tue Jul 05, 2005 6:14 pm

okay, i get it now, just a little confused. anyway, i think it's perfectly clear. on the other hand, over-commenting can sometimes burn you out on a project. i find that little notes on moderately intricate sections or verbose notes on extremely tough sections is all i need.

you said you are trying to get rid of redundant code but most of your comments are fairly redundant:

Code: Select all
$RAM = "Unknown";
/* $RAM is the code that controls the listing for the RAM for the board(s) */
$video = "Unknown";
/* $video is the code that controls the listing for the Video for the board(s) */
$audio = "Unknown";
/* $audio is the code that controls the listing for the Audio for the board(s) */
$expansion = "Unknown";
/* $expansion is the code that controls the listing for the Expansion Slots for the board(s) */


could be changed to:

Code: Select all
/* Variables for board components - RAM, video, audio, etc. */
$RAM = "Unknown";
$video = "Unknown";
$audio = "Unknown";
$expansion = "Unknown";
/* End of board component variables. */


about the commenting style, i am just so used to the other way that i think i now know what it feels like to be dyslexic.
useless comment
Black Belt 1st Degree
Black Belt 1st Degree
 
Posts: 1344
Joined: Wed Mar 14, 2001 1:01 am

Postby Toby B. » Tue Jul 05, 2005 7:24 pm

I like that style sodsm, it cuts out a lot of extra crap... :P

I found one major flw in my code that I am not sure how to fix... The way the current code is done it renders the template file useless (the $add_images needs to have an if/else if statement {I think})...

Basially I cant get links totally figured out to properly show on the page. If I know there is supposed to be a link for a variable I wrote the code like:

In the html file
Code: Select all
$variable = "/link/to/file"


In the template1.tpl file I have it written:
Code: Select all
<a href="<?php echo($variable);?>">Link Description</a>


But like the $add_images, I need to have it work so that if there is no links to place there (such as front panel pinouts, etc.), it shows as or None...
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Next

Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest