Arfooo en français Arfooo in english

Tutorial: Create a new page in Arfooo Directory

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

Tutorial: Create a new page in Arfooo Directory

Postby Arf on Sat Aug 09, 2008 11:53 am

This tutorial will allow you to create a functional new page in your directory.
The URL of this page will even be rewritten ;)

We will create a page that will be called: partners.html.
This is of course just one example and you can give it any name you want to slightly amend a few steps.
In short, after blabla, things turn serious :D

Step 1 :
Create the following file and give this name : "InfoController.php" :

Code: Select all
<?php
//////////////////////////////////////////////////////////////////////////////////
//                copyright (c) Arfooo Annuaire                                               //
//                   by Hocine Guillaume (c) 2007 - 2008                                            //
//                   http://www.arfooo.com/                                                    //
//    Licence Creative Commons http://creativecommons.org/licenses/by/2.0/fr/                 //
//////////////////////////////////////////////////////////////////////////////////

class InfoController extends Controller
{
    function partnersAction()
    {
   
    }
   
}
?>



To create another page you can simply add a new function like that by example:

Code: Select all
class InfoController extends Controller
{
    function partnersAction()
    {
   
    }

    function otherpageAction()
    {
   
    }
   
}
?>


Step 2 :
Place this file in the folder: "controllers"

Step 3 :
We must now create a folder called "info" in the folder : templates/arfooo/
You will have this: : templates/arfooo/info

Step 4 :
Create file ".tpl" who bear the same name as the prefix function created in step 1.
We must therefore create the file "partners.tpl"
This will therefore : templates/arfooo/info/partners.tpl

Step 5 :
We must fill out the file "partners.tpl" with the following code :
I will then explain how to give a title to your new page, how to rewrite the url... :

Code: Select all
{capture assign="headData"}
<script type="text/javascript" src="{'/javascript/config'|url}"></script>
<script type="text/javascript" src="{'/javascript/core/ajax.js'|resurl}"></script>
<script type="text/javascript" src="{'/javascript/site/VisitSite.js'|resurl}"></script>
{/capture}
   
{include file="includes/header.tpl" title="{'Title page partners'|lang}"}

<div class="show_arbo">
<a href="{$setting.siteRootUrl}" class="link_showarbo">{'Directory'|lang}</a> &gt;
<a href="{'/info/partners'|url}" class="link_showarbo">{'Title page partners'|lang}</a>
</div>

<div class="title_h_1">
<h1>{'Title page partners'|lang}</h1>
</div>

<div class="column_in">
The content of your page
</div>

{include file="includes/footer.tpl"}


Step 6 :
You'll find that this code in the page :
Code: Select all
{'Title page partners'|lang}


You can then modify the code as you want, add a code of the same type, it is sufficient just to change:
Code: Select all
Title page partners


Simply then modify the code by a sentence of your choice, a word...

Step 7 :
We must therefore open the file "languages/en.php" and add the following phrase this :

Code: Select all
//new pages
$language['Title page partners'] = '';



Step 8 :
It will rewrite the url in order to access the page a nice way.
We will have access by this url : -www.yourdomain.com/directory/partners.html
The great manner :D
We must therefore open the file "config/rewrite.php"

Search this code :
Code: Select all
// SEARCH
'#^/search-p([0-9]+).html$#' => '/site/search/\1',


and after add :
Code: Select all
// PARTNERS
'#^/partners.html$#' => '/info/partners',


Search this code :
Code: Select all
'#^/webmaster/submitWebsite$#' => '/webmaster-submit-website.html',


and after add :
Code: Select all
'#^/info/partners$#' => '/partners.html',


Your page work now you can try to go on :
-www.yourdomain.com/directory/partners.html

Step 9 :
We must now create a link in the menu on the left or right so your visitors can access this page.

It will create this link in the right menu, we must open the file templates/arfooo/menu/menuright/menuright.tpl

Search this code :
Code: Select all
<div class="menuright">
<ul>
<li class="header">{'Contact'|lang}</li>
<li class="last"><a href="{'/contact'|url}" title="{'Contact form'|lang}">{'Contact form'|lang}</a></li>
</ul>
</div>


and after this code add:
Code: Select all
<div class="menuright">
<ul>
<li class="header">{'Title page partners'|lang}"}</li>
<li class="last"><a href="{'/info/partners'|url}" title="{'Title page partners'|lang}"}">{'Title page partners'|lang}"}</a></li>
</ul>
</div>


The tutorial is now finished, creating good :D
Arf
Site Admin
 
Posts: 127
Joined: Fri Mar 14, 2008 6:51 pm

Return to Templates, plugins and tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group | phpBB SEO
Copyright © arfooo.net  2007 - 2008  -  All rights reserved.
cron