Adding Custum Field - (Core-Hack): Here we go:
based at the posting hier at the forum (thank you starletina)
http://forum.phpwcms.org/viewtopic.php?f=1&t=4164
Example for a custom field called "guestbook_clubname" at the database
Replacer at the template / description: "Clubname"[/b][/color]
1) In your phpwcms database there's a table called [prefix]phpwcms_guestbook. In this table you need to add a field called "guestbook_clubname", type: text
2) Edit the following file on your server /include/inc_front/content/cnt18.article.inc.php
find the following text (arround line 93):
Code: Select all
$guestbook['post']['name'] = clean_slweg(remove_unsecure_rptags($_POST['guestbook_name']));
after this add:
Code: Select all
$guestbook['post']['clubname'] = clean_slweg(remove_unsecure_rptags($_POST['guestbook_clubname']));
find the following text (arround line 269):
after this add:
Code: Select all
$guestbook['post']['clubname'] = '';
find the following text (arround line 388):
Code: Select all
$guestbook['sql'] .= "guestbook_name='".aporeplace($guestbook['post']['name'])."', ";
after this add:
Code: Select all
$guestbook['sql'] .= "guestbook_clubname='".aporeplace($guestbook['post']['clubname'])."', ";
find the following text (arround line 520):
Code: Select all
$guestbook['form'] = render_cnt_template($guestbook['form'], 'URL', html_specialchars($guestbook['post']['url']));
after this add:
Code: Select all
$guestbook['form'] = render_cnt_template($guestbook['form'], 'CLUBNAME', html_specialchars($guestbook['post']['clubname']));
find the following text (arround line 553):
Code: Select all
$guestbook['signed'] = render_cnt_template($guestbook['signed'], 'URL', html_specialchars($guestbook['post']['url']));
after this add:
Code: Select all
$guestbook['signed'] = render_cnt_template($guestbook['signed'], 'CLUBNAME', html_specialchars($guestbook['post']['clubname']));
find the following text (arround line 781):
Code: Select all
$guestbook['c'] = render_cnt_template($guestbook['c'], 'NAME', html_specialchars($guestbook['row']['guestbook_name']));
after this add:
Code: Select all
$guestbook['c'] = render_cnt_template($guestbook['c'], 'CLUBNAME', html_specialchars($guestbook['row']['guestbook_clubname']));
3. Modify guestbook-template file on your server template/inc_cntpart/guestbook/[name-of-the-file]
Modified lInes (example) at the entry-section of the template:
Code: Select all
<p style="background-color:#D7E3E2 "><strong>Guestbook HTML form and form error message <br>
</strong>{EMAIL}, {NAME}, {CLUBNAME}, {URL}, {MSG}, {CAPTCHA}</p>
and
Code: Select all
<div class="gbLine">
<div class="gbDescription"><label for="guestbook_clubname">Clubname:<span style="color:#CC3300;">*</span>:</label></div>
<input name="guestbook_clubname" type="text" id="guestbook_clubname" class="gbInputField" value="{CLUBNAME}" size="50" maxlength="500" />
</div>
Modified lInes (example) at the view-section of the template:
Code: Select all
<p style="background-color:#D7E3E2 "> <strong>Guestbook listing<br>
</strong>{EMAIL}, {NAME}, {CLUBNAME}, {URL:HTML}, {MSG}, {URL}, {ID},
{DBID}, {TIMESTAMP:FORMAT} (<a href="http://www.php.net/manual/en/function.date.php" target="_blank" style="text-decoration:underline">FORMAT = d.m.Y or H:i:s</a>)</p>
<p>
and at the section
Code: Select all
<h6>Eintrag von: {NAME} | {CLUBNAME} [URL] | <a href="{URL}" target="_blank">Website</a>[/URL][URL_ELSE][/URL_ELSE] [EMAIL] | <a href="mailto:{EMAIL}">eMail</a>[/EMAIL]</h6>
4)
For editing the new field at the backend you need to modify the following file on your server /include/inc_act/act_guestbook.php
find the following text (arround line 53):
Code: Select all
$gbname = clean_slweg(remove_unsecure_rptags($_POST['gbname']));
after this add:
Code: Select all
$gbclubname = clean_slweg(remove_unsecure_rptags($_POST['gbclubname']));
find the following text (arround line 69):
Code: Select all
$sql .= "guestbook_name='".aporeplace($gbname)."', ";
after this add:
Code: Select all
$sql .= "guestbook_clubname='".aporeplace($gbclubname)."', ";
find the following text (arround line 151 and 152):
Code: Select all
echo htmlspecialchars($row['guestbook_name']);
echo ', <br> ';
after this add:
Code: Select all
echo htmlspecialchars($row['guestbook_clubname']);
echo ', ';
find the following text (arround line 191 and 192):
Code: Select all
<tr>
<td>name: </td>
<td><input name="gbname" type="text" id="gbname" style="width:350px;" value="<?php echo htmlspecialchars($row['guestbook_name']) ?>" /></td>
</tr>
Code: Select all
after this add:
<td>clubname: </td>
<td><input name="gbclubname" type="text" id="gbclubname" style="width:350px;" value="<?php echo htmlspecialchars($row['guestbook_clubname']) ?>" /></td>
</tr>
<tr>
Hope this are all necessary modifications.
Good look,
Regard,
Ralf (novallis)