HLMCOMPANY.COM

Buck

Storage? I am Storage!
Joined
Feb 22, 2002
Messages
4,514
Location
Blurry.
Website
www.hlmcompany.com
I'm to lazy to search through all of our threads to find where Tannin posted the upgrades for his website, so I'm starting a new thread. Recently I've had these ambitions to update and improve the content of my site, so I added some content to my history of WD and more recently, I uploaded a bunch of definitions for computer terms that I've found helpful. Please let me know what you think.

http://www.hlmcompany.com/hardware.php
 

timwhit

Hairy Aussie
Joined
Jan 23, 2002
Messages
5,278
Location
Chicago, IL
There are a ton of definitions there. How about an interface to search for them quickly, especially if the user doesn't know what the definition starts with.
 

Buck

Storage? I am Storage!
Joined
Feb 22, 2002
Messages
4,514
Location
Blurry.
Website
www.hlmcompany.com

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
I think the items in the link I posted are geared more for databases...I didn't look through all of them.

A database may not be too complicated with the information you have, it could be a fun side project. No promises, but let me put something together and see how it works. Your "definitions" setup is nice and that looks like it could benifit from a seach also.
 

Howell

Storage? I am Storage!
Joined
Feb 24, 2003
Messages
4,740
Location
Chattanooga, TN
Buck said:
Great idea Tim. Can anyone give me a tip on how to start a search function for my site? (Code and idea.) :)

The easiest way would be to compile all of the pages into an additional super-long single page which could be searched with CTRL-F.

Or instead of a single page you could break it into 3 or 4.
 

Buck

Storage? I am Storage!
Joined
Feb 22, 2002
Messages
4,514
Location
Blurry.
Website
www.hlmcompany.com
Thanks for your compliments and input.

As a note Howell, when all of the static material is together, it takes Mercutio 1:48 seconds to download the definitions. I would prefer something that downloads faster. Maybe I'm just talking jibberish and don't understand what you mean. :)
 

Tea

Storage? I am Storage!
Joined
Jan 15, 2002
Messages
3,749
Location
27a No Fixed Address, Oz.
Website
www.redhill.net.au
Very nice work, Buck. The look and feel is great. I really like it. And your focus on WD lets you tell a particular story, rather than jump about all over the place confusing people: that's good too.
 

Buck

Storage? I am Storage!
Joined
Feb 22, 2002
Messages
4,514
Location
Blurry.
Website
www.hlmcompany.com
Thanks for the compliments oh young she-orangutan. One of these days I will have to include the history for another product.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
Sorry buddy. You didn't comment on the idea, (good or bad) so I never started it.

I would need to work out some details with you so that the tool can manage your definitions in a way that makes sense to your website and also in a way that doesn't cause you pain to enter them.

I see your page is using php now, are you managing the data through the use of includes? Do you happen to have a master list of the words and definitions I could use? If not, I can borrow some of the data you have now. I might need to see (once I have something done) your website framework in order to make this script incorporate into your design.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
I was thinking more along the lines of managing the definitions. Searching is one thing, but adding and managing new definitions is another thing. It looks like Buck is addeding them into individual php files for each letter of the alphabet. If it can be done, why not make a query to a database and extract the data for a given letter based on a url path.

definitions.php?def=a
or
definitions.php?def=b

and so on...

In the php you would make a variable for def ($tmp=$_GET[def]) and then query the data accordingly.

I'm working on both right now. The searching will be the hardest part IMHO.
 

Buck

Storage? I am Storage!
Joined
Feb 22, 2002
Messages
4,514
Location
Blurry.
Website
www.hlmcompany.com
Glad to have you on the job Handy. As you mentioned, finding a better way to manage and add definitions is my first concern. Searching is second. Presently I have a separate php file for each letter of the alphabet. I have this code on my definitions (definitions.php) page:
Code:
<td width=95% valign=top align=left>
<font class="mediumheader">Definitions</font>
<?php $phpbb_root_path = './'; include($phpbb_root_path . 'definitionsnav.php')?>	
</td>

Then in the definitionsnav.php file I have:
Code:
[url="definitionsa.php"]A[/url]
[url="definitionsb.php"]B[/url]
[url="definitionsc.php"]C[/url]
[url="definitionsd.php"]D[/url]
[url="definitionse.php"]E[/url]
[url="definitionsf.php"]F[/url]
[url="definitionsg.php"]G[/url]
[url="definitionsh.php"]H[/url]
[url="definitionsi.php"]I[/url]
[url="definitionsj.php"]J[/url]
[url="definitionsk.php"]K[/url]
[url="definitionsl.php"]L[/url]
[url="definitionsm.php"]M[/url]
[url="definitionsn.php"]N[/url]
[url="definitionso.php"]O[/url]
[url="definitionsp.php"]P[/url]
[url="definitionsq.php"]Q[/url]
[url="definitionsr.php"]R[/url]
[url="definitionss.php"]S[/url]
[url="definitionst.php"]T[/url]
[url="definitionsu.php"]U[/url]
[url="definitionsv.php"]V[/url]
[url="definitionsw.php"]W[/url]
[url="definitionsx.php"]X[/url]
[url="definitionsy.php"]Y[/url]
[url="definitionsz.php"]Z[/url]

Then nested within each of those references is the static data. It might seem that I've really made this more complicated then necessary, but it has made the data very flexible and easy for me to change layouts and formats for the higher-level pages.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
Ah... I see how it works now. Almost like a plug-in. Tricky...I like it. I'm going to be out tonight, so I may not get the time to work on this, but tomorrow I should be able to.
 

Buck

Storage? I am Storage!
Joined
Feb 22, 2002
Messages
4,514
Location
Blurry.
Website
www.hlmcompany.com
Handruin said:
Ah... I see how it works now. Almost like a plug-in. Tricky...I like it. I'm going to be out tonight, so I may not get the time to work on this, but tomorrow I should be able to.

No worries Handy, I'm not pressing you for time, just looking for a little assistance when it is available.
 

Buck

Storage? I am Storage!
Joined
Feb 22, 2002
Messages
4,514
Location
Blurry.
Website
www.hlmcompany.com
Oh yeah, one more level deep in the code. When the Anchor tag references something like definitionsa.php, on that page the code includes:
Code:
<td bgcolor="#aaaadd" cellspacing=2>
<table bgcolor="#aaaadd" border=0 cellpadding=10 cellspacing=2>
<?php $phpbb_root_path = './'; include($phpbb_root_path . 'a.php')?>
</table></td>

So, it is deeper then I had originally posted.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
If I were to write the code, how would you like to include it into your existing site?

So let me talk this through:

Your main page file named "definitions.php" includes "'definitionsnav.php'".

The "'definitionsnav.php'" file includes the individual lettered files named "definitionsa.php through definitionsz.php".

Then the last level is "definitionsa.php" includes "a.php" and likewise for the remaining files.

Have I understood so far?

Also...do you have a phpbb for install? You’re using a variable typically defined from phpbb. :)

Keeping the current format, would you like to alternate the table color of definition entries? (kinda like how this forum does with each post)

Let me work out a static (non-database) example to see if you can make it work with the existing design. Adding the database element will not be a problem afterwards.
 

Buck

Storage? I am Storage!
Joined
Feb 22, 2002
Messages
4,514
Location
Blurry.
Website
www.hlmcompany.com
If I were to write the code, how would you like to include it into your existing site?

So let me talk this through:

Your main page file named "definitions.php" includes "'definitionsnav.php'".

The "'definitionsnav.php'" file includes the individual lettered files named "definitionsa.php through definitionsz.php".

Then the last level is "definitionsa.php" includes "a.php" and likewise for the remaining files.

Have I understood so far?
Indeed you have.

Also...do you have a phpbb for install? You’re using a variable typically defined from phpbb.
My host uses php, I just copied their examples of the include statement.

Keeping the current format, would you like to alternate the table color of definition entries? (kinda like how this forum does with each post)
Yes, that would be nice.

Let me work out a static (non-database) example to see if you can make it work with the existing design. Adding the database element will not be a problem afterwards.
That sounds great, thanks for your help Handy.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
I've got more work to do, but here is the progress I've made so far. Right now it is reading information from a database. I found a normalization issue in the database, so I have to rescript it tomorrow night. I'll let you know when I have more info.

Also, I've only entered a few items for letters "a" and "b", so don't worry about the other letters, they have no data to disply. They are, however trying to access the database, so it's only a matter of entering the information. (web form will be in part 3 or part 4 of development) I've also accounted for your script to grow if you ever want to include definitions that start with numbers. All you have to do is update a simple array.

I've also tried to secure the URL parameter when you click on a letter. since "d" becomes the variable, I've tried to clean out any malicous code. I'm not perfect, so you might want to play around with it and try some combinations of characters. (typically slashes and quotes can ruin a script if entered in the correct configuration)

http://projects.handruin.com/buck/def_script.php

ps don't mind the crude formatting, it will change once I get the script going. You will be able to apply your CSS and design to this script.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
More delays. I'm having trouble with writing a select statement that incorporates a left join.

Does anyone know how to write a select statement that pulls related data from two tables?

The joys of a relational database.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
Yippie, it works:

Code:
SELECT def_words. * , def_words.def_group_id
FROM def_words
LEFT  JOIN def_group_type ON def_group_type.def_group_id = def_words.def_group_id
WHERE def_group_type.def_group_name = 'a'

I'm still trying to figure out WHY it works, but it does exactly what I need...
 

Will Rickards WT

Learning Storage Performance
Joined
Jun 19, 2002
Messages
433
Location
Pennsylvania, USA
Website
www.willrickards.net
I think you have your join reversed?
You want all the words with a group correct? Where the words are in def_words and the groups are in def_group_type?

That would be (In SQL Server SQL):
Code:
SELECT def_group_type.def_group_id, def_words.*
FROM def_group_type LEFT OUTER JOIN def_words
     ON (def_group_type.def_group_id = def_words.def_group_id)
WHERE def_group_type.def_group_name = 'a'

A left outer join takes everything from the table on the left and returns what it can match with the table on the right. If a match isn't found on the right, nulls are returned. This ensures you aren't excluding any rows from the left table because there is no corresponding entry in the right table.
 

Buck

Storage? I am Storage!
Joined
Feb 22, 2002
Messages
4,514
Location
Blurry.
Website
www.hlmcompany.com
Will Rickards WT said:
A left outer join takes everything from the table on the left and returns what it can match with the table on the right. If a match isn't found on the right, nulls are returned. This ensures you aren't excluding any rows from the left table because there is no corresponding entry in the right table.
:eekers: I hope Handy understood that. :D
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
Will Rickards WT said:
I think you have your join reversed?
You want all the words with a group correct? Where the words are in def_words and the groups are in def_group_type?

That would be (In SQL Server SQL):
Code:
SELECT def_group_type.def_group_id, def_words.*
FROM def_group_type LEFT OUTER JOIN def_words
     ON (def_group_type.def_group_id = def_words.def_group_id)
WHERE def_group_type.def_group_name = 'a'

A left outer join takes everything from the table on the left and returns what it can match with the table on the right. If a match isn't found on the right, nulls are returned. This ensures you aren't excluding any rows from the left table because there is no corresponding entry in the right table.

Yes...in my basic English I want to:

Select all the words, definitions, and time from my word.table when a specific group is specified.

Code:
Tables:
	def_group_type
		def_group_id [int(11) auto_increment]
		def_group_name [char(1)]
	
	def_words
		def_id  [int(11) auto_increment]
		def_name  [text]
		def_description  [text]
		def_create_time  [int(11)]
		def_update_time  [int(11)]
		def_group_id  [int(11)]


In order to normalize the database, I've separated the groups into their own table. (def_group_type) When I run my select, I was trying to figure out how to select the correct group name (def_group_type.def_group_name) based on the integer value in the def_words table. (def_words.def_group_id)

Is a left outer join (in your example) what I need for this task? I'm new to querying relational information, so any help you can offer is greatly appreciated. I'm going to try your example to see what the results are. Thanks for your help.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,931
Location
USA
Will, I tested your join and it gives me the same data, except now the table output is different. (as expected)

I read your comment several times and when you say "This ensures you aren't excluding any rows from the left table because there is no corresponding entry in the right table.", there should never be an instance when I need a row that doesn't match, so I would want it to be excluded.

Each and every word will be required to have a "def_group_id" which I think is setup as my foreign key. Therefore, the ID can only exist in the def_word if it exists in "def_group_type".
 
Top