Featured Sites Mod for Links SQL 1.11

This Mod is quite specific to the needs of Run-Down, but I am presenting it here in case someone would like to do something similar for their site. You can see it in action in several steps. The Mod is set up to produce a text file of all the links that are flagged as Featured. Here is the text file, and here is the final output with the random Featured link being pulled from the text file.

1. The first step is to add a new field isFeatured to both the Links table and the Validate table in your Links SQL administration area. Here are the settings you want for the new field:

Column Name: isFeatured
Type: INT
Form Length: 1
Max Length: 1
Not Null: Yes
Default: 0
Validation: 1|0

This will set the default for links to be not featured, unless you specify otherwise.

2. To create the Featured page, follow these steps:

2a. Add &is_featured(); to sub build_all near the top of nph-build.cgi.

2b. Place the following subroutine in nph-build.cgi:

2b Source Code

I chose not to use a template to build the Featured page, but I left the code in there (commented out) in case you wish to do things differently. I believe I had the template system working before going non-template.... As you can see from the code, I set it up to build a file named featured.txt directly off the root level.

3a. Optional (if you want to make it template based): In HTML_Templates.pm, add &site_featured_template to @EXPORT near the top.

3b. Place the following subroutine in HTML_Templates.pm:

3b Source Code

3c. Lastly, create a template named featured_sites.html and place the <%featured_r%> tag somewhere in it. Format the template to the look of your site and place it in the templates directory.

4. If you want, you can also add the Featured page to the dynamic page.cgi.

4a. In page.cgi, add the following subroutine:

4a Source Code

4b. How you choose to call the Featured subroutine in page.cgi is up to you, but here is a discussion outlining the process.