[Typo3-UG Denmark] To-vejs MM-tabeller

Peter Makholm peter at makholm.net
Thu Mar 31 12:01:25 CEST 2005


Stefan Kreisberg <stefan at linkfactory.dk> writes:

> Apropo bi-directional-MM har jeg læst at den nyeste tt_news (cvs) har det 
> (vist på relaterede nyheder), jeg har dog ikke tjekket hvordan det er hacket 
> dér ...

Uden at have studeret tt_news nærmere, så siger changelogen:

2005-03-11   rupertgermann
[...]

     * cvsroot/typo3xdev/tx_ttnews/ext_tables.sql 1.12:
     * cvsroot/typo3xdev/tx_ttnews/pi/class.tx_ttnews.php 1.74:
     * cvsroot/typo3xdev/tx_ttnews/tca.php 1.23:

       - new feature: 'bidirectional Relations': if you set a relation
       between two news-records and you enable this feature
       (plugin.tt_news.useBidirectionalRelations = 1) you'll see the
       relation in both records on the website. The relation back from
       the target-record to the source is inserted automatically. In
       the BE you won't see the relation.
     
Og det relevante kode i pi1/class.tx_ttnews.php er i funktionen
getRelated:

    if ($this->conf['useBidirectionalRelations']) {
        $where = '(('.$where.') OR (tt_news.uid=M.uid_local AND M.uid_foreign=' . $uid .'))';
    }

(Hmmm, mon ikke den burde tjekke at M.tablenames var 'tt_news' her?)

Altså formodentlig et rent fremvisningshack. 

-- 
 Peter Makholm     |  Ladies and gentlemen, take my advice, pull down your
 peter at makholm.net |                            pants and slide on the ice
 http://hacking.dk |                                    -- Sidney Freedman



More information about the TYPO3-UG-denmark mailing list