View previous topic :: View next topic |
Author |
Message |
mocean Smarty Rookie
Joined: 21 May 2003 Posts: 30 Location: The Netherlands
|
Posted: Tue Aug 26, 2003 10:54 am Post subject: Re: Relations |
|
|
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
|
I know, my parse file is not an example of consistent programming,
but I had to finish it
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 _________________ Visit My Smarty Enabled Website (Dutch Only) at www.habiforum.nl
and read how it works. |
|
Back to top |
|
risto Smarty Rookie
Joined: 26 Apr 2003 Posts: 21 Location: Norway
|
Posted: Tue Aug 26, 2003 11:12 am Post subject: starting to get somwhere now! :) |
|
|
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.
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 |
|
risto Smarty Rookie
Joined: 26 Apr 2003 Posts: 21 Location: Norway
|
Posted: Tue Aug 26, 2003 6:51 pm Post subject: DeZign for Databases |
|
|
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 |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Tue Aug 26, 2003 10:19 pm Post subject: |
|
|
@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 |
|
risto Smarty Rookie
Joined: 26 Apr 2003 Posts: 21 Location: Norway
|
Posted: Wed Aug 27, 2003 8:15 am Post subject: :) |
|
|
thanx. Ill doo it later today! |
|
Back to top |
|
CirTap Smarty Pro
Joined: 04 Jun 2003 Posts: 106
|
Posted: Fri Aug 29, 2003 1:41 am Post subject: Re: starting to get somwhere now! :) |
|
|
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
CirTap |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Aug 29, 2003 1:56 am Post subject: Re: Relations |
|
|
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)
|
thanks for that--I guess I needed that spelled out for me, but I got it now I see that I could then use custom traversals for specific object types--all without extending the data model. Nice. |
|
Back to top |
|
Justin Smarty Regular
Joined: 07 May 2003 Posts: 38 Location: Vilnius, Lithuania
|
Posted: Fri Sep 12, 2003 2:34 pm Post subject: |
|
|
what's new? maybe there's a article already?
we're waiting _________________ http://www.baubas.net |
|
Back to top |
|
mocean Smarty Rookie
Joined: 21 May 2003 Posts: 30 Location: The Netherlands
|
Posted: Fri Sep 12, 2003 3:50 pm Post subject: |
|
|
Justin wrote: | what's new? maybe there's a article already?
we're waiting |
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 |
|
fab Smarty Rookie
Joined: 12 Sep 2003 Posts: 9
|
Posted: Sat Sep 13, 2003 7:41 am Post subject: Excellent work. |
|
|
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 |
|
mocean Smarty Rookie
Joined: 21 May 2003 Posts: 30 Location: The Netherlands
|
Posted: Sat Sep 13, 2003 11:37 am Post subject: Re: Excellent work. |
|
|
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 |
|
fab Smarty Rookie
Joined: 12 Sep 2003 Posts: 9
|
Posted: Sun Sep 14, 2003 7:21 pm Post subject: more questions |
|
|
I see.
Now i have a couple more questions for you
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 |
|
mocean Smarty Rookie
Joined: 21 May 2003 Posts: 30 Location: The Netherlands
|
Posted: Mon Sep 22, 2003 12:40 pm Post subject: Re: more questions |
|
|
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 |
|
xe Smarty Rookie
Joined: 25 Sep 2003 Posts: 8
|
Posted: Sat Sep 27, 2003 10:03 am Post subject: |
|
|
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 |
|
Justin Smarty Regular
Joined: 07 May 2003 Posts: 38 Location: Vilnius, Lithuania
|
Posted: Sun Oct 12, 2003 4:50 am Post subject: |
|
|
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 |
|
|