We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question

Re-using Content

I know this is basic, but for some reason I'm struggling with perch content custom. I want to re-use some data that is input in another shared region. So I have a shared region called Social and it keeps a list of Social Media Links. I want to use some of that information in some structured markup so my client doesn't have to enter information twice.

I have my content named "social" in the content folder and in there I have created a multiple perch content tags that is housing the links to the different social media links of my client. I have another content page called footerContact it is also kept in the content folder. I want to add some structured markup that will include a few of the links that were entered on "social" page. I want to do something like the following to re-use the information (This isn't working so it is obviously wrong):

<?php perch_content_custom('social', array(
'template'=>'/social.html',
'value'=>'Facebook',
)); ?>

I don't know if you can re-use content within the content folder and if you can please help me with my markup. Thanks in advance for your help.

Matt Holovach

Matt Holovach 0 points

  • 3 years ago

Matt, what is the reason for 'value'=>'Facebook'?

Normally if your using a filter array() with perch_content_custom() it's because you want to filter the results. In order to filter you need (3) things, 'filter', 'match' and 'value'.

However if your just trying to get the shared region to dump all results using the original template which was used to save the content you could just use the standard perch_content() tag.

I would be helpful if you could submit your template, this would help a lot with solving your problem.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

You template path is incorrect, it shouldn't start with a forward slash but instead be relative to perch/templates/content. So this won't be getting as far as finding a template. As Robert says if you want to filter you need to use filter, match and value.

The docs are here: https://docs.grabaperch.com/functions/content/perch-content-custom/

Its also a good tip to enable debug as then you will see if you are trying to use a template that can't be found.

Thanks for the help Robert and Rachel I not only had a syntax issue but also I had a structure issue on how I was trying to get the information laid out. I've got it all working now.

Glad you got things going.