MediaWiki 模板 模板?
不确定我这里的术语是否正确。我会解释我想做什么,你们可以告诉我是否可能。
我使用 MediaWiki 作为客户列表页面。因此,我有一个客户类别,例如,我有 20 个客户。在实际的客户页面内,我有几个组成客户页面的“标题”,包括一个信息框。我想知道的是,我将如何将标题“包含”为模板“客户登陆页面”。意思是,每个“客户登陆页面”(客户 A 或客户 B 等)具有相同的“标题”,但内容不同 - 所以我想要的是每个客户页面,我可以包含一个“模板”和它具有相同的标题,标题下没有内容 - 因此每次我更改此“模板”文件时,它都会对每个客户进行更改,而我所要做的就是编辑客户页面上所需的内容。
Not sure I have the correct terminology here. I'll explain what I want to do and you guys can tell me if it's possible.
I'm using MediaWiki as a Customer List page. So, I have a category for customers, and for instance, I have 20 customers. Inside the actual customer page I have several "headings" that make up the customer page, including an infobox. What I'm wanting to know is, how I would go about "including" the headings as a template "Customer Landing Page". Meaning, each "Customer Landing Page" (Customer A or Customer B, etc, etc) has the same "headings", but not the same content - so all I want is that each customer page, I can include a "template" and it has the same headings with no content under the headings - so that each time I change this "template" file, it changes it on every customer, and all I have to do is edit the content on the customer page that is required.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须为整个客户页面制作一个大模板,在其中放置所有信息。我将为带有两个标题的页面制作一个示例模板:“客户登陆页面”和“更多信息”。标题是固定的,其下方的内容因客户页面而异。
首先,您通过创建页面 Template:Customer 来制作模板,
在此处输入:
三重荣誉表示您稍后将在每个客户页面中定义的变量。对于客户A:
客户B:
双重荣誉表示模板的开始,第一个单词是使用的模板名称。然后在每个管道(
|
)之后您可以分配变量。我只是使用换行符来使其更易于阅读,您不必这样做(但它使其更易于维护)。如果您不使用变量名称(例如
{{customer|Landing page text|More info text}}
),您可以使用{ 按变量定义的顺序访问变量模板中的 {{1}}}
和{{{2}}}
。如果客户页面非常大,您可能需要将模板拆分并每个部分使用一个。
You'll have to make one big template for the entire customer page, in which you put all the info. I'll make an example template for a page with two headers, "Customer Landing Page" and "More info". The headers are fixed, and the contents below it vary between customer page.
First, you make the template by creating the page Template:Customer
In here you put:
The triple accolades indicate the variables you will later define in each customer page. For customer A:
Customer B:
The double accolades indicate the start of a template, and the first word is the templatename used. Then after each pipe (
|
) you can assign variables. I only used newlines to make it easier to read, you don't have to do that (but it makes it easier to maintain).If you don't use the variable names (like
{{customer|Landing page text|More info text}}
) you can access the variables by the order they are defined in, using{{{1}}}
and{{{2}}}
in the template.If the customer pages are really big you might want to split the template up and use one per section.
另一种选择(但更复杂)是使用导航框 。这需要更多的设置,但可能更接近您正在寻找的东西?
Another option (but more complex) is the use of Navboxes. This requires a lot more set up but mayb be closer to what you are looking for?
您可以查看使用 MultiBoilerPlate,我用它来设置页面中的默认文本。我将其称为模板,但 Mediawiki 使用该术语来表示其他内容。如果您只想在开始新页面时加载相同的默认文本,然后用您自己的文本填充它,那么我认为这就是您所需要的。
You could look at using MultiBoilerPlate, I use this to set default text in pages. I would call this a template but Mediawiki uses that term for something else. If you just want to load the same default text when you start a new page and then fill it in with your own text, then I think this is what you need.