, $docid = isset($docid) ? $docid : $modx->documentIdentifier;
$children=$modx->getActiveChildren($docid,'menuindex','ASC');
if (!$children===false)
{
$firstChild = $children[0];
$firstChildUrl = $modx->makeUrl($firstChild['id']);
}
else
{
$firstChildUrl = $modx->makeUrl($docid);
}
return $firstChildUrl;
, for the time they spend to help everybody whatever the crazy project they have.
1. For all of your multipage articles create a wrapper folder and place each article within it.
2. When calling the UserComments snippet on each page, do so with a docID equal to the containing folder.
3. Use getDocument to have the folder display the first child’s document as its content.
4. Use NewsListing with set to the parent folder of all your news (Don’t turn on multilevel).
5. Test everything out and make sure it works.
Redirecting is a piece of cake. Try this:
Quote from: Djamoer at Feb 23, 2006, 08:46 AM
Here is another quick little snippet that might serve your need as well.
// Create a new snippet and name it RedirectPage // Call it using [!RedirectPage? &docid=`5`!] // docid will be the page id number for your redirection if(isset($docid) && $docid != $modx->documentIdentifier) $modx->sendRedirect($modx->makeUrl($docid));
To do it more elegantly (without the reload) you could simply alter you NewsListing template so that instead of linking toyou link to a snippet with the following content:[~[+id+]~]
if(isset($docid) && $docid != $modx->documentIdentifier) $id=$modx->documentIdentifier; $children=$modx->getActiveChildren($id,'menuindex','ASC'); if (!$children===false) { $firstChild = $children[0]; $firstChildUrl = $modx->makeUrl($firstChild['id']); } else { $firstChildUrl = $modx->makeUrl($modx->config['site_start']); } return $firstChildUrl;
Replacing,with[~[+id+]~][!SnippetName?docid=`[+id+]`!]
Are you using this "[!SnippetName?docid=`[+id+]`!]" in Ditto Template?
If yes, use it like [[SnippetName?docid=`[+id+]`]].
hope this helps.