Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Elon Report Posted January 14, 2023 Posted January 14, 2023 I would like logo1 to draw attention to itself, but only on the front page. On additional pages, it should show logo2, which is not animated. Can anyone help point me in the direction of where I need to modify the code? Thanks!
Randy Calvert Posted January 14, 2023 Posted January 14, 2023 It sounds like you would need to edit your theme. Find the part of the template generating the logo and modify it to have an if/else logic statement based on your requirements.
Alexandru Posted January 14, 2023 Posted January 14, 2023 (edited) Easy. Follow this steps. Go to your template, search in templates for "logo" than replace that code with this one: {{if isset( \IPS\Theme::i()->logo['front']['url'] ) AND \IPS\Theme::i()->logo['front']['url'] !== null }} {{$logo = \IPS\File::get( 'core_Theme', \IPS\Theme::i()->logo['front']['url'] )->url;}} <a href='{setting="base_url"}' id='elLogo' accesskey='1'> {{if request.module == 'forums' && request.controller == 'index'}} <img src="{$logo}" alt='{setting="board_name" escape="true"}'> {{else}} <img src="your logo link that is not animated" alt='{setting="board_name" escape="true"}'> {{endif}} </a> {{else}} <a href='{setting="base_url"}' id='elSiteTitle' accesskey='1'>{setting="board_name"}</a> {{endif}} This means, that IF the request.module == 'forums' && request.controller == 'index' will show the first logo on the index page (where the forums are) ELSE show the second logo. Where you see {$logo} that is the one uploaded directly to the template. after ELSE, where <img> to src="" add the link of your second logo ! Enjoy! Edited January 14, 2023 by drawncodes
Alexandru Posted January 14, 2023 Posted January 14, 2023 (edited) This should work 100% ! Sorry for x2 reply, I wanted to edit the one above but it seems like I'm sleeping today 😄 😛 Edited January 14, 2023 by drawncodes
Elon Report Posted January 25, 2023 Author Posted January 25, 2023 On 1/14/2023 at 3:51 AM, drawncodes said: that IF the request.module == 'forums' && request.controller == 'index' will show the first logo on the index page (where the forums are) ELSE show the second logo. Where you see {$logo} that is the one uploaded directly to the template. after ELSE, where <img> to src="" add the link of your second logo ! Great thx, I understand the logic! What I want is for the animated logo to show only on a specific page - not the forum. So I would use {{if request.module == 'pages'}} && request.controller == 'index' ?? How do I get and reference the page name?
Alexandru Posted January 25, 2023 Posted January 25, 2023 Give me the link to the page you wanted it to show, and I make the if statement for ya.
Alexandru Posted January 26, 2023 Posted January 26, 2023 {{if isset( \IPS\Theme::i()->logo['front']['url'] ) AND \IPS\Theme::i()->logo['front']['url'] !== null }} {{$logo = \IPS\File::get( 'core_Theme', \IPS\Theme::i()->logo['front']['url'] )->url;}} <a href='{setting="base_url"}' id='elLogo' accesskey='1'> {{if request.module == 'pages' && request.controller == 'page'}} <img src="{$logo}" alt='{setting="board_name" escape="true"}'> {{else}} <img src="your logo link that is not animated" alt='{setting="board_name" escape="true"}'> {{endif}} </a> {{else}} <a href='{setting="base_url"}' id='elSiteTitle' accesskey='1'>{setting="board_name"}</a> {{endif}} Here, enjoy! @MartinLawrence Elon Report 1
Elon Report Posted January 26, 2023 Author Posted January 26, 2023 54 minutes ago, drawncodes said: {{if request.module == 'pages' && request.controller == 'page'}} That worked, although it's not very intuitive. Is there a page which lists all the properties I can use? Thank you again, budding developer! 🙂
Alexandru Posted January 26, 2023 Posted January 26, 2023 (edited) When you are on a page, you need to look for this 2 (data-pagemodule and data-pagecontroller) data-pagemodule = request.module data-pagecontroller = request.controller Now you can just do it with one, for example {{if request.module == "pages"}} But I like to do it with 2 to be sure, cuz sometimes the same module can be on different pages and the controller changes or even reverse! Enjoy. Edited January 26, 2023 by drawncodes
Recommended Posts