• Help
  • Search
  • Login
  • Register
  • Home

Forum: web design and graphics community

  Show Posts
Pages: [1] 2 3 ... 61
1  Art Boards / Celestial Star Tutorials / Re: Table layout (Div style) on: December 02, 2007, 12:03:50 PM
Tables won't help you here. You're going to need to use PHP Includes or iframe. Personally, I recommend PHP includes, but if your host doesn't support PHP, then you might have to revert to frames.

PHP Includes
2  Web Development / Coding / Re: What is PHP and how... on: November 23, 2007, 05:18:03 PM
I already told you a bunch of things that PHP can do that HTML can't. HTML can't make forums, can it? PHP can do that. HTML can't allow people to log into secure websites. PHP can. Those are only two our of thousands of things that PHP can do that HTML can't. HTML is used to DISPLAY things, and ONLY to display things. PHP is so much more than that.

PHP inclusion is one of the things that PHP can do, yes. Inclusion is including a PHP page in another page, and when you update the included page, it automatically updates in the page or pages that that page is included in. There is a tutorial on that in this very board: PHP Includes
3  Art Boards / Creative mediums / Re: Rin's Corner =D on: November 23, 2007, 05:11:56 PM
I edited your link so it worked properly.

I like your avatars. ^^ And the vector is cool! I kinda like it only halfway colored...
4  Web Development / Coding / Re: What is PHP and how... on: November 22, 2007, 06:22:47 PM
That is a question that would take at least two fairly large books to answer, if not more. There is no shortcut to learning PHP. The only way to do it is start out small and think big. If you search on Google or any search engine out there for PHP Tutorials, you are bound to come up with loads of good resources with which to start learning the language. It will take a lot of practice and learning to become proficient with it, but you have to start somewhere.

I can't teach you how to program in PHP, however. Like I said, that would take at least two good sized books and many years to do. My suggestion is to search for tutorials and work on learning the language as much as you can.

If you have a specific question on how to do one specific thing, though, I can help you with that. I'm all for helping you learn how to do something or other, I just can't teach you everything there is to know about PHP.
5  Web Development / Coding / Re: What is PHP and how... on: November 22, 2007, 03:27:02 PM
PHP is a scripting language. It has NO relation to HTML whatsoever other than the fact that it can display HTML. HTML is for displaying content. PHP is a dynamic language that allows you to manipulate how and when you display things, and if you display them. PHP is a programming language, while HTML is just a markup language.

There are millions of things that you can do with PHP. This forum? It's run with PHP and MySQL. You can make forums, community sites, websites, ANYTHING. CuteNews? That is PHP. Pure PHP. Almost anything else you've seen on the internet was created by PHP or some other server-side scripting language.
6  Web Development / Web Design / Re: Is this a blog or site! on: November 22, 2007, 09:51:00 AM
To use CuteNews, your site needs to be able to use PHP and you have to be able to access your site through FTP in order to upload the files. As far as I know, you use freewebs, right? Freewebs doesn't let you do either of these thing, unless I'm mistaken. Freewebs does not support PHP nor does it allow you to access your files through FTP.

If you use Freewebs, I would recommend trying to find a different way to host your site. There are several sites around that will host your site for free. If you don't use Freewebs, what do you use? I might be able to help you set up your FTP and get CuteNews running.
7  General / Support / Suggestions / Re: Tutorial requests here on: November 19, 2007, 07:33:51 PM
Different styles as in coding styles? Or graphic styles?
8  General / Support / Suggestions / Re: Table Tutorial Gone Wrong!! on: November 19, 2007, 07:32:57 PM
Alright, just give me the URL once you've done so. ^^
9  Web Development / Coding / Re: Admin Panel For Avatar Database on: November 18, 2007, 10:08:33 PM
It never asks you to log in?
10  Web Development / Coding / Re: Texture Coding Need Help on: November 18, 2007, 07:51:20 PM
Can you link me directly to the tutorial that you used?
11  Web Development / Coding / Re: Search Engine: Expand Search Option on: November 18, 2007, 07:15:24 PM
I'm not entirely sure I understand what you are trying to do. >.<
12  Web Development / Web Design / Re: Is this a blog or site! on: November 18, 2007, 04:08:18 PM
Well... I'm not quite sure what you mean by a site like FEEL. Do you mean looks-wise? Or where it is hosted? Or how it is run?
13  Web Development / Coding / Re: Search Engine: Expand Search Option on: November 18, 2007, 04:06:00 PM
'Tis a rather simple process. ^^ That last bit of code is the code that prints out the avatars that are found. You can see it here:

Code:
while ($row = mysql_fetch_array($rsSearch))
{
extract($row);

print '<table border="0" align="center" valign="top" cellpadding="7" cellspacing="2">
<tr><td><table bgcolor="#ADC6BC" style="border: 1px solid #000;">
<tr><td height="100">
<img src="'.$avatar_url.'" border="0" title="Avatar" alt="Avatar"></td>
<td height="100" width="100" style="border-left: 1px dotted #000; padding-left: 4px;">
<b>Series:</b>
<br><div class="indent">'.$series_name.'</div>
<b>Size:</b>
<br><div class="indent">'.$size.'</div>
<b>Added:</b>
<br><div class="indent">'.$date.'</div>
</td></table></table>';

}

This is the only thing we will need to change in order to make the avatars appear in two columns, instead of just one.

If you have experience with PHP, please bear with me, because I'm just going to guide you through this as if you didn't know any PHP, because I don't know if you do or not. O.o So just skip over anything you already know and look at the logic instead of the syntax.

Otherwise, here goes.

We first need to add a variable that will allow us to tell if we need to start a new row or not. The two easiest things to do when displaying avatars in a table is to put them all in the same column, or put them all in the same row, because we can easily repeat that. But you want to put them in different columns and different rows, so we need a variable that will act as a counter to let us know when to start a new row and when to keep on going in the current row.

As a side note, I'm also going to add in a variable that will tell the script how many avatars to put in one row, that way you only have to change that single number if you want to put, say, three avatars in a row in the future.

To do all this, all we have to do is add two lines, right about the code I posted above. It will now look like this:

Code:
$numPerRow = 2;
$currentCount = 0;

while ($row = mysql_fetch_array($rsSearch))
{
extract($row);

print '<table border="0" align="center" valign="top" cellpadding="7" cellspacing="2">
<tr><td><table bgcolor="#ADC6BC" style="border: 1px solid #000;">
<tr><td height="100">
<img src="'.$avatar_url.'" border="0" title="Avatar" alt="Avatar"></td>
<td height="100" width="100" style="border-left: 1px dotted #000; padding-left: 4px;">
<b>Series:</b>
<br><div class="indent">'.$series_name.'</div>
<b>Size:</b>
<br><div class="indent">'.$size.'</div>
<b>Added:</b>
<br><div class="indent">'.$date.'</div>
</td></table></table>';

}

If you've worked with PHP, you'll know that those two lines created two new variables, titled numPerRow and currentCount, and set them equal to 2 and 0 respectively. If you haven't worked with PHP, well... now you know what they do. The dollar sign ($) always indicates a variable.

Next, we're going to examine the HTML that this PHP code is outputting. If you look at that code, you'll see something saying "print." This is a function or method that will print stuff out, HTML included. We need to split that up. Some of that HTML needs to be printed before the while loop and some of it needs to be printed after. If you examine the HTML, you'll see it is nesting tables. We want the first table to start and end outside of the while loop, so that's where we are going to move it.

Code:
$numPerRow = 2;
$currentCount = 0;

print '<table border="0" align="center" valign="top" cellpadding="7" cellspacing="2">';

while ($row = mysql_fetch_array($rsSearch))
{
extract($row);

print '<td>

<table bgcolor="#ADC6BC" style="border: 1px solid #000;"><tr>

<td height="100"><img src="'.$avatar_url.'" border="0" title="Avatar" alt="Avatar"></td>

<td height="100" width="100" style="border-left: 1px dotted #000; padding-left: 4px;">
<b>Series:</b>
<br><div class="indent">'.$series_name.'</div>
<b>Size:</b>
<br><div class="indent">'.$size.'</div>
<b>Added:</b>
<br><div class="indent">'.$date.'</div>
</td>

</tr></table>

</td>';

}

print '</table>';

Because I'm prissy, I also straightened up the code a little bit, to make it valid and a bit more readable.

But essentially, you can see what I did. The first table now starts outside of the while loop and ends outside it as well. I left the <td> tags of the first table inside, because they will be essential to having two avatars in one row. You might also notice that the <tr> tags of the first table have disappeared. They are also essential to putting more than one avatar in a single row; they will be added back, but they have to be put in differently.

This is where the $numPerRow and $currentCount variables come in. The first thing we need to do inside the while loop is figure out which column we are on and whether or not the next avatar should go in this row or whether we should make a new row. This employs an if statement. If you've ever programmed before, you should know what these are. If you haven't, then it should suffice to say that if statements allow you to make decisions in the middle of a script based on information calculated dynamically.

So we are going to add in an if statement saying something like this: if currentCount is greater than or equal to numPerRow (meaning if we currently have the same number of avatars in this row as the total that we want in one row), end the current row, make a new row, and set currentCount to zero, because we don't have any avatars in this row yet.

How we do this in the script is as follows:

Code:
$numPerRow = 2;
$currentCount = 0;

print '<table border="0" align="center" valign="top" cellpadding="7" cellspacing="2">';

while ($row = mysql_fetch_array($rsSearch))
{
extract($row);

if($currentCount >= $numPerRow) {
print '</tr><tr>';
$currentCount = 0;
}

print '<td>

<table bgcolor="#ADC6BC" style="border: 1px solid #000;"><tr>

<td height="100"><img src="'.$avatar_url.'" border="0" title="Avatar" alt="Avatar"></td>

<td height="100" width="100" style="border-left: 1px dotted #000; padding-left: 4px;">
<b>Series:</b>
<br><div class="indent">'.$series_name.'</div>
<b>Size:</b>
<br><div class="indent">'.$size.'</div>
<b>Added:</b>
<br><div class="indent">'.$date.'</div>
</td>

</tr></table>

</td>';

}

print '</table>';

The only other thing we need to do in here is to up the currentCount at the end of the while statement, that way we know we have another avatar in the row. It's a simple statement that needs to be added right before the ending curly brace (}) of the while statement.

Code:
$numPerRow = 2;
$currentCount = 0;

print '<table border="0" align="center" valign="top" cellpadding="7" cellspacing="2">';

while ($row = mysql_fetch_array($rsSearch))
{
extract($row);

if($currentCount >= $numPerRow) {
print '</tr><tr>';
$currentCount = 0;
}

print '<td>

<table bgcolor="#ADC6BC" style="border: 1px solid #000;"><tr>

<td height="100"><img src="'.$avatar_url.'" border="0" title="Avatar" alt="Avatar"></td>

<td height="100" width="100" style="border-left: 1px dotted #000; padding-left: 4px;">
<b>Series:</b>
<br><div class="indent">'.$series_name.'</div>
<b>Size:</b>
<br><div class="indent">'.$size.'</div>
<b>Added:</b>
<br><div class="indent">'.$date.'</div>
</td>

</tr></table>

</td>';

$currentCount++;

}

print '</table>';

"++" is an operator that adds one to currentCount. =)

And that's it! Your final code, if you want to skip over everything that I have said (which is perfectly fine for me. You didn't ask for a lesson, you just asked how you could do it) should look like this:

Code:
<center><form action="#results" method="post">
Size: <input type="text" name="size" size="30" maxlength="30"></p>

<p>Series: <select name="series">
<?php
mysql_connect
("localhost","username","password");
mysql_select_db("databasename");

// List out the series in the database
$qSeries = "select series_id, series_name from avseries order by series_name ";
$rsSeries = mysql_query($qSeries) or die ('Cannot execute query');

while (
$row = mysql_fetch_array($rsSeries))
{
extract($row);
echo 
'<option value="'.$series_id.'">'.$series_name.'></option>';

}
?>

</select>
</p>
<p><input type="submit" value="Search"></p>
</form></center>

<hr>

<p>Here are the <a name="results">results</A> of your search:


<p><?php
mysql_connect
("localhost","username","password");
mysql_select_db("databasename");

// For global registers off
// ====================
$size = strtolower(strip_tags(mysql_escape_string($_POST['size'])));
$series = strip_tags(mysql_escape_string($_POST['series']));
$order = strip_tags(mysql_escape_string($_POST['order']));

// validate for empty size field
// Remove this if you wish to allow all size listing
if (empty($size))
{
die (
'Please fill in an avatar size.');
}

// Build search query
$qSearch = "select a.*, b.series_name from avatars a, avseries b where a.size LIKE '%$size%' and a.series_id='$series' and a.series_id=b.series_id order by a.date $order ";
$rsSearch = mysql_query($qSearch);

if (
mysql_num_rows($rsSearch) == 0)
{
print 
'<p>Sorry, there was no results returned for your search. Please try again.</p>';
}
else
{
print 
'<p><strong>'.mysql_num_rows($rsSearch).'</strong> avatar(s) found.</p>';

$numPerRow = 2;
$currentCount = 0;

print 
'<table border="0" align="center" valign="top" cellpadding="7" cellspacing="2">';

while (
$row = mysql_fetch_array($rsSearch))
{
extract($row);

if(
$currentCount >= $numPerRow) {
print 
'</tr><tr>';
$currentCount = 0;
}

print 
'<td>

<table bgcolor="#ADC6BC" style="border: 1px solid #000;"><tr>

<td height="100"><img src="'
.$avatar_url.'" border="0" title="Avatar" alt="Avatar"></td>

<td height="100" width="100" style="border-left: 1px dotted #000; padding-left: 4px;">
<b>Series:</b>
<br><div class="indent">'
.$series_name.'</div>
<b>Size:</b>
<br><div class="indent">'
.$size.'</div>
<b>Added:</b>
<br><div class="indent">'
.$date.'</div>
</td>

</tr></table>

</td>'
;

$currentCount++;

}

print 
'</table>';
}
?>


I said this was a simple process, didn't I? Eh... sorry about the long-winded explanation. It is a simple process, I just have a habit of explaining everything in detail.

Oh, and... I did that right out of my head, without testing it, so if something screws up, please let me know and I'll try and fix it right away.
14  Web Development / Coding / Re: Admin Panel For Avatar Database on: November 18, 2007, 03:38:33 PM
Okay.... what you are saying is right now anyone can access panel.php and upload avatars? As far as I can tell, there is a bit of coding attempting to prevent that. If someone isn't logged in, it will throw an error and present a login screen instead of allowing the user to log in.

And you are also saying that when you try to log it, it tells you that the username and/or password is wrong? Did you set the username and password in config.php?

I don't really trust this script. It doesn't seem to be entirely secure. As far as I can tell, someone would simply have to open up config.php and find the admin name and password. It doesn't look like the password is even encrypted.

Unfortunately, I can't point you to something that is more secure, because I don't know of one. I can't even point you towards a tutorial that would help you make a secure one. So unless you know PHP and MySQL enough in order to make your own, sticking with this one might be your only choice.

And if that is the case, then I can try to get this thing to log in for you. Did you have any instructions from this, in order to get it working? What were you told to do in order to set this up?
15  General / Support / Suggestions / Re: Table Tutorial Gone Wrong!! on: November 18, 2007, 03:32:10 PM
Well, first of all, you don't need any quotes in CSS whatsoever, in background or in anything else (you have double-quotes in one of your positionings. Otherwise, there is nothing wrong with the syntax. I can't tell if your image names are right or not, because I don't know what they actually are. Do you have this uploaded to the Internet somewhere? It might be easier for me to help you out that way.
Pages: [1] 2 3 ... 61
  • Welcome, Guest
  • Members login
  • Register for free

General

  • General
  • New members
  • Announcements
  • Support / Suggestions

Art boards

  • Creative mediums
  • Requests and offers
  • Tutorials
  • Celestial Star tutorials

Web development

  • Coding
  • Web design
  • Advertisements / affiliation

Off-topic

  • The non-sense
  • Ententainment

Go up
eXTReMe Tracker
  • Valid XHTML
  • Valid CSS
Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC | Seo4Smf v0.2 © Webmaster's Talks
Loading...