open source

Module: 4 Text Fields

Version: 1.3.1

Description: Have you ever needed a module a little more formatted than the WYSIWYG editor but a little less defined than some of the other modules out there? Many of my clients are not HTML savvy, but can use a web form with no problems. The attached module fills just that need. So far, I have used it for a quote board, daily specials, and a few other items. I am sure there are countless other uses for it. Change the topic and field headers in the settings page. All tags that you can use are in the header, footer, and loop fields by default. All important fields are searchable, also. I hope that this module is easy to use and you can adapt it easily to meet your needs!

Documentation: This module is very simple but also very flexible.  Install the module and add it to a page, per the WB instructions.  Click on the settings button in the upper right-hand field.  Here you can enter the subject of the list, the field names for the 4 text fields, and set some display parameters.  The last item, the RSS Active checkbox, allows you to determine whether the page will advertise to capable browsers that has an RSS feed.  This isn't to be confused with the [RSS_LINK] tag, below, which will allow you to display a hyperlink to the rss.php page visually on the page.

The fields that you can use in the header and footer sections are noted below:

  • [SUBJECT]
  • [FIELD_1_NAME]
  • [FIELD_2_NAME]
  • [FIELD_3_NAME]
  • [FIELD_4_NAME]
  • [RSS_LINK]

The fields that you can use in the loop section, in addition to the above fields, are as follows:

  • [FIELD_1]
  • [FIELD_2]
  • [FIELD_3]
  • [FIELD_4]

Some code snippets that you can use:

To randomly pick an item from the list:

 

// Select random field
$query ="SELECT * FROM"
			 . "`".TABLE_PREFIX."mod_textfields` "
			 . "WHERE active = 1 "
			 . "AND section = `{your section id}` "
			 . "ORDER BY RAND() "
			 . "LIMIT 1 ";
$query_content = $database->query($query);
$field_content = $query_content->fetchRow();

 

Then to display that item:

 

echo stripslashes($field_content['field1']);

 

Previous Versions: None.

4 Text Fields Demo

Name
4 Text Fields
Description
Have you ever needed a module a little more formatted than the WYSIWYG editor but a little less defined than some of the other modules out there? Try this great multi-purpose module on for size!
Version
v1.3.1
Link
http://www.sailsdigital.net/pages/open-source/4-text-fields.php