TinyPortal

General => Chit chat => Topic started by: snork13 on February 05, 2006, 05:30:37 PM

Title: textarea setting.template question...paypal mod/donations
Post by: snork13 on February 05, 2006, 05:30:37 PM
I posted this over at smf, and got a little help, thought someone over here may know a way i get what i need done, here the link:

http://www.simplemachines.org/community/index.php?topic=69558.0 (http://www.simplemachines.org/community/index.php?topic=69558.0)

i was told 'textarea' would work, but i still get one line. i just need to fix this and the simple paypal donation mod is finished.

in the admin section under current theme, you have a place to enter your location of the forum logo.

below i added a place where i wish the paypal merchant code to be pasted, the problem is that i need a text area, the code is way to long. i have this paypal mod done, but this one thing. Maybe someone can point me in the right directions, maybe this could be donw differently. i only want the admin able to enter the paypal code, and i thought the theme settings was a good place.  i guess i could link to another file?

array(
'id' => 'paypal_form',
'label' => $txt['paypal_form'],
'description' => $txt['paypal_form_desc'],
'type' => 'text',



thanks

-snork


[attachment deleted by admin]
Title: Re: textarea setting.template question...paypal mod/donations
Post by: borgBOB on February 05, 2006, 08:28:03 PM
If you look at the code for a larger input area, say from the member profile page, it might have something longer.
Title: Re: textarea setting.template question...paypal mod/donations
Post by: borgBOB on February 05, 2006, 08:34:15 PM
Maybe a better code would be from the news box input, found in the default theme.
ManageNews.template.php.  That has to be much larger by nature.

// This provides an empty text box to add a news item to the site.
echo '
<tr class="windowbg2">
<td align="center">
<div id="moreNewsItems"></div><div id="moreNewsItems_link" style="display: none;"><a href="javascript:void(0);" onclick="addNewsItem(); return false;">', $txt['editnews_clickadd'], '</a></div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
document.getElementById("moreNewsItems_link").style.display = "";

function addNewsItem()
{
setOuterHTML(document.getElementById("moreNewsItems"), \'<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" name="news[]" style="width: 85%;"></textarea></div><div id="moreNewsItems"></div>\');
}
// ]]></script>
<noscript>
<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" style="width: 85%;" name="news[]"></textarea></div>
</noscript>
</td>
<td colspan="2" valign="bottom" align="right" style="padding: 1ex;">
<input type="submit" name="save_items" value="', $txt[10], '" /> <input type="submit" name="delete_selection" value="', $txt['editnews_remove_selected'], '" onclick="return confirm(\'', $txt['editnews_remove_confirm'], '\');" />
</td>
</tr>
</table>
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';
Title: Re: textarea setting.template question...paypal mod/donations
Post by: bloc on February 05, 2006, 08:43:57 PM
The way I did it in some of my themes, was to add a new "type" in Themes.template..then just adding a new setting in Settings.template, and setting its "type" to "textarea". That way you can add many "types" really.

First open Themes.template and find this:
else
echo '
<label for="', $setting['id'], '">', $setting['label'], '</label>
<input type="text" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '" value="', $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : ' size="40"', ' />';


And replace with this:
elseif ($setting['type'] == 'textarea')
{
echo '
<textarea wrap="on" style="width: 95%;" rows="10" cols="40" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">', $setting['value'], '</textarea>
<br /><label for="', $setting['id'], '">', $setting['label'], '</label>';
}
else
echo '
<label for="', $setting['id'], '">', $setting['label'], '</label>
<input type="text" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '" value="', $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : ' size="40"', ' />';


the just add your setting in Settings.template, but use:
'id' => 'paypal_form',
'label' => $txt['paypal_form'],
'description' => $txt['paypal_form_desc'],
'type' => 'textarea',

Title: Re: textarea setting.template question...paypal mod/donations
Post by: snork13 on February 05, 2006, 09:37:19 PM
Quote from: Bloc on February 05, 2006, 08:43:57 PM
The way I did it in some of my themes, was to add a new "type" in Themes.template..then just adding a new setting in Settings.template, and setting its "type" to "textarea". That way you can add many "types" really.

First open Themes.template and find this:
else
echo '
<label for="', $setting['id'], '">', $setting['label'], '</label>
<input type="text" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '" value="', $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : ' size="40"', ' />';


And replace with this:
elseif ($setting['type'] == 'textarea')
{
echo '
<textarea wrap="on" style="width: 95%;" rows="10" cols="40" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">', $setting['value'], '</textarea>
<br /><label for="', $setting['id'], '">', $setting['label'], '</label>';
}
else
echo '
<label for="', $setting['id'], '">', $setting['label'], '</label>
<input type="text" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '" value="', $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : ' size="40"', ' />';


the just add your setting in Settings.template, but use:
'id' => 'paypal_form',
'label' => $txt['paypal_form'],
'description' => $txt['paypal_form_desc'],
'type' => 'textarea',



bloc....awesome...awesome...thanks so much, i was looking for this exact thing...now my simple paypal mod can be added to smf through the package manager...

-snork