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,973
  • Latest: NonStop
Stats
  • Total Posts: 196,234
  • Total Topics: 21,353
  • Online today: 739
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 381
  • Total: 381

Question about article template

Started by domeen, August 01, 2008, 10:15:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

domeen

Hi,

if you add an article you get 2 fields, 1 for extended and 1 for the frontpage. The fields are empty, but is it possible to modify the fields, so if you  add an article that the fields contains text?

IchBin

You're going to have to be more specific that that. What fields are you talking about?

supportingactors

I'm guessing he means the "intro" and "body" text boxes for article entry. If I understand the question correctly, he wants the text boxes to have pre-filled content. Probably all that needs to be added is a <TEXTAREA>CUSTOM TEXT GOES HERE</TEXTAREA> element into the form.

domeen

that's what I mean Supportingact..

Is it possible?

JPDeni

Look in your Themes/default directory for TPortalAdmin.template.php. Look for


// add  article


which should be around line 1426.

Below that is where the form fields for adding an article are defined. Find which fields you want to have default values in and put them in there.

domeen

Thanks for the reply but , I found the code but I cannot figure it out were to put the text...

code:

// add  article
elseif($subaction=='addarticle' || $subaction=='addarticle_php'){
echo '
<form  accept-charset="', $context['character_set'], '" name="TPadmin3" action="' . $scripturl . '?action=tpadmin" method="post" enctype="multipart/form-data" onsubmit="syncTextarea();">
<input name="TPadmin_articles" type="hidden" value="set">
<input type="hidden" name="sc" value="', $context['session_id'], '" />
<table width="100%" cellspacing="1" cellpadding="5" class="bordercolor">
<tr class="windowbg2">
<td valign="top" colspan="2" class="titlebg"> '.$txt['tp-addarticle'].' </td>
</tr>';
if($subaction=='addarticle_php')
echo '
<tr class="windowbg2">
<td valign="top" align="right" width="25%">'.$txt['tp-phparticle'].'</td>
<td width="75%" valign="top"><input name="tp_article_php" type="checkbox" value="ON" checked></td>
</tr>';
echo '
<tr class="windowbg2">
<td valign="top" align="right" width="25%">'.$txt['tp-title'].'</td>
<td width="75%" valign="top"><input style="width: 92%;" name="tp_article_title" type="text" value=""></td>
</tr>
<tr class="windowbg2">
<td colspan="2" align="center" valign="top" >
'.$txt['tp-bodytext'].'<br />
<textarea name="tp_article_body" id="tp_article_body" style="padding: 5px; width: 90%; height: 300px;" wrap="auto"> </textarea>';

if($context['TPortal']['use_wysiwyg']>0 && $subaction=='addarticle'){
echo '
<script language="javascript" type="text/javascript">
FullEditor("tp_article_body");
</script>';
}
echo '<br />
</td>
  </tr>';
if($subaction=='addarticle_php'){
echo '
<input name="tp_article_useintro" value ="-1" type="hidden">';
}
else
echo '
<tr class="windowbg2">
<td valign="top" align="right">'.$txt['tp-useintro'].'</td>
<td valign="top">
<input name="tp_article_useintro" type="radio" value="0" checked> '.$txt['tp-no'].'
<input name="tp_article_useintro" type="radio" value="1"> '.$txt['tp-yes'].'
</td>
</tr>';

echo '
<tr class="windowbg2">
<td valign="top" align="right">'.$txt['tp-showonfrontpage'].'</td>
<td valign="top">
<input name="tp_article_frontpage" type="radio" value="0"> '.$txt['tp-no'].'
<input name="tp_article_frontpage" type="radio" value="1" checked> '.$txt['tp-yes'].'
</td>
</tr>';

JPDeni

I don't know what field you want to change.

If you want to put in a default title, put the title in the value here:

<td width="75%" valign="top"><input style="width: 92%;" name="tp_article_title" type="text" value=""></td>


like


<td width="75%" valign="top"><input style="width: 92%;" name="tp_article_title" type="text" value="default title"></td>


If you want to add text to the body of the article, put it in this tag

<textarea name="tp_article_body" id="tp_article_body" style="padding: 5px; width: 90%; height: 300px;" wrap="auto"> </textarea>';


like


<textarea name="tp_article_body" id="tp_article_body" style="padding: 5px; width: 90%; height: 300px;" wrap="auto">Default text</textarea>';


Does that help?

domeen


This website is proudly hosted on Crocweb Cloud Website Hosting.