Jump to content

Changing theme by using a link


Average Sam

Recommended Posts

Is it possible to change the theme by using a simple link?

Looking in the default IPS theme it's being done by the following code:

<li class="ipsMenu_item">
					<form action="//web.local/theme/?csrfKey=6d76e45144a958ae2137f7cc1df9ce9b" method="post">
					<input type="hidden" name="ref" value="aHR0cDovL25raXBzLmxvY2FsLw==">
					<button type="submit" name="id" value="4" class="ipsButton ipsButton_link ipsButton_link_secondary">Default Dark </button>
					</form>
				</li>

 

Or if anyone could share how I can make this button into a working text link, that would be great aswell.

Link to comment
Share on other sites

  • 2 weeks later...

Hello, @SHXRE. If you mean changing the theme in one that you want by clicking a text link, yes you can:

 

This is the code you will need:

<form action="//thunderzmcsbd.xyz/themebeta/index.php?/theme/&amp;csrfKey=d56094f3b11a6c7501a911de63ad38a3" method="post"><button type="submit" name="id" value="8" class="ipsButton ipsButton_link ipsButton_link_secondary">Pure Art (Default)</button></form>

 

Where form action = with the link from the theme you want to change into (I put my site as an example) and value = with the id from the theme.

 

Example in footer:

Search for footer in templates, open it and then put the code from above (with your details) above this code:

 

<a href='#elNavTheme_menu' id='elNavTheme' data-ipsMenu data-ipsMenu-above>{lang='skin'} <i class='fa fa-caret-down'></i></a>

 

So you will end up with something like this:

 

<li>
              <form action="//thunderzmcsbd.xyz/themebeta/index.php?/theme/&amp;csrfKey=d56094f3b11a6c7501a911de63ad38a3" method="post"><button type="submit" name="id" value="8" class="ipsButton ipsButton_link ipsButton_link_secondary">Pure Art (Default)</button></form>
            <a href='#elNavTheme_menu' id='elNavTheme' data-ipsMenu data-ipsMenu-above>{lang='skin'} <i class='fa fa-caret-down'></i></a>
            <ul id='elNavTheme_menu' class='ipsMenu ipsMenu_selectable ipsHide'>
            {{foreach $themes as $id => $set }}
                <li class='ipsMenu_item{{if \IPS\Theme::i()->id == $id}} ipsMenu_itemChecked{{endif}}'>
                    <form action="{url="app=core&module=system&controller=theme" noprotocol="true" csrf="true" seoTemplate="theme"}" method="post">
                    <input type="hidden" name="ref" value="{expression="base64_encode( (string) request.url() )"}">
                    <button type='submit' name='id' value='{$id}' class='ipsButton ipsButton_link ipsButton_link_secondary'>{lang="$set->_title"} {{if $set->is_default}}{lang="default"}{{endif}}</button>
                    </form>
                </li>
            {{endforeach}}
            </ul>
        </li>

 

If you still have questions you can quote this post.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...