Jump to content

[Paid] Custom Page Templates


Recommended Posts

Posted

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!

  • 2 months later...
Posted

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:

5973662c8d930_ScreenShot2017-07-22at16_49_32.thumb.png.59dfbfede79f41c8cbdf2379f3e6360b.png

Does that help to get you started?

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...