TinyPortal

Development => Support => Topic started by: domeen on August 01, 2008, 10:15:50 AM

Title: Question about article template
Post by: domeen on August 01, 2008, 10:15:50 AM
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?
Title: Re: Question about article template
Post by: IchBin on August 01, 2008, 03:10:57 PM
You're going to have to be more specific that that. What fields are you talking about?
Title: Re: Question about article template
Post by: supportingactors on August 01, 2008, 04:12:08 PM
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.
Title: Re: Question about article template
Post by: domeen on August 03, 2008, 02:57:36 PM
that's what I mean Supportingact..

Is it possible?
Title: Re: Question about article template
Post by: JPDeni on August 03, 2008, 04:12:46 PM
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.
Title: Re: Question about article template
Post by: domeen on August 06, 2008, 07:22:21 AM
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>';
Title: Re: Question about article template
Post by: JPDeni on August 06, 2008, 02:02:42 PM
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?
Title: Re: Question about article template
Post by: domeen on August 06, 2008, 02:06:32 PM
thanks! it does :)