Created
January 10, 2021 05:12
-
-
Save AnatoliyAkhmatov/4de53eb0528b4af18d7afb4960be9c5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://forums.modx.com/thread/74440/problem-with-creating-modresource-programmatically | |
$page = $modx->newObject('modResource'); | |
$page->set('createdby', $modx->user->id); | |
$page->set('createdon', time()); | |
$page->set('parent', 3); | |
$page->set('template', $templateId); | |
$page->set('alias', $page->cleanAlias($rq['pagetitle'])); | |
// $page->set('uri', $page->cleanAlias($rq['pagetitle']).".html"); | |
// $page->set('uri_override',1); | |
$page->set('hidemenu',1); | |
$page->set('menuindex',count($modx->getCollection('modResource',array('template'=>$templateId)))); | |
$page->set('pagetitle', 'Аля улю'); | |
$saved = $page->save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment