Results 1 to 3 of 3

Thread: Undestanding templates

  1. #1
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default Undestanding templates

    How template works

    Indexu is template driven software. It mean every html output is controlled by template files. These files contain html codes and some indexu's variables. When a .php file called, e.g. index.php, then it will find its template file (index.html). Replace indexu's variables inside it then generate html code as is the html code in its template file.

    So if you want to change your portal design (web interface), you should change template files. They're located in:

    /themes/theme_name/*

    You can also use your preferable html editor such as Macromedia Dreamweaver to create your own template files.


    Header, footer, and content section

    In template folder you'll find header.html and footer.html. These files will be loaded in every page along with the template file which .php called. For example, you run index.php, then it will generate html code from:

    - header.html
    - index.html
    - footer.html

    By using header and footer you can easily keep consistency of web design between other pages. You can also leave header and footer empty if you want have more flexibility on design. But you'll get harder to maintain pages consistency.




    Indexu's variables

    You will see indexu's variables in most every template files. Those variables will be replaced with value from database when the script running. Every variables begin with <% and ends with %>. E.g.:

    <%category%>
    <%error_msg%>


    msg.php file

    Inside template folder, you'll find a file named msg.php. If you have used v.2 or earlier, then this file is the replacement of english.php. This file contain all messages and some variables that regular template files could not handle.

    Modifying this file is easy. It's PHP code, but no more than variables assignment and comments for usage explaination. If you do not know PHP code, you still do not need to affraid to modify it. It's all well explained and very simple. Just make sure, you always ends each statement with ;

    Below is the example of code inside msg.php
    PHP Code:
    //----------- hot.php -----------

    // date format 

    $msg["10041"] = "d-M-Y";

    // hot link path template

    $msg["10042"] = "<p><b><font size=3><%category_path%></font></b></p>";



    //----------- top_rated.php -----------

    // date format

    $msg["10051"] = "d-M-Y";

    // top_rated link path template

    $msg["10052"] = "<p><b><font size=3><%category_path%></font></b></p>"
    As you see above, the message are already arranged by the file name and each have comment that explain its purpose.


    Inserting PHP code inside template files

    To gain more flexibility, you may want to insert some php code inside template files. This could usefull when you want to integrate indexu will other script such as banner management script or news grabber script. You can do this by adding <php>.....</php> tag between your php code. E.g.:

    <php>
    print @GrabNews("http://phpbuilder.com/rss_feed.php");
    </php>

  2. #2
    althahabi's Avatar
    althahabi is offline Registered User
    Join Date
    Feb 2003
    Location
    Saudi Arabia - Jeddah
    Posts
    141

    Default

    Thanx DODY

    but you have an error in the image link :

    [ http://localhost/template_region.jpg ]

    you are pointing to your localhost !

  3. #3
    reacor is offline Registered User
    Join Date
    Jan 2004
    Location
    Oregon
    Posts
    26

    Default

    thanks a lot for that!

Similar Threads

  1. Templates for sale
    By Veg in forum Templates
    Replies: 26
    Last Post: 08-09-2003, 09:41 AM
  2. Templates
    By richhead in forum v5.x
    Replies: 19
    Last Post: 07-07-2003, 03:53 AM
  3. NEW INDEXU THEME Templates
    By Hart_House in forum Templates
    Replies: 8
    Last Post: 02-27-2003, 08:36 PM
  4. NEW INDEXU THEME Templates
    By Hart_House in forum v5.x
    Replies: 8
    Last Post: 09-20-2002, 02:10 PM
  5. New Templates Question...
    By amanda in forum Templates
    Replies: 1
    Last Post: 02-05-2002, 03:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •