PDA

View Full Version : Hey everyone! im back! :D..and I need help :P


IamMrRay
14 Jun 2006, 08:12pm
Well, most of the problems I had in the past have been overcome. Currently I have been trying to learn LAMP (linux, apache, mysql, php) based webdesign on my free time and I am going pretty slow in my progress. I am making an antique site for a friend/boss of mine and I have a question about how to do something.


We have the site:

+-----------------------------+
|the site!..............................|
+-----------------------------+
|.menu ................................|
+-----------------------------+
|+---------------------------+|
||content_window.................||
||-----float left row-----------||
|| +---+..+---+..+---+..+---+ ||
|| |pic |..|pic |...|pic |..| pic| ||
|| |txt |..| txt|...|txt |..|txt | ||
|| +---+..+---+...+---+.+---+ ||
||----------------------------||
|+------------------------- --+|
+------------------------------+

so if i made it good enough to read, i have 4 boxes w/ pictures and descriptions of items in a row to prevent overflowing when i float them left, and I want my mysql database to have stuff like the item no and stuff like that that i already pretty much have a good idea of. The thing I am having a little bit of confusion with is the php. I want it to check if it there is any results, if there are---it will make a row for 4 boxes w/ descriptions and pics and then close the row make a new one and start over. I need some guidance cause I am a little new to this. :tongue2:

If anyone could help I can not express how much I would appreciate it. I would try it on my own, but I want to see if any of you guys could give me a push in the right direction at least so I save a little time. I am using <div's> and CSS w/ XHTML strict rules for the setup. If I HAVE TO, I might cave and use tables..but I rather not... Any help would do :)

THX

Ray
--------------------------------------------
BTW: I graduated--wooot woot :)

lightnin
19 Jun 2006, 06:13pm
?>
<form name="someForm" action="someAction">
<?
$results = $stockManager->searchMerchandise($shortDesc, $longDesc, $priceMin, $priceMax, $sku);
if(count($results) > 0){
?>
<div id="returnMerchandise" class="yourclass">
<?
for($i = 0; $i < count($results); $i++){
?>
<div class="item">
<h3 class="picTitle"><?echo($results[$i]["shortDesc"]);?></h3>
<p class="desc"><?echo($results[$i]["longDesc"]);?></p>
<img class="itemPic">insert your image stuff here</img>
<p class="price"><?echo($results[$i]["price"]);?></p>
</div>
<?
}//end for
}
?>
</form>
<?
} else {
?>
<p class="warning">
Sorry we couldn't find any of those in our system.
</p>
<?



maybe something to that effect. of course this is merely an example.


--edited i had two sets of form tags, oops.


anyways my best advice would be to get hte page designed out how you'd like it with a few results in static html/css and then 'plug in' the php end of things. i think it might be easier for you that way.

IamMrRay
20 Jun 2006, 06:54pm
<?php
require('top.inc');
require('menu2.inc');


echo "
<div id='main' class='hideMe'>
<span class='content_header'>TEST </span>
<div class='content_box'> \n";


mysql_connect('localhost', 'blahblahblah', 'blahblahblah');
mysql_select_db('dbname');

$sql = "SELECT (item_number, year, materials, dimensions, location, cost, misc)
FROM items
ORDER BY area, locname";
$res = @mysql_query($sql);
$count = 0;
while (list ($i, $y, $m, $d, $l, $c, $misc) = mysql_fetch_row($res)) {
echo "<div class='pic'><img src='$i'><div class='content'><br class='item'/>$i<br class='item'/>$y<br class='item'/>$m<br class='item'/>$d<br class='item'/>$l<br class='item'/>$c<br class='item'/>$misc</div></div>\n";
if (++$count % 4 == 0) {
echo "<br class='item'/>\n";
}
}
echo "<br/>


</div>
</div>

\n";
require('content.inc');
require('footer.inc');
?>




The static homepage:
http://sandbox.flint.cc/php_v7/
The Thing we are talking about:
http://sandbox.flint.cc/php_v7/default.php


This is what I have so far. I need to fix up the javascript part I just realized because the menu does not allow the user to get back to what the php will generate so I have to fix that. I am a bit crappy at mysql, and I know i have an error, in that query so if any1 could help me w/ that I'd be thrilled

lightnin
20 Jun 2006, 10:41pm
get rid of those parentheses around your selected columns, else you'll get an 'Operand should contain 1 column(s)' error.



ya know that's a really really odd error if you think about it.

"contain 1 column(s)...."

(s)...


as if you can pluralize ONE column. that's so odd.

IamMrRay
21 Jun 2006, 03:11pm
lol yea

IamMrRay
21 Jun 2006, 04:18pm
yea version six went up to the public domain last night

www.flint.cc

any suggestions?

lightnin
21 Jun 2006, 06:22pm
did you get your div 'table' working yet?

i'm curious to see how you implemented it, there's about a zillion ways it could be done.

IamMrRay
22 Jun 2006, 04:53am
oh wow im pissed. i wrote a book just now and the forum didnt keep me logged in and i just lost everything i typed
****.

IamMrRay
22 Jun 2006, 04:56am
i'll redo it tomorrow im really pissed off at that happening. I fricken basically made a tutorial and it got lost in the quick reply. that absolutely sux.

IamMrRay
24 Jun 2006, 04:13pm
alright. I figured I would just redo the whole damn thing being that I put so much time into it before with the previous version--always room for improvements right?

This model has absolutely nothing to do with the php, which I will have to rewrite a tiny bit w/ the html part to make this happen, no real difference though. This method will make it much more appealing.

This is the site w/o the php, because I do not feel like rewriting it right now. I tested it in mozilla so far and there isn't any problems w/ it, I worked out all of the bugs I have noticed so far. Also take note that I haven't gotten to putting the images in yet.


sandbox.flint.cc/v65 ~fixed the broken link (7/12/06) version 6.5

there is a javascript that takes care of the link emulation and browser detection that I made even though when I make the site go php based I will have the detection taken care of through that because it will be far more efficient. Based on what browser, the style sheets that contain things that vary between browsers are loaded along w/ the default stylesheet that works reguardlessly w/ everything I know of. no tables, all div's and span's w/ css. I believe it loads quicker but I could be wrong. I know its a whole lot easier to manage and modify.

the part of the main stylesheet we are focused on is the item_row (which keeps the item_box(es) (that have the float:left; attribute) from overflowing nto other parts of the page by implementing the clear:both command in it), item_box, item_pic, and item_content classes. by making boxes that are divided up like so we have a huge ammount of customization at our disposal in the stylesheet. For text boxes the same formatting applies, my naming method being: content_box, content_header (/ title varys between my sites that i work on), and content for the classes. I always put them in a master box that is usually has the class name content_window and for this site I also had them inside the content_box class div because it made it look nice. So I will post the part of the default.htm 's code that is important to this discussion, also because my code is a bit redundant at this point because I haven't had time to clean it up and group it together. Never the less:



.item_box{
display: block;
background-color: #033661;
text-align: left;
float:left;
margin: 2px 0px 2px 4px;
padding: 2px;
width:180px;
border-width: 2px 1px 2px 1px;
border-style: solid;
border-color: #000000 #050505 #000000 #050505;
}
.item_pic{
padding:1px;
margin:8px;
}
.item_content{
background-color:#044772;
display:block;
margin:1px;
padding:4px;
font-size: 12px;
clear:both;
font-weight: normal;
word-spacing: 5px;
letter-spacing: 1px;
color: #ffffff;
line-height: 28px;
text-align: center;
}
.item_row{
width:100%;
height:450px;
padding:0px 0px 0px -4px;
clear:both;
margin:0px;
border:0px;
}



This is the practice I like using mostly. Its pretty efficient.

:D

IamMrRay
24 Jun 2006, 04:28pm
what I do wanna learn how to do is either center a column (perfectly) with either css or javascript, because the < center > tag is depreciated for the new xhtml model and i wanna be able to put valid xhtml and css stuff on the site, and I am sure I have to fix a few things in my source, but if any I definitely wanna replace the center tag w/ code. I am using the strict DOCTYPE btw, so like the name says..

IamMrRay
24 Jun 2006, 07:52pm
alrighty. I fixed the IE6 bugs, I ended up moving basically all of the item classes to the seperate style sheets because the width was being rendered weird in IE6. For those of you whom have IE7 tell me if anything weird happens on it.

lightnin
24 Jun 2006, 08:14pm
i have a simple three column setup on a test site found here:

http://www.westga.edu/~bdefnall/allstar/test.html


the following is the center column:


.content {
position:relative; /* Position is declared "relative" to gain control of stacking order (z-index). */
width:auto;
min-width:120px;
margin:0px 210px 20px 170px;
border:1px solid black;
padding:10px;
z-index:3; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
}



if you view that page source you can see that you can stack 'content' boxes on top of each other and have a nice table-ish layout with no tables at all.

oh btw not all the links in the nav box work, only the main, 'about us', 'joe's notes', 'orlando' and 'news' really do anything. anyway, just an example if you want/need it.


nice job so far boss.

--edit i'm not sure of a sure-fire way to perfectly center using this css other than messing with margins and whatnot.....

IamMrRay
26 Jun 2006, 05:50pm
yea, I've been doing that and under certain resolutions I always get issues. I know that it could be done w/ javascript but I am a second hand programmer. After I go to college maybe I will be able to figure it out.

IamMrRay
26 Jun 2006, 05:55pm
I also revised what I think would be nesessary for the descriptions. The browsing page will have stuff like the name of the item and something else, w/ a n item number. The user clicks on the picture, goes to a more detailed page where it has a variable containing all of the information. So instead of having a million variables to keep track of, I will have something like $info and $moreInfo even though I will probably truncate the variables (and make a 'key' so i know what is what) so it will go a tad bit quicker.

IamMrRay
26 Jun 2006, 05:56pm
to do that centering thing I'm gonna have to learn about the DOM and I dont have time for that being that he just wants a static page up right now. It's going to take a while. Once I get that up I can finish the LAMP version and do all the cool little javascript things

IamMrRay
26 Jun 2006, 09:39pm
Update: I'm 'grouping' values in the style sheets right now. Its not online yet, but later on today I will be done w/ that. I also have a better organizational system in the works too...I think I might be able to make a semi-php driven version w/o using the non-existant database yet but I'm not sure if it is worth it. Suggestions?

IamMrRay
12 Jul 2006, 05:41pm
UPDATE.

http://sandbox.flint.cc/v66

this is the newer version. as always he wanted many changes so this has taken much longer than i have expected. even though this trend has been recurring forever now.

lightnin
12 Jul 2006, 08:47pm
lol next time lock him into a contract beforehand so you can charge him out the wazoo for future changes ;)