Hey everyone! im back! :D..and I need help :P
IamMrRay
Otis, MA
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
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
0
Comments
?>
<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>
<?
[/PHP]
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.
<?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');
?>
[/PHP]
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
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.
www.flint.cc
any suggestions?
i'm curious to see how you implemented it, there's about a zillion ways it could be done.
****.
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:
This is the practice I like using mostly. Its pretty efficient.
http://www.westga.edu/~bdefnall/allstar/test.html
the following is the center column:
[PHP]
.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. */
}
[/PHP]
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.....
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.