Tutorial: Create a new custom Text

Propose here your templates, your plugins or ask one.
All tutorials available for Arfooo Directory are available in this category.

Moderator: effi

Tutorial: Create a new custom Text

Postby saidbakr » Sun Jun 21, 2009 12:31 pm

Hello everyone, In this tutorial I will show you how to create a new custom text like the text of directory description and Terms of use that will be completely manged from admin -> settings -> Text.

First of all you should be familiar with phpMyadmin to be able making a change in the Arfooo database. This tutorial have a solid relation with the tutorial titled Create a new page in Arfooo Directory which is found in this forum.

The goal of this tutorial is creating a custom text titled Benefits which contains text that describes the benefits for webmasters from getting their websites listed in the directory. We will suppose that your Arfooo directory installation on localhost/arfooo/ and the database used for the installation named as arfooo without tables prefix. Let us go now:

1- In your local installtion path open the following file to edit:
arfooo\admin\templates\arfooo\menu\menuleft\menuleftSettings.tpl
The search for " <li class="text">{'Payment system'|lang}</li> " and before it place the following code
Code: Select all
<li><a href="{'/admin/setting/benefits'|url}" title="{'Benefits'|lang}">{'Benefits'|lang}</a></li>

Save the template file. You will see a new item added in admin->settings->text named by Benefits.

2- Go to the folder :
\arfooo\admin\templates\arfooo\setting
copy the file named condition.tpl and rename it to benefits.tpl then save it in this folder. Open the file benefits.tpl which is a copy of condition.tpl but with different name and do the following:
Every word in a single quote called conditions replace it with benefits. You will have to make only 4 replacements. Save the file.

3-Now we will go to edit the setting controller to make it able to deal with our new custom text. Go to the following folder:
\arfooo\admin\controllers then open the file named SettingController.php
Search for "* Save edited customMessage" after this you will find function saveEditMessageAction()
Inside this function you will see the following line of code:
Code: Select all
if(in_array($keyId, array("directoryDescription", "directoryCondition")))

Change this line to the following:
Code: Select all
if(in_array($keyId, array("directoryDescription", "directoryCondition", "directoryBenefits")))

- Then Search for the following code:
Code: Select all
/**
    * Show form to edit custom directoryCondition
    */     
    function conditionAction()
    {
        $this->set("message", $this->customMessage->findByPk("directoryCondition"));
    }

When you find it, copy it and then paste the copied text after it immediately. The replace any word Condition with Benefits and keeping the letters case. Save the file.

4- Now we will go to the language file to add new parameters for our new custom text. Go to the following folder:
\arfooo\admin\languages and then open en.php search for the following:
$language['Conditions of use'] = 'Terms of use';
after it insert $language['Benefits of use'] = 'Benefits of use';

//setting/condition
$language['Enter the conditions of use of your directory'] = 'Enter the terms of use of your directory';
after it insert
//setting/benefits
$language['Enter the benefits of use of your directory'] = 'Enter the benefits of use of your directory';

5- Now we have to modify the database. Log in your phpMyadmin and select the Arfooo installation database, we supposed it to be named arfooo, and then look for a table named custommessages, of course if you set tables prefix, you should ignore it!, Select this table by clicking on its link on the left menu of your phpMyAdmin, then, look for a field under messageId has the value directoryCondition, then, click on the edit pen link to edit this row.

Change directoryCondition field value to directoryBenefits.
In the bottom of your phpMyAdmin current window you will see on its left a drop-down list titled Save, click this list and change the value from Save to Insert as new row. Obviously, this a task for creating new row with messageId directoryBenefits and we don't want to remove directoryCondition.
After that hit the button Go which is found in the same box with described drop-down list before.

Now You have new custom text called benefits and it accessible to edit from admin->Setings->Text.

Referring to the Create a new page in Arfooo Directory you will be able to add this text to the new page by doing the following:

1- in InfoController.php change it to:
Code: Select all
class InfoController extends Controller
{
        /**
     Retrieve html content from db which describe directory benefits
    */

    function benefitsAction()
    {

        $this->set("directoryBenefits", $this->getDirectoryBenefits());
    }
   
private function getDirectoryBenefits()
    {
        $cache = Cacher::getInstance();

        if(($message = $cache->load("directoryBenefits")) === null)
        {
            $message = $this->customMessage->findByPk("directoryBenefits");
            $cache->save($message, null, null, array("custommessage"));
        }

        return $message;
    }

}


Obviously, In this example we named the new page as benefits, not partners as the other tutorial regarded. I hope this tutorial to be useful for you and I welcome with your comments about it.
Best Regards,
Said Bakr
Azzazi Anesthesia Web Directory, just another customized Arfooo directory.
دليل معمل الحياة
saidbakr
 
Posts: 66
Joined: Wed Jul 23, 2008 9:09 pm
Location: Egypt

Re: Tutorial: Create a new custom Text

Postby JereManU » Sun Mar 07, 2010 6:09 pm

Thanks, it helped me really :)
JereManU
 
Posts: 7
Joined: Sun Mar 07, 2010 5:53 pm

Re: Tutorial: Create a new custom Text

Postby saidbakr » Sun Mar 07, 2010 9:42 pm

Never mind, I'm very happy to hear that.
Best Regards,
Said Bakr
Azzazi Anesthesia Web Directory, just another customized Arfooo directory.
دليل معمل الحياة
saidbakr
 
Posts: 66
Joined: Wed Jul 23, 2008 9:09 pm
Location: Egypt


Return to Templates, plugins and tutorials

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

 
Copyright © arfooo.net  2007 - 2010  -  All rights reserved.
Arfooo website group: petites annonces gratuites   voyance en direct - tirage tarot   Consultant en référencement
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group | phpBB SEO