Topic on Project:Support desk

template show or hide

12
Sokote zaman (talkcontribs)
MarkAHershberger (talkcontribs)

I don't understand what you're asking. Could you clarify what you want?

Sokote zaman (talkcontribs)

Yes, thank you

More explanation:

I want to have buttons on some pages and not buttons on some pages.

How do I show or not show a button in a template consisting of several patterns?

Thanks

MarkAHershberger (talkcontribs)

When do you want the button to show up? If it is something on the page, I think you could do this with some JS in your Common.js.

Sokote zaman (talkcontribs)

Thank you for your response

I want some pages to be just syntax and some pages to be syntax with buttons.

Sokote zaman (talkcontribs)

How can I fix this problem?

MarkAHershberger (talkcontribs)

"Some pages to be just syntax" -- could you point to an example on your wiki where you want this to happen? I still don't understand your question. It looks like you know how to make buttons (you made a couple here), why can't you do that on your wiki?

Sokote zaman (talkcontribs)

Yes, an example was created on Wiki

https://wikicod.ir/wiki/Test

Note that the first example is with the button

And

The second example is without a button

The above examples are shown with two patterns.

My question is how can I show both of the above examples by creating a template

Thanks

AhmadF.Cheema (talkcontribs)

If you want to include or exclude the button on a per-page basis, maybe you can try employing the ##if parser function used on Magic words#Page names in your template.

Something like: For two pages Page_A, Page_A_with-button

If {{PAGENAME}} includes the word button (can be checked using ##explode:), then allow button to be displayed otherwise not.

In case these patterns are to be included in the same page, simple if conditional statements should work.

Sokote zaman (talkcontribs)

Thank you for your guidance

It would be great if you could give an example

thank you

AhmadF.Cheema (talkcontribs)

Do you want the button inclusion/exclusion on a per-page basis or is it that there would be some elements with button and others without the button on the same page?

Sokote zaman (talkcontribs)

is it that there would be some elements with button and others without the button on the same page

Reply to "template show or hide"