Jump to content

How to make code appear in Pages app but not in every page?


Maxxius

Recommended Posts

hi, I've ran into a quite a problem and I can't figure it out.

thing is I'm using a theme which has a big slider and latest articles block. borx theme to be exact.

problem is that in theme settings there is only one type of setting where slider should appear and one of those areas is PAGES. and it does not go into details. this whole thing either can be seen in every pages of every database or even on every page created.

I have separate pages for completely unrelated things and I wish that slider would not appear there.

do any of you know any IF kind of code or any other means which I could wrap this code which makes the slider appear.

like if url or page title is X then show if not then do not display.

any and all help or advice would be appreciated so much.

@opentype @newbie LAC evenin' fellas 🙂 I thought about you guys while making this topic.

tv land any ideas GIF by YoungerTV

 

Borx1-min.png.84e695e2b5412c1d60fcafd7c4

Link to comment
Share on other sites

4 hours ago, Maxxius said:

do any of you know any IF kind of code or any other means which I could wrap this code which makes the slider appear.

like if url or page title is X then show if not then do not display.

I don't know that theme/slider, but have you tried placing the slider code in the specific page template instead of wrapping it in a conditional?

Link to comment
Share on other sites

Just now, newbie LAC

Hello,

On 12/14/2019 at 9:06 PM, Maxxius said:

I have separate pages for completely unrelated things and I wish that slider would not appear there.

I guess you can hide the slider via css.

that would do until a proper way is possible (meaning load times increase for an element which is not shown). But i got no clue how to do it. Can you give an example. All i know is adding a hide class but how to make it work only on certain pages?

Link to comment
Share on other sites

8 minutes ago, Maxxius said:

that would do until a proper way is possible (meaning load times increase for an element which is not shown).

In this case you will need to edit template and use conditions

{{$showSlider = true;}}
{{if \IPS\Request::i()->app == 'cms' and \IPS\Request::i()->controller == 'page' and \IPS\Request::i()->module == 'pages' and $page = \IPS\cms\Pages\Page::$currentPage and \in_array($page->id, array(1,2,3,4,5))}}
	{{$showSlider = false;}}
{{endif}}

{{if $showSlider}}
	Slider code
{{endif}}

 

Link to comment
Share on other sites

@newbie LAC have you any idea if its even possible to go more in depth by making an if statement that would be able to tell if user is reading an article from category X and if statement is true show something?

I mean now this code you gave me which I absolutely love and have use for it is working page-wide no exceptions but. what if I'd like to show articles block under a record (article) and only there.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...