NoPyGod
NoPyGod

Reputation: 5067

PyroCMS: How to include one page inside another

I have a site with an "About us" page which is divided into multiple sections.

About Us
    +Overview
    +The Company
    +Our services
    +Future plans
    (etc)

I want to have a floated block on the right hand side of each of these pages which contains links to every other page.

Ideally, what I would like is to create a page titled AboutUsSidebar, and then be able to include this page in all of the about sections through some kind of tag, ie..

{include('Sidebar')}

Is there anything like this in PyroCMS? Or perhaps a better way to do it?

Upvotes: 0

Views: 357

Answers (3)

NoPyGod
NoPyGod

Reputation: 5067

In the end what I was able to achieve the desired result by using a page type.

I have a page type called "About" which contains the sidebar html, then I use pages on top of that page type for each of the sections.

Worked very nicely.

Upvotes: 0

Nick Pyett
Nick Pyett

Reputation: 3408

You should use view partials.

Create your sidebar with it's HTML and save it into addons/shared_addons/themes/yourtheme/views/partials/sidebar.html and then you can include it in your layouts as so:

{{ theme:partial name="sidebar" }}

Upvotes: 1

NoPyGod
NoPyGod

Reputation: 5067

It looks like page types are the way to go, I didn't see the page types button at the top of the page before.

Upvotes: 0

Related Questions