News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How do I add a donation button?

Started by orangeblossom, August 31, 2008, 08:13:49 PM

Previous topic - Next topic

orangeblossom

I would like to add a button at the top of my forum, between "news" and "search" (don't know if every board has that  ???).

Where do I insert the code for that? Are there any special instructions I need to know?

cme1st2302

Post your index.template.php file for the theme you are using and I will add it for you (if you are using 1.1.X)

Chris
SMF Version: 1.1.11
SimplePortal Version: 2.3.2

Admin

He who waits for perfect conditions sees nothing!!
If you need help adding a button or tab PM me!!

Nathaniel

SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.


orangeblossom

Quote from: LHVWB on September 01, 2008, 02:56:42 AM
You should have a read of this documentation:
How do you add custom tabs to the Core (default) theme menu?

Is that the only way?

I wanted to just add a button (for PayPal donation) on the bar above the tabs, centered between "news" and "search."

Does that make sense? Thank you.

Nathaniel

That tutorial shows you how to do it for the default theme, if you have a custom theme then the process will be slightly different.

If you can tell me which theme you are using, or post your 'index.template.php' file then I can show you the custom edits required to add tabs/buttons to your theme.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

orangeblossom

Quote from: LHVWB on September 02, 2008, 07:08:52 PM
That tutorial shows you how to do it for the default theme, if you have a custom theme then the process will be slightly different.

If you can tell me which theme you are using, or post your 'index.template.php' file then I can show you the custom edits required to add tabs/buttons to your theme.

Thanks! I'm using the Christian Belief theme.

Nathaniel

Find this code ('index.template.php'):
    // Show a random news item? (or you could pick one from news_lines...)
    if (!empty($settings['enable_news']))
        echo '
                <td width="90%" class="titlebg2">
                    <span class="smalltexta"><b>', $txt[102], '</b>: ', $context['random_news_line'], '</span>
                </td>';
    echo '
                <td class="titlebg2" align="right" nowrap="nowrap" valign="top">


Replace with this code:
    // Show a random news item? (or you could pick one from news_lines...)
    if (!empty($settings['enable_news']))
        echo '
                <td width="60%" class="titlebg2">
                    <span class="smalltexta"><b>', $txt[102], '</b>: ', $context['random_news_line'], '</span>
                </td>';
    echo '
                <td width="50%" class="titlebg2" style="font-weight:bold;">
                    Donate
                </td>
                <td class="titlebg2" align="right" nowrap="nowrap" valign="top">/code]


That is the general edit, you can tweak it by changing the 'width=' parts, so that the Donantion link/button is positioned correctly. You will also have to change the 'Donate' text, to the button/text/link that you want. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

orangeblossom

#8
Quote from: LHVWB on September 02, 2008, 07:27:22 PM
Find this code ('index.template.php'):
    // Show a random news item? (or you could pick one from news_lines...)
    if (!empty($settings['enable_news']))
        echo '
                <td width="90%" class="titlebg2">
                    <span class="smalltexta"><b>', $txt[102], '</b>: ', $context['random_news_line'], '</span>
                </td>';
    echo '
                <td class="titlebg2" align="right" nowrap="nowrap" valign="top">


Replace with this code:
    // Show a random news item? (or you could pick one from news_lines...)
    if (!empty($settings['enable_news']))
        echo '
                <td width="60%" class="titlebg2">
                    <span class="smalltexta"><b>', $txt[102], '</b>: ', $context['random_news_line'], '</span>
                </td>';
    echo '
                <td width="50%" class="titlebg2" style="font-weight:bold;">
                    Donate
                </td>
                <td class="titlebg2" align="right" nowrap="nowrap" valign="top">/code]


That is the general edit, you can tweak it by changing the 'width=' parts, so that the Donantion link/button is positioned correctly. You will also have to change the 'Donate' text, to the button/text/link that you want. ;)

Thanks! Yay!

Is "Donate" where I would put the html from PayPal?

Nathaniel

I haven't really used paypal. Do they give you html code for a 'Donate' image/link/button?

If so, then the answer is yes. Thats where the code should go. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

orangeblossom

Quote from: LHVWB on September 02, 2008, 07:41:04 PM
I haven't really used paypal. Do they give you html code for a 'Donate' image/link/button?

If so, then the answer is yes. Thats where the code should go. ;)

Yay, it totally worked. Thank you!


Now, another question please. How can I align all these elements in the center (vertically) or top and get rid of the extra brown space?

Thank you!!

Nathaniel

You should be able to edit the 'Donation' code, so that those extra parts are next to the button, as opposed to below it. Is that what you want?

If you post that code, then I should be able to fix that up. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

orangeblossom

Quote from: LHVWB on September 02, 2008, 10:13:41 PM
You should be able to edit the 'Donation' code, so that those extra parts are next to the button, as opposed to below it. Is that what you want?

If you post that code, then I should be able to fix that up. ;)

I think this is the part of the PayPal button code that needs to be edited:
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>


Thank you!

Nathaniel

Hmm, it appears that those smaller icons area a part of the larger image, meaning that you can't use html to separate them.

I believe that PayPal will allow you to choose from a range of images, so you should try to find another image. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

orangeblossom

Quote from: LHVWB on September 02, 2008, 11:58:28 PM
Hmm, it appears that those smaller icons area a part of the larger image, meaning that you can't use html to separate them.

I believe that PayPal will allow you to choose from a range of images, so you should try to find another image. ;)

Thank you!

:)

damo1981

Hi there guy could you help me add a donate button to my theme, thanks damo1981

[SiNaN]

Welcome to SMF damo1981. :)

Can you attach your index.template.php file here so that we can have a look at it? Also where exactly you want to add it?
Former SMF Core Developer | My Mods | SimplePortal

damo1981

sorry been away so couldnt get to this straight away, yeah sure ill post my index.template.php, what im trying to do is add a paypal donation button to the right of logout

damo1981

heres the index.template.php requested i would like to add a donation link to paypal next to logout on the main selection bar thanks

Damo1981

[SiNaN]

Okay, let's try this.

Find:
<div>',template_menu(),'</div>

Replace:
<div><div style="float: right;">PAYPAL_BUTTON_CODES</div>',template_menu(),'</div>

Note that in your paypal button codes, you should replace single quote (') with backslash+single quote (\').
Former SMF Core Developer | My Mods | SimplePortal

Advertisement: