Extrawater Forums

Discussion of other water gun websites.
User avatar
CROC
Posts: 302
Joined: Fri Mar 31, 2006 10:03 pm

Re: Extrawater Forums

Post by CROC » Fri Apr 11, 2008 1:13 am

Thanks Silence!

I meant: have the xml display its contents using javascript or whatever to say what is in the xml document. I could steal scripts, since I have absolutely no knowledge of Javascript. Then I wouldn't learn anything.
-Croc
It's been a while guys, and its good to be back

User avatar
SSCBen
Posts: 6449
Joined: Sat Mar 22, 2003 1:00 pm

Re: Extrawater Forums

Post by SSCBen » Fri Apr 11, 2008 1:58 am

Could you explain what you're trying to do? Then we might be able to offer some other solutions. I don't imagine that it would be impossible or even hard to make Javascript display the contents of a file, but I wouldn't recommend it because a lot of things and people disable Javascript.

If you're trying to use XML documents as some sort of database, don't. Just use MySQL or PostgreSQL. I know a good amount about MySQL and can set you up if you want. You'll have to learn PHP too, but neither is hard.

User avatar
Silence
Posts: 3825
Joined: Sun Apr 09, 2006 9:01 pm

Re: Extrawater Forums

Post by Silence » Fri Apr 11, 2008 2:00 am

Hmm...so you want to view the source XML of a page? To do that, in Firefox you use [View > Page Source] or [Right Click > View Page Source]. Or perhaps I'm not sure what you're looking for...maybe Ben would know. Sorry.

User avatar
CROC
Posts: 302
Joined: Fri Mar 31, 2006 10:03 pm

Re: Extrawater Forums

Post by CROC » Fri Apr 11, 2008 12:43 pm

Ok, I decided not to do any xml scripting after all. I might go with some SQL, and will try to learn that and PHP at about the same time

(what I meant was like here:(main section)
-Croc
It's been a while guys, and its good to be back

User avatar
Spinner
Posts: 1337
Joined: Tue Feb 10, 2004 12:00 pm

Re: Extrawater Forums

Post by Spinner » Fri Apr 11, 2008 1:48 pm

You can use XSL to style XML documents if you need to, but I think using XML would be overkill for your purposes. As has been suggested, a SQL database used in conjunction with PHP would probably work better for you.

Also take a look at Notepad++. It helps you to write correct HTML (among many languages) by colouring tags - take a look. :cool:
ISS: Soaker Sagas

Submit your saga and see it up with other titans of water warfare.

User avatar
CROC
Posts: 302
Joined: Fri Mar 31, 2006 10:03 pm

Re: Extrawater Forums

Post by CROC » Fri Apr 11, 2008 8:19 pm

I believe DreamWeaver colours tags, but think that SQL/PHP is easiest. Would I be right in assuming that?
-Croc
It's been a while guys, and its good to be back

User avatar
SSCBen
Posts: 6449
Joined: Sat Mar 22, 2003 1:00 pm

Re: Extrawater Forums

Post by SSCBen » Sat Apr 12, 2008 1:40 am

Yeah, I'm looking at the code in that and I can not recommend it. Google will not be able to spider that website unless you submit a sitemap to them or have some other method. People with Javascript turned off won't see anything. There also are potential performance problems with that approach (it's best to put the burden on a fast server than a potentially slow client).

I've learned PHP and SQL gradually over the years and I recommend you go that way. Both in combination certainly will be easier than programming Javascript to read an XML file. ;)

User avatar
CROC
Posts: 302
Joined: Fri Mar 31, 2006 10:03 pm

Re: Extrawater Forums

Post by CROC » Sat Apr 12, 2008 4:16 pm

I am taking a computer programming course next year, so when I learn some programming styles or whatever, I could probably update the whole site to PHP later on, when I have an understanding of programming.

How do you display PHP documents? I made a test, but how do you display the document?
-Croc
It's been a while guys, and its good to be back

User avatar
Silence
Posts: 3825
Joined: Sun Apr 09, 2006 9:01 pm

Re: Extrawater Forums

Post by Silence » Sat Apr 12, 2008 4:47 pm

Just open the PHP file in a web browser.

CS is funny - there's a divide (PDF) between people who get it and people who don't. If your school has a shopping period, you could stay in the class for two weeks before deciding whether or not to continue. If you like it, congratulations! :)

CS was neat for me and I'm glad I took it. And it definitely does make things like XML and PHP much easier to comprehend.

User avatar
CROC
Posts: 302
Joined: Fri Mar 31, 2006 10:03 pm

Re: Extrawater Forums

Post by CROC » Sat Apr 12, 2008 5:49 pm

I see... It just wasn't working when I previewed it in Dreamweaver. I guess it is all server side?
-Croc
It's been a while guys, and its good to be back

User avatar
SSCBen
Posts: 6449
Joined: Sat Mar 22, 2003 1:00 pm

Re: Extrawater Forums

Post by SSCBen » Sat Apr 12, 2008 5:55 pm

Yes, PHP is a server side script. If you don't want to upload the script, you can run Apache and PHP on your computer and preview it in your browser, but if you have good hosting that can be more hassle to set up. ;)

Dreamweaver probably wouldn't be a good way to edit the code too because of all the overhead. I'd suggest something lighter like Notepad++ if you just want to edit PHP code.

User avatar
CROC
Posts: 302
Joined: Fri Mar 31, 2006 10:03 pm

Re: Extrawater Forums

Post by CROC » Sat Apr 12, 2008 6:23 pm

The <?php ?> tags are wierd...
However, I am kind of beginning to get it now. I just need to learn more basic information about PHP, like how to make a table or other things
-Croc
It's been a while guys, and its good to be back

User avatar
SSCBen
Posts: 6449
Joined: Sat Mar 22, 2003 1:00 pm

Re: Extrawater Forums

Post by SSCBen » Sat Apr 12, 2008 6:35 pm

You don't make tables with PHP. You use PHP to program stuff. All PHP does is write HTML code, so you don't need to learn a new way to do HTML. You need to learn how to use PHP.

Below is a basic header-footer script like what we used in SSC versions 1 to 3.

Code: Select all

<?

$title = 'Page title';
$location = '../';
include $location.'header.php';

?>
<p>This is an example page.  You can put whatever HTML you want here.</p>
<?

include $location.'footer.php';

?>
header.php and footer.php are the headers and footers of the page. You can use this to save writing a lot of code and make changes to the website site-wide a lot easier. The $location variable tells where the page is relative to the header and footer files. If the page is a directory up (i.e. in http://www.domain.com/here/page.php where the header and footers are in [url]http://www.domain.com)[/url], then you have to have something like that.

In the most basic page, header.php could be this:

Code: Select all

<html><head><title><? echo $title ?></title></head><body>
footer.php could be this:

Code: Select all

</body></html>
That's the most detailed PHP code we went into here for a while. Now we're running off a database, which makes things a lot simpler and allows for rapid changes to be made by many people.

User avatar
Silence
Posts: 3825
Joined: Sun Apr 09, 2006 9:01 pm

Re: Extrawater Forums

Post by Silence » Sat Apr 12, 2008 6:39 pm

If you're interested in database tables, you'll want to find a good MySQL tutorial. But honestly, if you don't feel that PHP is too urgent you could wait until you've taken CS.

Other than that, I would suggest following a PHP and MySQL tutorial (as in, seeing how you'd build a sample website).

EDIT: I just saw Ben's post. I would suggest following his method to include universal headers, footers, and CSS. That'll make each bit of HTML a lot simpler.

A database really just makes it easier to store hundreds of articles. You could also have individual database tables for reviews, galleries, etc., which once again reduces the amount of information that you need to enter for each. In each table, the column is some type of data field: say, the name of the article, the name of the author, the date, and the text. Each row is an article.

Then you could have a couple types of php usages. With the SSC backend, a php file accesses each database entry (each row) and combines them with the current CSS, header, and footer to create actual HTML. It's rather efficient because the server just needs to return the HTML document when the user asks for it.

Many systems, like forums, are more dynamic. Your browser asks for a php file each time, because things like the current post count of each user (displayed multiple times, too) could have changed each time you view the page. Thus the server has to carry out all the tasks in the php each time and return a new HTML document each time, but the file is updated more often.

For a static website (with no forums, etc.), you can probably use the former method. And unless you're working with hundreds of articles, a database probably isn't necessary either. Copy and pasting templates is how most websites started, and as Ben said, that's how SSC was run. And when the time comes for advanced php apps, you'll have plenty of experience. :)

EDIT again: Just to clarify, in Ben's second code snippet, $title should have been defined previously. I suppose it's an easy way to create a template. For example, your reviews template could be:

Code: Select all

<?
$title = " "
$author = " "
$date = " "
$text = " "
?>



<h1><? echo $title ?></h1>
<h3>By <? echo $author ?></h3>
<h3>First written on <? echo $date ?></h3>
<? echo $text ?>
(And your $text could have HTML markup in it.)

With that template, you never need to touch the bottom part, which comes in very handy if you have fancy layouts or ten fields or something. All you do is edit the top. A database allows you to store each of those fields elsewhere and have a single PHP file that accesses the database.
Last edited by Silence on Sat Apr 12, 2008 6:53 pm, edited 1 time in total.

User avatar
CROC
Posts: 302
Joined: Fri Mar 31, 2006 10:03 pm

Re: Extrawater Forums

Post by CROC » Sat Apr 12, 2008 9:04 pm

Alright, that makes a bit of sense now. I might as well get started on this new coding now.

Off-topic:
Ben, is it ok if I move the extrawater forum from its current location to forums.supersoaker.org?
-Croc
It's been a while guys, and its good to be back

Locked