Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
How To: Create a Forum Button to anywhere
Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Jun 13, 2012 - 11:26 pm

Need a button somewhere in your forum page to send a user to a specified webpage? Here is an easy way to create a button that matches your Simple:Press theme, shows a popup tool tip and is set to show only to logged in users.

First some code.....

if (is_user_logged_in()) {
  echo "<a class='spButton spRight vtip' title='Go to this webpage' href='".SFSITEURL."/webpage/'>";
  echo "<img class='spIcon' src='".SPTHEMEICONSURL."sp_Registration.png' alt=''/>Button Name</a>";
}

Now lets break it down.

The first line

if (is_user_logged_in()) {

checks to see if the user is logged in. If so do the stuff below it. If not then do and show nothing. This makes it so only a logged in user will see the button.

echo "<a class='spButton spRight vtip' title='Go to this webpage' href='".SFSITEURL."/webpage/'>";

This starts the creation of the button.

spButton tells Simple:Press to make a button.

spRight says to place the button on the right side of where your code is in conjunction with the rest of your theme.

vtip and title is what the user sees 'popup' when he hovers over it with a mouse cursor. In this case "Go to this webpage"

href is the URL that the button will send someone to. In the usage shown above it would send him to your main website address followed by /webpage.

  echo "<img class='spIcon' src='".SPTHEMEICONSURL."sp_Registration.png' alt=''/>Button Name</a>";

is the second part of the button information.

img class=spIcon tells it to use the same CSS layout as your other SP icons use.

src='".SPTHEMEICONSURL."sp_Registration.png' tells the button to use the icon sp_Registration.png residing n your theme's icon folder. If you want to use an icon stored elsewhere you can enter the full url there instead.

>Button Name< is the text shown on the actual button.

Once you know all the information, link and icon setup then place the code for your button anywhere in your Simple:Press header (spHead.php), the footer (spFoot.php) or an any of the other of your theme's template file where you want to show your new button.

 

You can even put the button in a post. laugh

Create this button

If you need a custom button then give this a try. If you have any questions let us know!

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626