Working with the 'master_select' field

This field allows for input of MySQL queries. You may use available markup in this field to add dynamic functionality to your blocks.

Step 1 Write your sql statement

Step 2 Recall selected (from above) fields using ((-field_name-)) within inside the block_content field.

This means you can easily create structures in which to display records by placing markup inside of html elements (such as a table, or list item)

Managing your Record Loop

Now you are wondering how do you easily enter a 'static' non-looping elements to a record with a master_select. Easy

'No loop' markup

'(start(' and ')start)'

Put html code between these two tags to prevent its duplication.

'(stop(' and ')stop)'

This is for static elements that appear after the records have been displayed

Example

Master Select

SELECT * from blog_table
fields: id,content,date_created

Block Content

(start(

<p>Here is my blog</p>

)start)

<ul><li>((id))</li><li>((content))</li><li>((date_created))</li></ul>

(stop(

<p>Those are my entries.</p>

)stop)

URL Variables

When someone enters a url a variable is created that can be referenced in most fields. You can reference the most immediate user input after the / of a site (www.site.com/here) by using (!(0)!), if a user enters something after that, you can reference that variable by entering (!(1)!). Use of these variables in conjuction with a master_select statement will allow you to incorporate even more functionality to your site.

Please enclose all values in single quotes ('') in select statements for non-numerical values.

The New (!!) Construct

This construct can be used in the master_select field to define a fallback select statement if a dynamic url variable "(!(0)!)" is not provided for the block. If your single dynamic variable is not called on a page, the alternative statement will be run.

Custom Markup

Adding custom markup is as easy as editing system/config.php.

Format

$user_var['-string to replace-'] = '-replace with-'

This markup is self explanatory. Simply create a new array designator in the format listed above. You may want to use a non-character ('[' and ']') for the beginning and ending of your markup to avoid selection errors.

$user_var['[word]'] = "wordy";

This statement will search for occurrences of [word] and will replace them with "wordy".