Topic on Project:Support desk

Call a template on a page and edit sections without editing the template

3
194.68.104.17 (talkcontribs)

I have a template with the following content:

== Section 1 ==
== Section 2 ==
== Section 3 ==

I then call the template on a page:

{{Template:mypage)

On my page I can edit each section, but if I do that it will edit the template, not the page. Sure I can use the "subst:", but that is not very scalable. Let’s say I have one template with all my headers. I then have 100 pages that retrieves content from that template. If I use "subst" to call the template I will have to edit all the pages again in order to apply the changes. To fix this I then did a template for every header, example:

template:section 1
{{{section 1}}}

Then I did a page for every template to get the right format:

:section 1
{{section 1
|section 1 = 
=== section 1 ===
}}

My page (page 1) was then populated like this:

{{:section 1}}
{{:section 2}}
{{:section 3}}

If I want a different name for "section 1" I just edit the page "section 1", but on my page (page 1) the edit function does not show up, I will have to edit the whole page in order to edit some data and with much data that isn’t very user friendly, and I can’t refer to different section on page 1. So, is there I way to get this working with templates or extensions?

2601:B:A800:F0:255B:C9E0:70:7FDD (talkcontribs)

My recommendation would be, on the original template, edit it to look like this.

Template:(whatever page name)
===Section {{{1|(whatever section name you want as the default)}}}===
===Section {{{2|(whatever section name you want as the default)}}}===
===Section {{{3|(whatever section name you want as the default)}}}===

Everything on the right of the | is the default name. Then when you call for it, it should show up as {{(whatever template name)|whatever section 1 name you want|whatever section 2 name you want|whatever section 3 name you want}}. I think that ought to work, but...

194.68.104.17 (talkcontribs)

It looks good. I created a template with the above content. I then created a page where I called the template. The sections showed up, but when I click edit it jumps back to the template..

Reply to "Call a template on a page and edit sections without editing the template"