PHP_Block.zip (2009-02-24) (Downloaded 31 times)
Compatible: Pro 3.5, Pro 4, and Pro 5
Author: Softpress Support
This Action may be likened to a Swiss Army knife: PHP Block allows you to define a section of a Freeway page as a block of PHP. The Freeway page may contain any number of the following items:
You can surround the PHP Block with PHP code to perform a loop. To allow this, the variable ‘$fwCount’ is created. This allows the PHP code to loop through the HTML code and rename images, image maps, and so on. This is necessary so that rollovers, image maps and similar items will function correctly when duplicated by PHP. Don’t use $fwCount for anything else.
PHP Block cannot be nested or used with any other PHP Action. A good example of the use of PHP Block is to have it work through an array of pre-sorted data.
$fwCount is used more than once in the page: once for the main data output, and again for any image maps that may be generated. You must reset your array in the ‘After Text’ field, or your PHP page may fail.
PHP Block is a destructive Action. Actions that run after it may not produce the results that are desired. Because of this, PHP Block is set to run at the ‘fwAfterEndHTML()’ line of code.
The PHPBlock Action Palette has a number of options to help you build PHP on your page.
The prompt drop-down has a list of options for you - various control loops in PHP are given. If you select None, then the text boxes will be emptied.
If you check the Advanced button, the two mark-up fields will be repaced with buttons. These give you large editable areas for you to enter more code. You should not include the delimiters. This is done for you.
If you apply the Action to a table cell, you will be prompted to choose whether the PHP code will be applied to the cell, the row or number of rows. This means that you can loop blocks of a table in PHP if you need to.
The following things should be noted: 1 - a variable, $fwCount is created. This allows the PHP to loop through and rename images, image maps etc which makes rollovers and image maps to function correctly when duplicated by PHP. Do not use $fwCount for anything else. 2 - You should reset any array in the After block of the Action’s code. This is because image maps may use dynamically created links, and you will want to pull the information out of the array in the correct order when the page is run on the server.