Man teste folgenden PHP Code:
PHP-Code:
$pages = PageModel::findAll();
foreach ($pages as $page)
{
print_r($page);
echo "<br></br>";
}
Ausgabe in templates/test.php:
...
Contao\PageModel Object ( [blnDetailsLoadedrotected] => [arrDatarotected] => Array ( [id] => 2 [pid] => 1 [sorting] => 64 [tstamp] => 1506779582 [title] => Docs [alias] => docs [type] => regular [pageTitle] => [language] => [robots] => index,follow [description] => [redirect] => permanent [jumpTo] => 0 [url] => [target] => [dns] => [staticFiles] => [staticPlugins] => [fallback] => [adminEmail] => [dateFormat] => [timeFormat] => [datimFormat] => [createSitemap] => [sitemapName] => [useSSL] => [autoforward] => [protected] => [groups] => [includeLayout] => [layout] => 0 [mobileLayout] => 0 [includeCache] => [cache] => 0 [includeChmod] => [cuser] => 0 [cgroup] => 0 [chmod] => a:9:{i:0;s:2:"u1";i:1;s:2:"u2";i:2;s:2:"u3";i:3;s: 2:"u4";i:4;s:2:"u5";i:5;s:2:"u6";i:6;s:2:"g4";i:7; s:2:"g5";i:8;s:2:"g6";} [noSearch] => [cssClass] => [sitemap] => map_default [hide] => [guests] => [tabindex] => 0 [accesskey] => [published] => 1 [start] => [stop] => [isBoxed] => 1
[subpages] => 7 [mainAlias] => docs [mainTitle] => Docs [mainPageTitle] => Docs [parentAlias] => startpunkt [parentTitle] => Startpunkt [parentPageTitle] => Startpunkt [folderUrl] => [rootId] => 1 [rootAlias] => startpunkt [rootTitle] => Startpunkt [rootPageTitle] => Startpunkt [domain] => [rootLanguage] => de [rootIsPublic] => 1 [rootIsFallback] => 1 [rootUseSSL] => [rootFallbackLanguage] => de [trail] => Array ( [0] => 1 [1] => 2 ) )
(Dieser Teil fehlt unten)
[arrModifiedrotected] => Array ( ) [arrRelationsrotected] => Array ( [jumpTo] => Array ( [table] => tl_page [field] => id [type] => hasOne [load] => lazy ) [groups] => Array ( [table] => tl_member_group [field] => id [type] => hasMany [load] => lazy ) [layout] => Array ( [table] => tl_layout [field] => id [type] => hasOne [load] => lazy ) [mobileLayout] => Array ( [table] => tl_layout [field] => id [type] => hasOne [load] => lazy ) [cuser] => Array ( [table] => tl_user [field] => id [type] => hasOne [load] => lazy ) [cgroup] => Array ( [table] => tl_user_group [field] => id [type] => hasOne [load] => lazy ) ) [arrRelatedrotected] => Array ( ) [blnPreventSavingrotected] => )
...
und in system/modules/my_modul/dca/tl_my_table.php :
PHP-Code:
$GLOBALS['TL_DCA']['tl_my_modul']['fields']['my_field'] = array
(
...
'options_callback' => array('tl_my_table', 'getPages')
...
);
class tl_my_table extends Backend
{
public function getPages()
{
// obige foreach-Schleife
}
}
gibt es folgende Ausgabe:
...
Contao\PageModel Object ( [blnDetailsLoadedrotected] => [arrDatarotected] => Array ( [id] => 2 [pid] => 1 [sorting] => 64 [tstamp] => 1506779582 [title] => Docs [alias] => docs [type] => regular [pageTitle] => [language] => [robots] => index,follow [description] => [redirect] => permanent [jumpTo] => 0 [url] => [target] => [dns] => [staticFiles] => [staticPlugins] => [fallback] => [adminEmail] => [dateFormat] => [timeFormat] => [datimFormat] => [createSitemap] => [sitemapName] => [useSSL] => [autoforward] => [protected] => [groups] => [includeLayout] => [layout] => 0 [mobileLayout] => 0 [includeCache] => [cache] => 0 [includeChmod] => [cuser] => 0 [cgroup] => 0 [chmod] => a:9:{i:0;s:2:"u1";i:1;s:2:"u2";i:2;s:2:"u3";i:3;s: 2:"u4";i:4;s:2:"u5";i:5;s:2:"u6";i:6;s:2:"g4";i:7; s:2:"g5";i:8;s:2:"g6";} [noSearch] => [cssClass] => [sitemap] => map_default [hide] => [guests] => [tabindex] => 0 [accesskey] => [published] => 1 [start] => [stop] => [isBoxed] => 1 )
Hier fehlt ein Teil, beginnend mit subpages
[arrModifiedrotected] => Array ( ) [arrRelationsrotected] => Array ( [jumpTo] => Array ( [table] => tl_page [field] => id [type] => hasOne [load] => lazy ) [groups] => Array ( [table] => tl_member_group [field] => id [type] => hasMany [load] => lazy ) [layout] => Array ( [table] => tl_layout [field] => id [type] => hasOne [load] => lazy ) [mobileLayout] => Array ( [table] => tl_layout [field] => id [type] => hasOne [load] => lazy ) [cuser] => Array ( [table] => tl_user [field] => id [type] => hasOne [load] => lazy ) [cgroup] => Array ( [table] => tl_user_group [field] => id [type] => hasOne [load] => lazy ) ) [arrRelatedrotected] => Array ( ) [blnPreventSavingrotected] => )
...
Warum fehlt der Teil mit den subpages in tl_my_modul?
Lesezeichen