Page 1 of 1

Could you point me in the right direction on a class layout?

Posted: Sat Nov 18, 2006 11:56 am
by alphanimal
Hello!

I want to learn how to build web apps that are highly scaleable and reuseable.
I started to read that acricle PHP and design patterns on Zend. I do basically unerstand that examples.

Now I'm lokking for some extended examples like that one:

Lets say I want to create a site that should support templates with Smarty Template Engine. It sould also have Multi-Language support and both - temapltes and translations - should be in a MySQL Database.

So we got three main functionalities: Template, Localization, Database

So how sould these be designed? How should they interact? Which classes do I need and how is their inheritance and other relations? How will a "Hello World"-Page source look like? Which include files should there be and where should they be included?

So thats the first questions I have :)

Now, the framework is up with those features.
Then, lets say, I decide that I do not want to use Smarty anymore, because the designers I have hired have problems implementing their templates, and I want to use a more basic, maybe self made template engine?
What do I have to concern in coding that the plugging-in of that new template engine is as easy as possible?
What if I decide to switch from MySQL to an Oracle DB?

Now, what if I want to add some community features like registering and Login sessions? The Login and Logout sould be possible on every page without leaving the page.
Will it be possible to include that new feature into every page without editing each Page? Is there a common "Page" Class that I have to edit?

I hope you understand my problems and can give me some directions.
Thank you in advance! Greetings from Lower Austria!

PS: Maybe you can contact me on IM or something if you have a clue an want to help me out? :)

Posted: Tue Dec 19, 2006 3:47 am
by raghavan20
templating:
smarty can be used but sometimes it is considered overly complicated. for small applications it is better to build your own templating system or find one that is not complex.

normal template requirements:

Code: Select all

config file to map placeholders to classes/functions
layout file
a render script that will replace placeholders with outputs from classes/functions
i have not told you the framework, but if you want you can have look at some sample frameworks from zend, symfony, CakePHP, etc.

DB:

Code: Select all

you can download the DB class from PEAR and use it. You can use creole package and it also supports persistence in many languages and you can record traversal.
Internationalization:

Code: Select all

basic idea is choosing a locale.
for a same english word, relevant spanish, french, italian, chinese, etc words are stored in a file.
the internationalization script based on the locale will return the appropriate language word.
But there is more to this, currency, date, etc., have to be dealt. You can have a read by searching for 'java internationalization'
I guess there is a package offered by PEAR to implement this functionality.


Nobody can really tell you how to structure the framework and the helpers and components that will be in it. Most of the components can be plugged in to the framework and I would suggest you to look at existing frameworks by searching in google for 'PHP framework' and use available packages from PEAR.

Re: Could you point me in the right direction on a class lay

Posted: Tue Dec 19, 2006 1:40 pm
by Christopher
alphanimal wrote:Lets say I want to create a site that should support templates with Smarty Template Engine. It sould also have Multi-Language support and both - temapltes and translations - should be in a MySQL Database.

So we got three main functionalities: Template, Localization, Database

So how sould these be designed? How should they interact? Which classes do I need and how is their inheritance and other relations? How will a "Hello World"-Page source look like? Which include files should there be and where should they be included?

So thats the first questions I have :)
Well, first "Template, Localization, Database" are not really "functionalities" and are sort of a mix of concepts. I would suggest instead that you focus on what you want the website to do/be.
alphanimal wrote:Now, the framework is up with those features.
Then, lets say, I decide that I do not want to use Smarty anymore, because the designers I have hired have problems implementing their templates, and I want to use a more basic, maybe self made template engine?
What do I have to concern in coding that the plugging-in of that new template engine is as easy as possible?
What if I decide to switch from MySQL to an Oracle DB?

Now, what if I want to add some community features like registering and Login sessions? The Login and Logout sould be possible on every page without leaving the page.
Will it be possible to include that new feature into every page without editing each Page? Is there a common "Page" Class that I have to edit?

I hope you understand my problems and can give me some directions.
Those are a number of very big questions and they are really design questions. They either take time to learn OR you can use an existing framework OR hire someone who knows how to implement them.