Posted May 8, 20178 yr Hi, I have a number of databases I've created with Pages, which are linked in different ways. I'd like to change my record templates to display these links based on certain criteria. For example, I have a "Recipe" database and an "Ingredients" database. A Recipe both uses Ingredients, and can also create one. In the case of a recipe making an ingredient, I'd like to display it on the Ingredient page in a certain way. I'd then also want to display all the recipes that use the ingredient in a different way. The biggest issue I have right now is that I don't know what the correct syntax would be to do this with getReciprocalItems(). So I'm looking for someone who can build out a few cases for me to use to expand upon myself. I'd also like to be able to add some code at the beginning of the loop and close the code at the end of the loop, for example to add a nicely formatted table. Please let me know if you can assist with this, and what your prices are. Thanks!
July 22, 20177 yr Here is an example where I output the reciprocal items in the display template in a grid view and add the record image (which normally isn’t shown). {{if $records = $record->getReciprocalItems()}} {{foreach $records as $fieldId => $items}} {{$infoLineShown = FALSE;}} <div class="ipsGrid ipsGrid_collapsePhone ipsSpacer_bottom" data-ipsGrid data-ipsGrid-equalHeights='row'> {{foreach $items as $item}} {{if !$infoLineShown}}{{$infoLineShown=TRUE;}}<div class="ipsGrid_span3">{lang="records_linking_to_me" sprintf="$item::database()->recordWord(0,TRUE), $record::database()->recordWord(1)"}</div>{{endif}} <div class="ipsGrid_span3 ipsAreaBackground_reset ipsPad"> {{if $item->record_image}}<img class="ipsSpacer_bottom" src="{file='$item->_record_image_thumb' extension='cms_Records'}">{{endif}} <a href="{$item->url()}">{$item->_title}</a></div> {{endforeach}} </div> {{endforeach}} {{endif}} Looks like this: Does that help to get you started?
July 22, 20177 yr Author @opentype so that side of things I've been able to work out for myself. What I haven't been able to do is output reciprocal items from Database 1 in way X, and items from Database 2 in way Y.
July 23, 20177 yr Needs some IF queries then I guess. Feel free to send me a PM if you need it done as paid job.
Archived
This topic is now archived and is closed to further replies.