[Typo3] parent pid of pid in pi (extension

Georg Rehfeld georg.rehfeld at gmx.de
Sun Jan 30 05:27:04 CET 2005


Hi Christian,

> So now a solution (This may not be the elegant way, but it works):
> 
> I cache the table pages (only the fields I need for speed reasons):

 > ... your code caching _all_and_every_ of possibly > 100.000 pages
 >     CUT by intention

> Then:
> 
> $oeuidofparentpage = $this->oePageCache[UID_OF_PAGE_I_KNOW]['pid'];

Please tell us the key of your extension, so it doesn't get installed
accidentally on a site with many pages :-) !!!

Couldn't you just use something like:

   $current_uid = 4711;
   $current_page = $GLOBALS['TSFE']->sys_page->getPage($current_uid);
   if (is_array($current_page)) {
     $parent_uid = $current_page['pid'];
     $parent_page = $GLOBALS['TSFE']->sys_page->getPage($parent_uid);
     if (is_array($parent_page)) {
       $grand_parent_uid = $parent_page['pid'];
       ... and so on, also, consider a loop instead
     }
   }

on demand? If you think of caching the accessed pages on the way,
you have to find a means of making the cache available to the next call
(I'm unsure here, if this is neccessary with Apache mod_perl, session?).

But if you cache, you NEVER must cache _all_ pages, instead invest
a considerable amount of thought and programming into _cleaning_up_
the cache, to not eat up server resources!

hth

Georg
-- 
  ___   ___
| + | |__    Georg Rehfeld      Woltmanstr. 12     20097 Hamburg
|_|_\ |___   georg.rehfeld.nospam at gmx.de    +49 (40) 23 53 27 10




More information about the TYPO3-english mailing list