Menu Content/Inhalt
Home arrow Tutorials arrow Feline Linx 0.5a Setup

Community

BetaBoard
Links

Programming

Downloads
Tutorials

Login

Welcome, Guest. Please login or register.
May 22, 2013, 04:22:13 AM
Username: Password:
Login with username, password and session length

Forgot your password?

Events

April 2013 May 2013 June 2013
Wednesday, May 22, 2013
Random Picture (.thumb_dusk2s.jpg)
Su Mo Tu We Th Fr Sa
Week 18 1 2 3 4
Week 19 5 6 7 8 9 10 11
Week 20 12 13 14 15 16 17 18
Week 21 19 20 21 22 23 24 25
Week 22 26 27 28 29 30 31

Site Stats

Members: 1059
News: 169
Web Links: 60
Visitors: 11027514
Feline Linx 0.5a Setup PDF Print E-mail
Written by Scott Anderson   
Sunday, 18 March 2001
Article Index
Feline Linx 0.5a Setup
Setting Up the Database
How to customize the templates

Finally, how to customize the templates

The beauty of Feline Linx is that all the pages displayed to the user are easily customizable, requiring only the knowledge of HTML. This allows for seamless integration into you existing website. We don't require those ugly marketing links at the bottom of your page that interfere with your sites design. I only ask that you leave the example link that is included within the database setup file. So enough about the advantages of using Feline Linx, let us now get down to the nitty gritty of customizing the templates.

The templates are loaded and output using the HTML::Template module, slightly modified. This allows for easy display of information and very customizable pages. Each template has it's own set of variables that are used to display the different pieces of information about the links and also to make it easier to display certain control features.

Template Variables

A template variable, though it sound complex, is actually just a fancy HTML comment tag. What the template module does is replace the HTML comment with text that the program outputs. This way something that needs to be dynamically generated, like a link to a website, can very easily be done. There are several different types of template variables also. Each template uses a combination of several. List below are the types used and a short description of how they work.

<!--TMPL_LOOP NAME="" --> & <!-- /TMPL_LOOP -->

A template loop variable will continually repeat whatever is written between the end of the TMPL_LOOP and the start of the /TMPL_LOOP variables. This is very handy when building a table to display something, such as links. <!-- TMPL_IF NAME="" --> & <!-- /TMPL_IF --> The template if variable will only display what is written between the end of the TMPL_IF and the start of the /TMPL_IF, if the variable associated with the value of 'NAME' is true. <!-- TMPL_ELSE NAME="" --> & <!-- /TMPL_ELSE --> Likewise, the TMPL_ELSE variable will only display what is written between the end of the TMPL_ELSE and the start of the /TMPL_ELSE, only if a previos TMPL_IF variable was found to be false. This is useful when trying to sort out a link categories from actual links. <!-- TMPL_VAR NAME="" --> A simple TMPL_VAR just gets replaced with the value of the matching 'NAME' variable within the program.

Main Menu Template

When you first load the program into you browser, the page that is displayed is the main menu template (default filename of feline_main.tmpl). There are several sections separated by HTML comments that show how the template variables display their HTML. This template requires that you use a template loop named 'linkContent' in order to build the html for each category and link item. Within this loop is a template if name 'linkCategory' and a template else following that. Each section plays an important role, so Follow along carefully.

Each link and category is store in the 'linkContent' loop variable. As the template module iterates over the variable, it goes through the text within the beginning and end tags. To extract the category information, you use the template 'if' variable named 'linkCategory'. If that particular iteration contains a link category it will use the contained text within the start and end 'if' variable tags. Alternatively, if the iteration contains link information, the template module moves down to the 'else' variable and uses the text within it's start and end tags.

Now, to display information within these 'if' and 'else' variables, you will need to know a couple more template variables. The only variable you need to know within the template 'if' variable is the 'linkCategory' (that's right, the same as the template 'if' variable). This will be replaced with the text of the name of the link category, so you can add any HTML tag around it without any problem. Within the 'else' variable though, it is a different story.

There are a lot more variable available to you from within the 'else' variable, and this is due in part to the amount of information stored about each link. The following list details each variable available and what it will display:

linkHTML Will automatically create the proper HTML to display the link for the user to click. This also includes the proper format to log each click on a link. description Shows the text of the description of that particular link, this way can include any HTML around it that you please. title Displays the title text of the link that it's associated with. hits Indicates the number of times a link has been visited since it was added to the database. created Shows the day of the week, the number of the day, and the year that the link was added to the database. linkCategoryLinks Prints a simple contents list that is linked to the category titles so that on a long list of links, it is easy to navigate to different categories quickly. addLink Produces a link that, when clicked, will Send the user to the add a link page in order to allow them to add a link to the database. message Is replaced by the success message sent back to the user after adding one of their links to the database.

Add a Link Template

The template used to add a link to the database is a little simpler to setup than the main menu. There is only one template variable that is used, which is the 'linkCategory' variable once again. This time it will create a drop down menu used to select the category a link should be added to. The most important items within this template though, are the input field 'name' attributes within the sample template. To setup the template, you should only need to make sure the action the form is submitted to is the correct path and filename and that all form fields included within the sample template are maintained. Other than those few things, you can pretty much do anything else you like to this template. All the required values of the 'name' attributes for the input fields are list below, along with the type of input field and a short description of what each input field represents.

title

Type: text
The title that will be displayed on the main link page of the added link.

url

Type: text
The url of the link that is to be addd to the database.

description

Type: textarea
The text of the description of the link being added.

email

Type: text
The text of the email address to the user adding the link.

user

Type: text
The text of the name of the user adding the link to the database.

addnew

Type: submit
The button used to submit the entered information into the database.

Comments
Add NewSearchRSS
Only registered users can write comments!
User Rating: / 0 PoorBest