new to PHP, which way to code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lazi_me
Forum Newbie
Posts: 3
Joined: Mon Apr 28, 2003 8:57 pm

new to PHP, which way to code?

Post by lazi_me »

I'm looking for the best way to code a photo album website using PHP. There are many free sourceforge projects using PHP. Howerver, they are not very clean.

I would like to be able to change themes, skin, etc. There are patTemplate, class/struct structure, and others structure/template that I do not know of, etc. Which way is better and you would recommend to use?

Thanks
-Hy
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

Post by fractalvibes »

Extensive use of CSS? Perhaps you need several different stylesheets and associate with a particular photo or album? Unsure of what you are asking, exactly.

PhilJ.
lazi_me
Forum Newbie
Posts: 3
Joined: Mon Apr 28, 2003 8:57 pm

php Tools

Post by lazi_me »

Not much CSS, the idea is just having three framesets. Toolbar frame, consists of several buttons such as next, prev, index links. TOC frame, consists of thumbnails. Content frame, consists of album view or image view.

I saw people code everything (HTML code and PHP code) in one file. Now, that's pretty hard to change and customize. I'm looking for a way to separate HTML presentation and PHP logic code so that it is easier to maintain and customize.

-Hy
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

This is very easy to do - no template classes required.

Create a bunch of html templates for whole pages and bits of pages as necessary. Echo out php vars in the templates. Include the templates where you need them.

Now you can edit html templates (and a CSS file attached to the templates) to change the look of your site without touching the code. An html editor like dreamWeaver which stores libraries of common elements makes that easier still.

Well almost: I find there are often one or two places where it makes sense to apply some html in the script (eg the alternating bgcolors for posts on this page). If you can define constants or vars for these items and stick them in a configuration section at the top of a php file, it makes it easy to edit later.

Personally I'd ditch the frames - nothing but trouble imho.
lazi_me
Forum Newbie
Posts: 3
Joined: Mon Apr 28, 2003 8:57 pm

smarty template engine

Post by lazi_me »

google for "php template", i found smarty template engine. Might be that answers my question.

Thanks
-Hy
Post Reply