Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted January 14, 20232 yr 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!
January 14, 20232 yr 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.
January 14, 20232 yr 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, 20232 yr by drawncodes
January 14, 20232 yr 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, 20232 yr by drawncodes
January 25, 20231 yr Author 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?
January 25, 20231 yr Give me the link to the page you wanted it to show, and I make the if statement for ya.
January 26, 20231 yr {{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
January 26, 20231 yr Author 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! 🙂
January 26, 20231 yr 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, 20231 yr by drawncodes