Hi, I'm just getting started with ProcessWire and am attempting to make the conversion from ExpressionEngine. My PHP skills are a little rusty, so please bear with me...
So I'm trying to make a simple "Related Entries" field. I went with a Pages field type and am accessing the values through the PageArray/WireArray method. Before I get too deep into this, I was wondering if someone could look at this and tell me if I'm going about this in the right way in terms of syntax and native functionality.
$a=$page->related;
$array = explode("|", $a);
if ($a->count()) {
echo '<h2>'.$a->getTotal().' Related Entries</h2>';
echo '<ul>';
foreach ($array as $key => $value) {
$link = $pages->get($value)->httpUrl;
$title = $pages->get($value)->title;
$out = '<li><a href="'.$link.'">'.$title.'</a></li>';
echo $out;
}
echo '</ul>';
}