Forum
Sharing a particular element from a template in another area of the site?
I have a template containing two images and two headers and have allow multiple items applied. There is also pagination applied to this.
I need to share just the image part of the template in another area of the site. I basically want to create a shared region but only sharing one element of the region rather than the whole template.
Is this possible and if so how would I go about it?
Many thanks!
You'll want to use perch_content_custom
docs: https://docs.grabaperch.com/docs/content/perch-content-custom/
I came across this post searching the forum for the answer but it confused me a bit, could anyone explain in a bit more detail...
docs: https://support.grabaperch.com/index.php?pg=forums.posts&id=908
In what way are you confused? Which bit doesn't make sense to you?
Create a template containing only the subset of content/markup that you want to display, and then use
perch_content_custom()
to display the region setting the new template in thetemplate
option.Here is an example of what i think you want
then your template
This would look for the region Gold Services on the page services.php and you have set up the template to only display the content with the id of price
In my index.php I'm using...
to call the main template. Then in another div i have
to pull in the second lot but I'm pulling in the whole template still. I'm confused on how I just pull in the images? So you are saying I need to create another template just containing an image field and then use perch_content_custom to call that template?
Really sorry just finding this hard to get my head around.
Do I need 2 perch_content_custom ?
Aha that seems to be the answer I was looking for Dexter, I did...
and then put the img field in the largeimage.html template
Thanks very much Dexter for your help!
No problem, glad you got it working
Oh and to answer your question you only need the one perch_content_custom the other remains perch_content