TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,972
  • Latest: Lineo
Stats
  • Total Posts: 196,105
  • Total Topics: 21,345
  • Online today: 1,072
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 129
  • Total: 129

textarea setting.template question...paypal mod/donations

Started by snork13, February 05, 2006, 05:30:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

snork13

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

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]

borgBOB

If you look at the code for a larger input area, say from the member profile page, it might have something longer.

borgBOB

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>';

bloc

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',


snork13

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

This website is proudly hosted on Crocweb Cloud Website Hosting.