Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Smarty with an Object Orientated Website
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    Smarty Forum Index -> Frameworks
View previous topic :: View next topic  
Author Message
mocean
Smarty Rookie


Joined: 21 May 2003
Posts: 30
Location: The Netherlands

PostPosted: Tue Aug 26, 2003 10:54 am    Post subject: Re: Relations Reply with quote

boots wrote:
Thanks for your reply, mocean.
I didn't mean that a replacement for the relations system you had already built, but as an adjunct to only support hierarchical cases (like menus, etc).

One could adapt this system with two relations (leftId, rightId) or two fields in the Objects Table (if All objects need these)

boots wrote:

It roughly means short abbreviations that look like the word the represent. Like ADDR for "address". I find it is easier to recall ADDR than arbitrary numbers like 14. Looking at your code, I had noticed several of these "magic numbers" and that is why I made the suggestion Smile

I know, my parse file is not an example of consistent programming,
but I had to finish it Smile
For retrievel of so-called 'shortcuts' I use something like that:
{include file="db:habiheader2"}
The autoincrement is easy, because you don't have to worry about double names. And in the CMS, no numbers are needed at all.

I have considered unsting the object-type's name and put them all in an array, something like $objecttype["agenda"] and $property["tTitle"].


Understand that this OO Database system is of a higher level than the PHP (with Smarty) implementation of me. Many different implementations of this concept are possible (with other template engines than Smarty, or even with another Script Language and Database Engine).

In the article I'mtrying to work on, I try to show that, but I'll also tell that PHP & Smarty is great to build it Smile
_________________
Visit My Smarty Enabled Website (Dutch Only) at www.habiforum.nl
and read how it works.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
risto
Smarty Rookie


Joined: 26 Apr 2003
Posts: 21
Location: Norway

PostPosted: Tue Aug 26, 2003 11:12 am    Post subject: starting to get somwhere now! :) Reply with quote

I have made a class that can display all types of objects with related objects. It's starting to work nicely. The only thing remaining in the class now is handling of multiple occurances of properies! You can have a look at it here: http://vif.ath.cx/oo/object_class.php

In reguard too the discussion mocean & boots are having. after a while looking at the database will not make sence. I'm going to start work an a little admin tool for handling the database (objects, object types, relations and so on.) I find it very difficult working woth this from phpMyAdmin. It's all spread out over most tables. Smile

I plann to make tools for:

adding:
object types with object properties,
relations with relation types,
property types,
and lastly objects tying it all togeather

Its going to be as simple as posible. but before I begin Id like some input on the database I created. Any suggestions woult be exelent. On all aspects of the database. field names, table names table types and so on. As youl se I dont realy use the date table I prefer uing php timestamps and let smarty handle date formating, to I use the text field for dates too!

here you have the database export:
http://vif.ath.cx/oodb.txt

PS! Im using PEAR:DB for all queries on mysql

any comments before I start?
Back to top
View user's profile Send private message
risto
Smarty Rookie


Joined: 26 Apr 2003
Posts: 21
Location: Norway

PostPosted: Tue Aug 26, 2003 6:51 pm    Post subject: DeZign for Databases Reply with quote

have anyone tries "DeZign for Databases" It looks very nice. Im trying is now. have a look here http://www.datanamic.com/dezign/index.html

It cums ip with sugestion on creating tables and relations!!
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Aug 26, 2003 10:19 pm    Post subject: Reply with quote

@risto:

If I may make a very small suggestion concerning your table structure (which I only glanced, I admit): consider using all caps for table names and lowercase for fields (with underscores). If you want to stick with StudlyCaps, then stay consistent across all tables--it looks like you are using both styles.

An admin tool to handle the database is a great idea. I would also suggest an abstract API to hide the db implementation -- in this case, I mean something at a higher level than a typical relational db abstraction layer.

Just a thought.
Back to top
View user's profile Send private message
risto
Smarty Rookie


Joined: 26 Apr 2003
Posts: 21
Location: Norway

PostPosted: Wed Aug 27, 2003 8:15 am    Post subject: :) Reply with quote

thanx. Ill doo it later today!
Back to top
View user's profile Send private message
CirTap
Smarty Pro


Joined: 04 Jun 2003
Posts: 106

PostPosted: Fri Aug 29, 2003 1:41 am    Post subject: Re: starting to get somwhere now! :) Reply with quote

risto wrote:
here you have the database export:
http://vif.ath.cx/oodb.txt

I dunno if this is inteded, but there appears to be "typo" in
INSERT INTO `ObjectProperties` VALUES (1, '2', '2', 'no', 'tes');
I assume this should be 'yes', like the others -- just in case you were wondering if things didn't work Smile

CirTap
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Aug 29, 2003 1:56 am    Post subject: Re: Relations Reply with quote

mocean wrote:
boots wrote:
Thanks for your reply, mocean.
I didn't mean that a replacement for the relations system you had already built, but as an adjunct to only support hierarchical cases (like menus, etc).

One could adapt this system with two relations (leftId, rightId) or two fields in the Objects Table (if All objects need these)

Idea thanks for that--I guess I needed that spelled out for me, but I got it now Smile I see that I could then use custom traversals for specific object types--all without extending the data model. Nice.
Back to top
View user's profile Send private message
Justin
Smarty Regular


Joined: 07 May 2003
Posts: 38
Location: Vilnius, Lithuania

PostPosted: Fri Sep 12, 2003 2:34 pm    Post subject: Reply with quote

what's new? maybe there's a article already?
we're waiting Smile
_________________
http://www.baubas.net
Back to top
View user's profile Send private message Visit poster's website
mocean
Smarty Rookie


Joined: 21 May 2003
Posts: 30
Location: The Netherlands

PostPosted: Fri Sep 12, 2003 3:50 pm    Post subject: Reply with quote

Justin wrote:
what's new? maybe there's a article already?
we're waiting Smile


I'm working on the article, but that requires time, which is the limiting factor right now.

Second, I'm making plans to develop an opensource version but that will require even more time!

When I have more detailed information I'll post it here!
_________________
Visit My Smarty Enabled Website (Dutch Only) at www.habiforum.nl
and read how it works.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
fab
Smarty Rookie


Joined: 12 Sep 2003
Posts: 9

PostPosted: Sat Sep 13, 2003 7:41 am    Post subject: Excellent work. Reply with quote

really an impressive db architecture Mocean,

i just reproduced it and despite my first impression the structure is very manageable and well-thought.

Just a little question:

how are you handling the news on your site ?

Is there a news Object for each news-feed or are the news feeds managed through property instances of the same "news" Object (think so, but maybe i'm wrong, "news" sounds so ...ObjectType)

Thx, looking forward for your article
Back to top
View user's profile Send private message
mocean
Smarty Rookie


Joined: 21 May 2003
Posts: 30
Location: The Netherlands

PostPosted: Sat Sep 13, 2003 11:37 am    Post subject: Re: Excellent work. Reply with quote

fab wrote:

how are you handling the news on your site ?

The news arrives in an XML file which is renewed by a cron job every 15 minutes.

I created a Smarty Plugin which displays news:
{shownews mode="frontpage"}
{shownews mode="full"}
both use a different XSL scheme to display news.

{shownews mode="detail"}
The last mode uses $_REQUEST["newsid"] to display a single newsitem with the apropriate XSL.

These plugins I call from a simple 'page'-object.
_________________
Visit My Smarty Enabled Website (Dutch Only) at www.habiforum.nl
and read how it works.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
fab
Smarty Rookie


Joined: 12 Sep 2003
Posts: 9

PostPosted: Sun Sep 14, 2003 7:21 pm    Post subject: more questions Reply with quote

I see.
Now i have a couple more questions for you Wink

About relations:
Is the relations stuff really necessary? I was thinking of creating a couple of "meta" data types (in DataTypes) to handle parent/child relations: things like a "object" and "object type" data types to be added to the existing "char", "text" ad "date" types.
These fictional data-types can be used to create into ObjectProperties some meta-properties designating an Object as parent for other Object / Object Types.

About the Property flag MultipleAllowed:
hmmm... think that having multiple instances for a property can be hypothetically useful, but can't see any practical application for it - can you plz give me an example? (I am worried by the code complications involved with having multiple property instances ...)

Thx for your patience.
Back to top
View user's profile Send private message
mocean
Smarty Rookie


Joined: 21 May 2003
Posts: 30
Location: The Netherlands

PostPosted: Mon Sep 22, 2003 12:40 pm    Post subject: Re: more questions Reply with quote

fab wrote:

About relations:
Is the relations stuff really necessary? I was thinking of creating a couple of "meta" data types (in DataTypes) to handle parent/child relations: things like a "object" and "object type" data types to be added to the existing "char", "text" ad "date" types.
These fictional data-types can be used to create into ObjectProperties some meta-properties designating an Object as parent for other Object / Object Types.

For relations I doubt if this would make it easier. Relations operate very different from properties. Furthermore, a relation can be made combining three objects. If you implement the relations in the same manner as the properties, the difference might be not clear any more. My way is more strict I think:
Properties: Values of text/int/date with no relation with anyting
Relation: Object's link with 1 (or 2) other objects

fab wrote:

About the Property flag MultipleAllowed:
hmmm... think that having multiple instances for a property can be hypothetically useful, but can't see any practical application for it - can you plz give me an example? (I am worried by the code complications involved with having multiple property instances ...)

Example is a date field of an agenda-object (multiple days), an 'author' flag of an article (if the author isn't an object) or a keyword-property of a page.

When assigning the variables I loop trough all properties linked to an object and assign them to Smarty. When a property has multiple values, I convert the variable to an array. With Smarty this is easy to use. On just has to make sure the templates can handle the multiple properties.
_________________
Visit My Smarty Enabled Website (Dutch Only) at www.habiforum.nl
and read how it works.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
xe
Smarty Rookie


Joined: 25 Sep 2003
Posts: 8

PostPosted: Sat Sep 27, 2003 10:03 am    Post subject: Reply with quote

hi.

has anyone of your tested pear::quickforn/db/db_dataobjects/db_dataobjects_formbuilder + smarty alltogether so far? any ideas for an open architecture?

cheers
xe
Back to top
View user's profile Send private message
Justin
Smarty Regular


Joined: 07 May 2003
Posts: 38
Location: Vilnius, Lithuania

PostPosted: Sun Oct 12, 2003 4:50 am    Post subject: Reply with quote

xe wrote:
hi.

has anyone of your tested pear::quickforn/db/db_dataobjects/db_dataobjects_formbuilder + smarty alltogether so far? any ideas for an open architecture?

cheers
xe


Seagull framework - http://phpkitchen.com/seagull/
It's powered by pear::db, db_dataobject, quickform etc., but template engine is not smarty.
_________________
http://www.baubas.net
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Frameworks All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP