Looking for PHP help

Arden

Where mah "any" keys at?
I'm designing a website for Nexus, the local LAN arcade, and I'd like to integrate PHP into it. The problem is I don't know PHP. I'd like someone to help me with the things I want to do. I know I can always get a book or something and learn PHP, but that takes time and it takes a while to figure out how to do what I want to do. I just want to be able to ask, "Hey, how do I do this," and someone will say, "Put in XYZ."

So if you suggest a book or a website of how to learn PHP, thank you for the suggestion, and I'll look into it at some point, but that's not what I want to do right now.
 
I would be glad to offer my assistance. I am probably not the most knowledgable person when it comes to PHP, but I'll give it my best.

Just post what you need help with and I (and maybe others) will help you with the coding until you feel comfortable enough to continue on by yourself.

I am happy to help, but please don't abuse this. I like to get paid for my php code, so I don't want to be making an entire site pro bono while you get all the $.
 
I'm not getting paid for this site because the guy can't afford it. What I will be getting is free hours, so I don't have to pay to play for a while. Believe me, if you licensed me code, I'd pay you for it if I were getting paid as well.

I'm interested in using a picture I've split up with Imageready site-wide, integrating it into pretty much every page on the site (not a lot of pages, but it's still work to tweak each by hand and copy/paste, etc.). I'm looking at doing it one of two ways: I can either include the navigation (which this image is) into each page, or I can include each page in the navigation when I click a link. Hopefully you know what I'm talking about...

I'm not looking for really fancy stuff here, I just want a way to modularize the site in a more powerful, more efficient way than Javascript. I know how to reference an external script and use document.write(); to include content with Javascript, but I'd like to be able to integrate the necessary HTML into each page (at least from the end-user perspective), plus a couple other things. (Is there a way to make an image not create horizontal scrollbars if it's wider than the page without using the CSS position: fixed; tag?)

Again, thanks for your help. If you like, I'll credit you with helping on the programming aspect of the site.
 
When you say that you want to "use a picture site-wide" do you mean that you want to basically make a template for the site, or that you simply want each page to have this picture, but not necessarily in the same place?

Templates are really easy to do in php.
First you would create the template.php file. In this file you could create a function for making parts of the webpage.
PHP:
<?
function make_start_of_page()
{
?>
<!-- HTML HERE -->
<?
}
function make_end_of_page()
{
?>
<!-- HTML HERE -->
<?
}
?>
So one function would contain all the code for making all of the parts of the page before the main content (I typically use tables, so if you perfer a different form of layout, bear with me) cell, and a second function for making everything after that cell.

Then in each of your pages you woud do something like:
PHP:
<?
require("template.php");
make_start_of_page(); ?>
<!-- your content here --> <?
make_end_of_page();
?>
 
You could also make a header.php and a footer.php and either include() or require() them at top and bottom. a few less lines, but both ways work.
 
Thanks to both of you! That's actually exactly what I was looking for. I want to use an image I sliced up in Imageready as the navigation for each page. Can I put all my HTML in header.php or function make_start_of_page, including <html><head>...</head> too? And how would I alter the title on a page-specific basis, code-wise?

Also, is it possible to use PHP to disallow horizontal scrolling? The image I want to use is a minimum of 1200 pixels wide, which is obviously wider than most people's browsers, and I'd rather it didn't cause scrolling.
 
PHP won't actually control how the browser renders the html that you send it, so it cannot control the scrollbars. You will have to use CSS for that.

To change the header you could do this:
PHP:
<?
function make_start_of_page( $title = '' )
{ ...  ?>
<title><?=$title?></title> ... }
?>
and then when you call the function, do something like this:
PHP:
<?
$title = "Your Title Here";
make_start_of_page( $title );
... ?>

You don't actually have to initialize the variable that the function is accepting (the $title = '' ), if you are always going to call the function and pass it a variable. I typically will always initialize the variable even if the function will only be called with a passed variable.
 
K, thanks. I think I'll make the div that contains the really wide slice empty, and use the image as the background for the div.

Keep an eye on this thread, as I think I'm going to post the site here. I'll make 2 versions, one Jared, the owner of Nexus, likes, and the other a redesign that I (and others) like. Then you guys can tell me what you think as well.
 
Okay, I wrote that code down (on a napkin :)) and I'll go put it on my iMac now. Then I'll bring it back here and upload it somewhere so you all can see it. :)
 
Okay, another question: I have 2 designs of the above site, the index page and the header.html page, and I'd like them both to be selectable when someone enters the site. I'd have a thumbnail of each, and the user can click on the thumbnail he/she wants to see and it will use the template for that particular design for all the pages. Do you know a way I can swap template files based on a user's preference?
 
make the thumbnail links pass a value to your main PHP file. for instance, if you have two styles, say "default" and "header" and you want to pick one to render main.php, you'd make one thumbnail link like "main.php?style=default" and the other like "main.php?style=header". then in main.php, you can check $_GET['style'], if it equals default, include('default.php'), if it equals header, include('header.php').

if you want to get into user preferences, i'd have a look at the session functions in the PHP manual. hope this helps.
 
Back
Top