Hi,
To solve my previous question i just need to add the creation and the returns (that's what I can't figure out how to do) in the pdoNeighbors snippet;
This snippets get exactly what I need ($prev and $next ) that contains early in its code the values of the previous and next sibling pages ID
I really need to get those ids returned as placeholders like +prev_id and +next_id for instance.
Can someone tell me how to do this, as I'wont desperately never be enough PHP friendly...
Thanks a lot.
I think, this is what you want:
<?php
//[[getNext? &field=`longtitle` &menueindex=`[[+menuindex]]` &parent=`[[+parent]]`]]
$field = $modx->getOption('field',$scriptProperties,'pagetitle');
$c = $modx->newQuery('modResource');
$c->where(array('parent'=>$parent,'menuindex:>'=>$menuindex));
$c->sortby('menuindex');
$c->limit(1);
$output = '';
if ($object = $modx->getObject('modResource',$c)){
$output = $object->get($field);
}
return $output;
called like that should give you the longtitle of the next resource in the same parent-container:
[[getNext? &field=`longtitle` &menueindex=`[[+menuindex]]` &parent=`[[+parent]]`]]
you don't need to change the snippet - code.
Try to call it like that:
[[getNext? &field=`id` &menueindex=`[[+menuindex]]` &parent=`[[+parent]]`]]
with this in your code
<?php
//[[getNext? &field=`id`
&menueindex=`[[+menuindex]]` &parent=`[[+parent]]`]]
you will get a blank page, of course!