Brad Padgett
Well-known member
So to dumb this down in the simplest way possible I want to know if there is a better way to do this.
Let me break it down. First I'm trying to set a light bulb in the nav bar that goes to a corresponding style_id number set in options.
Basically to go to the dark style and switch back to light when clicked again. A user would place the style_id for each corresponding style in options. So far I got the option part set up.
Note that I want to make this as simple as possible so there should be no class files as I feel something this simple should not need one. So I then made a template mod and used this:
You can ignore the img src part. That's merely to get the image to show.
The part I want you to pay attention to is the link.
After setting up the option Dark_Switch and Light_Switch in options the user puts in the style IDs and clicks save.
Now it works and it has been tested. But there is a single issue and that's the dialogue that comes up and asks whether or not I want to switch styles.
For the purpose of this add-on I do not want the dialogue to appear and ask to switch styles.
How can I set the link to automatically go to the corresponding style IDs without the dialogue asking whether or not I want to switch styles. Also is there a better way I should be doing this. Looks a bit too easy but then again I don't want to make a class file because I feel as if it's un-necessary for an add-on this simple and shouldn't be needed.
I will wait on your guys assistance. Going to tag a couple people so if no one responds they might help. @Sim @S Thomas
Let me break it down. First I'm trying to set a light bulb in the nav bar that goes to a corresponding style_id number set in options.
Basically to go to the dark style and switch back to light when clicked again. A user would place the style_id for each corresponding style in options. So far I got the option part set up.
Note that I want to make this as simple as possible so there should be no class files as I feel something this simple should not need one. So I then made a template mod and used this:
HTML:
<a href="{{ link('misc/style?style_id=', $xf.visitor) . $xf.options.Dark_Switch }}"><img src="{{ base_url('styles/default/BP/LightSwitch/bulb-off.png', true) }}"></a>
<a href="{{ link('misc/style?style_id=', $xf.visitor) . $xf.options.Light_Switch }}"><img src="{{ base_url('styles/default/BP/LightSwitch/bulb-on.png', true) }}"></a>
You can ignore the img src part. That's merely to get the image to show.
The part I want you to pay attention to is the link.
After setting up the option Dark_Switch and Light_Switch in options the user puts in the style IDs and clicks save.
Now it works and it has been tested. But there is a single issue and that's the dialogue that comes up and asks whether or not I want to switch styles.
For the purpose of this add-on I do not want the dialogue to appear and ask to switch styles.
How can I set the link to automatically go to the corresponding style IDs without the dialogue asking whether or not I want to switch styles. Also is there a better way I should be doing this. Looks a bit too easy but then again I don't want to make a class file because I feel as if it's un-necessary for an add-on this simple and shouldn't be needed.
I will wait on your guys assistance. Going to tag a couple people so if no one responds they might help. @Sim @S Thomas