Jump to content

Help me with this project...


drak24

Recommended Posts

Hi, I want to create a subscription site. I understand that I have to use PHP and MySQL to do this. I have a layout I created in photoshop but don't know how to impletment the PHP aspects into it/turn it in to a PHP site. I know HTML, but I've just started looking at PHP today.

 

This is a layout I created for the site:

http://img178.imageshack.us/img178/2677/examplebw0.jpg

 

The things I need the site to be able to do:

-Have a Login/Member system

 

-I used to have a PHP site before so I know that you can make articles and make them show up in the content space, which is what I want to do along with beng able to have a section for "movie of the week" Every week I would like to be able to put up a box shot of the MotW on the right hand side under the title.

 

-Underneath the MotW, I would like to have website statistics showing.

 

-I would like the layout I made to be constant for each page, Is this possible through CSS (I don't much about it yet)? Or do I have to make every page with the layout and edit it as I see fit?

 

-I have some tutorials so I think I could possibly get the sign up form done on my own eventually, but how would you get the form page, after submission, to take the user directly to paypal with the order info already set up?

Link to comment
Share on other sites

I develop all my sites this way. Designate a particular cell/area as the area where content will load.... you have done that in your layout....

 

Next create a function out of the lower part of the code.... see below.

 

 

header.php

<HTML>
<HEAD>
<TITLE>examplebw0</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (examplebw0.jpg) -->
<TABLE WIDTH=800 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
	<TD COLSPAN=3>
		<IMG SRC="images/examplebw0_01.gif" WIDTH=800 HEIGHT=206 ALT=""></TD>
</TR>
<TR>
	<TD>
		<IMG SRC="images/examplebw0_02.gif" WIDTH=206 HEIGHT=794 ALT=""></TD>
	<TD width="388" height="794" valign="top" background="images/examplebw0_03.gif"><p> </p>
    <p>All Content will load here</p>

    <?php function footer(){  /* here is where we create the footer function */ ?>

        </TD>
<TD>
		<IMG SRC="images/examplebw0_04.gif" WIDTH=206 HEIGHT=794 ALT=""></TD>
</TR>
</TABLE>
<!-- End ImageReady Slices -->
</BODY>
</HTML>
<?php } /* We end the function here */ ?>

 

Now that you have broken up this page into 2 pieces, here is how ya use them....

 

I call all my "layout" pages header.php. You include this at the top and then call the footer() function at the bottom. e.g.

 

 

index.php

<?php include($_SERVER['DOCUMENT_ROOT'].'/header.php') ?>

some text blah blah blah......

<?php footer() ?>

 

I always use the $_SERVER['DOCUMENT_ROOT'] piece so I can use this same line on all pages and it will get included no matter where the header.php file lives in relation to the file I am calling it from.

 

I grabbed your screenshot and sliced it up in photoshop. I have included the resulting images. I would not use this as is because the whole site is made up of images. But hopefully you get the idea. Save the images in a file called images and place the images folder in the same directory as the header.php file (copy and paste the code above and save it as header.php) and you should be good to go.

 

Once I learned this trick, I never looked back. This is the simplest way to create 1 layout page and all the content pages are text/images/css. Building a site this way allows you to change the whole design of the site just by changing the 1 header.php file.

 

Hope this helps,

 

Nate

 

[attachment deleted by admin]

Link to comment
Share on other sites

@Chronister: Thanks for breaking that down for me. Just so I can get a better understanding, how would the other pages know where to place the content text? Is it like setting a CSS Rule for the table? For example like, setting up a rule called "content" and then assigning the "content" attribute to the text on the other pages that I make?

 

Also, in the past, I used to have a php site but I didn't have to do much because it was pretty much pre-built. But I remember that it was set up so that I (the Administrator), could easily just type up new content/articles/etc... in a form, and I had the ability to make it show on the front page. How does that work? I believe I was using PHPNuke, but since this is kinda like building a site from the ground up, I have no clue how I'd get that set up. That wasn't a CMS was it?

Link to comment
Share on other sites

@Chronister: Thanks for breaking that down for me. Just so I can get a better understanding, how would the other pages know where to place the content text? Is it like setting a CSS Rule for the table? For example like, setting up a rule called "content" and then assigning the "content" attribute to the text on the other pages that I make?

 

The other pages don't know anything... The header.php page does all the work. By taking the lower half of the code and making it a function like that you essentially wrap the content pages in the header page. It just depends on where you define the footer function. When you include the header.php page, it throws the entire page minus what is defined as a function at the top of the page, then when you call the function at the bottom, it grabs that code and throws it in there wrapping the content in the header page. The analogy using CSS is sorta similar, but not really. Rather than giving parts of the pages a class or id as in CSS, we are simply using 1 page to create the wrapper....

 

this method is good and all, but there are some things to be aware of. Output is always started once the include code is loaded, so any header() calls, or $_SESSION[] calls will result in an error. I always place an ob_start(); at the top of header and ob_end_flush(); as the last item in the footer.

 

To set page titles, I had to get a little creative. In the header.php page, set the title as

<?=$page_title ?>

, then in the content pages BEFORE you include the header.php file, set the $page_title var to what you want that page to be titled as. e.g.

<?php $page_title='My Page'; include($_SERVER['DOCUMENT_ROOT'].'/header.php'); ?>

 

As for the CMS part, yes that is a CMS. CMS stands for Content Management System, so anytime you make changes to the content of a page using a management system (generally a form), you are using a CMS. The hows of this are way beyond the scope of what I can get into here, but you will need to learn to use MySql, or a similar DB. You have to store the text in the DB and call it when you want it displayed. I read a book called "How To Do Everything With PHP & MySql" by Vikram Vaswami. In this book it shows exactly how to do the CMS news system type thing.

 

Nate

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.