Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Gil Ronen Posted August 18, 2018 Posted August 18, 2018 I want to show some content only on the home page of the website, is there a way to do it in the templates? Thanks
Joel R Posted August 18, 2018 Posted August 18, 2018 What are you currently using for your homepage? The forums index or a custom IP.Pages page? What kind of content are you trying to add? It's not recommended that you manually adjust templates since during every upgrade, you run the risk of resetting the templates. The better approach is to use the block manager, where you add the blocks to hot zones. If you could share more about what you're trying to do, we can advise you better.
Gil Ronen Posted August 19, 2018 Author Posted August 19, 2018 On 8/18/2018 at 2:50 PM, Joel R said: What are you currently using for your homepage? The forums index or a custom IP.Pages page? What kind of content are you trying to add? It's not recommended that you manually adjust templates since during every upgrade, you run the risk of resetting the templates. The better approach is to use the block manager, where you add the blocks to hot zones. If you could share more about what you're trying to do, we can advise you better. I have a carousel from a page in the top of the page. it takes 100% of the page so I cant use blocks for this. I want to show it only on the home page.
Joel R Posted August 19, 2018 Posted August 19, 2018 Do you own IP.Pages application? You can create custom pages, and set it as your homepage.
Gil Ronen Posted August 20, 2018 Author Posted August 20, 2018 On 8/19/2018 at 3:21 PM, Joel R said: Do you own IP.Pages application? You can create custom pages, and set it as your homepage. I Cant add the forums to this custom page. My homepage has the articles in the top and in the bottom the forums.
Joel R Posted August 21, 2018 Posted August 21, 2018 You can add a forum feed. I'm still kind of confused on what youre actually trying to do though. It sounds like youre already using the forum index, modified with blocks at the top and bottom which is a pretty good solution. My other solution, as I suggested, is if you want a standalone homepage, create a custom page in IP.Pages and add blocks as desired. If you could add a screenshot or mock-up of what you want, we can advise you better.
Heosforo Posted August 21, 2018 Posted August 21, 2018 Hello. If you are doing this through globalTemplate, you could wrapp your code with this.If Pages app: {{if $location['app'] == 'cms' and $location['module'] == 'pages' and $location['controller'] == 'page' and \IPS\Request::i()->id == x}} YOUR CODE {{endif}} Replace x with your Page ID, so it will displayed only on that page. If Forums: {{if $location['app'] == 'forums' and $location['module'] == 'forums' and $location['controller'] == 'index'}} YOUR CODE {{endif}} PS: Consider what Joel R said about modifying templates unless you are sure.
Gil Ronen Posted August 22, 2018 Author Posted August 22, 2018 On 8/21/2018 at 1:21 PM, Heosforo said: Hello. If you are doing this through globalTemplate, you could wrapp your code with this.If Pages app: {{if $location['app'] == 'cms' and $location['module'] == 'pages' and $location['controller'] == 'page' and \IPS\Request::i()->id == x}} YOUR CODE {{endif}} Replace x with your Page ID, so it will displayed only on that page. If Forums: {{if $location['app'] == 'forums' and $location['module'] == 'forums' and $location['controller'] == 'index'}} YOUR CODE {{endif}} PS: Consider what Joel R said about modifying templates unless you are sure. The forums code works, exactly what I wanted. Do you know if theres a PHP if that I can use to show content only on mobile? Thanks.
Heosforo Posted August 22, 2018 Posted August 22, 2018 4 minutes ago, Gil Ronen said: The forums code works, exactly what I wanted. Do you know if theres a PHP if that I can use to show content only on mobile? Thanks. Unfortunately I don't now. Only with CSS (Just in case, since you want it with php) <div class='ipsResponsive_showDesktop ipsResponsive_block'> This element will *only* show on desktop sizes, and will render as a block-level element. </div> See this guide
Gil Ronen Posted August 22, 2018 Author Posted August 22, 2018 1 hour ago, Heosforo said: Unfortunately I don't now. Only with CSS (Just in case, since you want it with php) <div class='ipsResponsive_showDesktop ipsResponsive_block'> This element will *only* show on desktop sizes, and will render as a block-level element. </div> See this guide I know its possible with CSS, I want to add advertisements only to mobile users and with some ads I cant use this method.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.