Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Mod to allow edit of the Contact Page.  (Read 1867 times)

mikec

  • Newbie
  • *
  • Karma: 0
  • Posts: 12
Mod to allow edit of the Contact Page.
« on: June 18, 2009, 07:31:03 pm »

I'm looking for a simple way of giving my client a way to update Phone/Fax/Address information on the Contact page. Currently I have hard coded these things in the snews.php file so they appear just above the form. Does anyone know of or have a mod they build that will allow me to create a function that stores this info in the DB and allows the client to edit on back end and displays on the contact page.

Thanks in advance.
Logged

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: Mod to allow edit of the Contact Page.
« Reply #1 on: June 19, 2009, 12:58:17 pm »

1- Backup your database:

2- Add new fields in your database (with sql) like this:
Quote
INSERT INTO `settings` (name, value) VALUES ('adress', '');
INSERT INTO `settings` (name, value) VALUES ('phone', '');
INSERT INTO `settings` (name, value) VALUES ('fax', '');

Add variables in lang file
Quote
$l['adress'] = 'Adress';
$l['phone'] = 'phone';
$l['fax'] = 'fax';

3- add red lines in settings function, anywhere you want:
Quote
   
echo html_input('text', 'home_sef', 'webSEF', s('home_sef') == '' ? l('home_sef') : s('home_sef'), l('a_home_sef'), '', 'onkeypress="return SEFrestrict(event);"', '', '', '', '', '', '', '', '');
echo html_input('text', 'website_description', 'wdesc', s('website_description'), l('a_description'), '', '', '', '', '', '', '', '', '', '');
echo html_input('text', 'adress', 'adress', s('adress'), l('adress'), 'text', '', '', '', '', '', '', '', '', '');
echo html_input('text', 'phone', 'phone', s('phone'), l('phone'), 'text', '', '', '', '', '', '', '', '', '');
echo html_input('text', 'fax', 'fax', s('fax'), l('fax'), 'text', '', '', '', '', '', '', '', '', '');

4-In processing function, find blue text and add red lines
Quote
if (isset($_POST['save'])) {
            $website_title = $_POST['website_title'];
            $home_sef = $_POST['home_sef'];

            $adress = $_POST['adress'];
            $phone = $_POST['phone'];
            $fax = $_POST['fax'];


5- A few lines down, find blue and add red lines
$ufield = array(
               'website_title' => $website_title,
               'home_sef' => $home_sef,

               'adress' => $adress,
               'phone' => $phone,
               'fax' => $fax,

               'website_description' => $website_description,
               'website_keywords' => $website_keywords,

6- In contact you can use as you wish
Quote
echo s('adress').'<br />;
echo s('phone').'<br />;
echo s('fax').'<br />;
Logged
Need a Job on Europe. Linkdin - Facebook / Group