Page 1 of 1

Updateable Website Question.

Posted: Mon Apr 12, 2004 12:10 am
by paulrobere
Hello,

I am building a website for someone and they want to be able to update certain elements of the website (after I design the site) themselves. The site will be fairly basic and they just want to, on a monthly basis, upload several images into pre-defined image locations (which would ideally get re-sized on the fly) and some text into an otherwise static html site.

I've looked into software like Macromedia Contribute and CMS app's like PHP-Nuke etc, but I was wondering if there was an easy way to hand-code the dynamic part of this site or if anyone knew of an example of this that they could share with me. The web host I'll set them up with will have PHP/MySQL and I figured that it may something I could handle if I got some good advice.

Thanks,

Rob :D

Posted: Mon Apr 12, 2004 12:38 am
by Ixplodestuff8
It really depends on your current knowledge of php, and how much time you have, but chances are getting a CMS is a better idea.

What you want would need special forms for the person using the site, to access them, a user name and password would be needed. Just with that you need an authentication system, Forms for the user to change the site, and the site itself would need to have code to pull out stuff from the database.

Of course if the dynamic part was simple (like a single page, or part of a page) or inside set pages (the user wouldn't need to add new pages) maybe the job is alot simpler. You should give specific examples of what you want the user to update and on how many pages.

updateable website

Posted: Mon Apr 12, 2004 1:00 am
by paulrobere
The updates would be limited to part of a page. For instance, let's say there was only one dynamic page (in actuality there may be two or three) and the page was laid out as follows:

------------------------------------------------------------------------------
masthead - navigation html/graphic ((static))
------------------------------------------------------------------------------
image | text cell ((dynamic))
300x200 |
pixels |
((dynamic)) |
------------------------------------------------------------------------------
footer ((static))

...

Assume the ugly rendering above is a layout of a typical html or php page with three tables or cells. The whole site may be only 10 or 12 pages and this would be the dynamic one. The administrator would logon and be able to upload a digital pic from his computer (ideally in it's original format of a higher resolution etc) and it would automatically go into the image cell and be automatically resized to a specified height and width (e.g. no bigger than 300x200 pixels). This would be done about once a month, so whatever pic was there from the previous month would be overwritten. The same process for the text. Admin would logon and fill in a text box, and that would overwrite the text in the text column on that same page.

* So, the website, and even the dynamic page would be essentially static. The main difference being that an admin, w/o using FTP/Dreamweaver/Photoshop could easily update single images and text to pre-determined spots in the current page.

Thanks for your advice!

Rob

Posted: Mon Apr 12, 2004 1:15 am
by Ixplodestuff8
Somthing like that wouldn't be too hard, Make a table in the database with these fields: id, type, page, content. Type would indicate if it's an image or the text below it, page would tell it which page (since you said it would be two or three) and content would be the thing that gets displayed on the page.

the actual pages should look something like this:

Code: Select all

<?php
//this would be on the top of the page or something
$page_name = 'the name of the page';

//connects to mysql
$connection = @mysql_connect ( 'localhost', 'username', 'password' ) or die ( 'connection failed' );
mysql_select_db ( 'database', $connection );


//this would be the dynamic part, and inside the type would be the part like: image or text
$result = mysql_query ( "SELECT content FROM whatever_the_table_name_is WHERE type='' AND page='$page_name' LIMIT 1" );
$content = mysql_fetch_array ( $result );

//where the actual content goes, have this line
print $content['content'];
?>
Then make some forms that inserts/updates the content into the database.

updateable website

Posted: Mon Apr 12, 2004 1:23 am
by paulrobere
Thanks a lot...

That should help me out quite a bit. Appreciate the help.

,Rob