Is there any links?
Yes, there is! Since the 0.1.2 version we have a LINK element inside the COL element, with these attributes:| name | mandatory | values | meaning |
| TYPE | yes | STATIC/DYNAMIC | If its STATIC, the link will follow the value inside the LINK element. If its DYNAMIC, the link will follow the value of a SQL result field. |
| TARGET | no | <target value (string)> | The target frame where the link will open. If its null, it will open on the same window where the report is. If its "_blank", for example, it will open on a new window. Check the TARGET attribute on the HTML <A HREF> element for learn more about this. |
| TITLE | no | <title value (string)> | The title value is like the "tooltip" that appears when you put your mouse over the link. |
For this sample I'll use the sales7.php file, because we'll create a new column called url with the address of a website querying the current id field of the SQL query (http://www.mysite.com/customers.php?id=<sql_id_here>), like this (remember I'm using MySQL):
select id,name,city,product,value,concat('http://www.mysite.com/customers.php?id=',id) as url from saleslog order by city,id;
The url column will have values like http://www.mysite.com/customers.php?id=1 and so on.
Now let's see sales7.xml:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE REPORT SYSTEM "PHPReport.dtd">
<REPORT>
<TITLE>Sales Report</TITLE>
<BACKGROUND_COLOR>#FFFFFF</BACKGROUND_COLOR>
<CSS>phpreports.css</CSS>
<DOCUMENT>
<FOOTER BORDER="1" CELLSPACING="0" CELLPADDING="5" WIDTH="500">
<ROW>
<COL ALIGN="RIGHT" CELLCLASS="DOCUMENT_LAYER" WIDTH="430">report total</COL>
<COL ALIGN="LEFT" CELLCLASS="DOCUMENT_LAYER" TEXTCLASS="BOLD" NUMBERFORMATEX="2" TYPE="EXPRESSION">$this->getSum("value")</COL>
</ROW>
</FOOTER>
</DOCUMENT>
<PAGE BORDER="1" SIZE="25" CELLSPACING="0" CELLPADDING="5" WIDTH="500">
<HEADER>
<ROW>
<COL COLSPAN="4" CELLCLASS="PAGE_LAYER" TEXTCLASS="BOLD">John Doe Enterprises</COL>
</ROW>
<ROW>
<COL COLSPAN="4" CELLCLASS="PAGE_LAYER" TEXTCLASS="BOLD">Sales Report</COL>
</ROW>
</HEADER>
<FOOTER>
<ROW>
<COL ALIGN="RIGHT" COLSPAN="3" CELLCLASS="PAGE_LAYER">page total</COL>
<COL ALIGN="LEFT" NUMBERFORMATEX="2" CELLCLASS="PAGE_LAYER" TEXTCLASS="BOLD" TYPE="EXPRESSION">$this->getSum("value")</COL>
</ROW>
</FOOTER>
</PAGE>
<GROUPS>
<GROUP NAME="citygroup" EXPRESSION="city">
<HEADER>
<ROW>
<COL CELLCLASS="GROUP_LAYER">
<LINK TYPE="STATIC" TITLE="search cities here" TARGET="_blank">http://www.citysearch.com</LINK>city:
</COL>
<COL CELLCLASS="GROUP_LAYER" TEXTCLASS="BOLD" TYPE="EXPRESSION" COLSPAN="3">$header->getValue("city")</COL>
</ROW>
<ROW>
<COL CELLCLASS="GROUP_LAYER">id</COL>
<COL CELLCLASS="GROUP_LAYER">name</COL>
<COL CELLCLASS="GROUP_LAYER">product</COL>
<COL CELLCLASS="GROUP_LAYER">$</COL>
</ROW>
</HEADER>
<FOOTER>
<ROW>
<COL ALIGN="RIGHT" COLSPAN="3" CELLCLASS="GROUP_LAYER">city total</COL>
<COL ALIGN="LEFT" CELLCLASS="GROUP_LAYER" TEXTCLASS="BOLD" NUMBERFORMATEX="2" TYPE="EXPRESSION">$this->getSum("value")</COL>
</ROW>
</FOOTER>
<GROUP NAME="customergroup" EXPRESSION="name">
<FOOTER>
<ROW>
<COL ALIGN="RIGHT" COLSPAN="3" CELLCLASS="GROUP_LAYER">customer total</COL>
<COL ALIGN="LEFT" CELLCLASS="GROUP_LAYER" TEXTCLASS="BOLD" NUMBERFORMATEX="2" TYPE="EXPRESSION">$this->getSum("value")</COL>
</ROW>
</FOOTER>
<FIELDS>
<ROW>
<COL CELLCLASS="GROUP_LAYER">
<LINK TYPE="DYNAMIC" TITLE="click here for more info about this customer" TARGET="_blank">url</LINK>id
</COL>
<COL CELLCLASS="GROUP_LAYER">
<LINK TYPE="STATIC" TITLE="search this customer name">http://www.mysite.com/customernames.php</LINK>name
</COL>
<COL TYPE="FIELD" CELLCLASS="GROUP_LAYER">product</COL>
<COL TYPE="FIELD" CELLCLASS="GROUP_LAYER" NUMBERFORMATEX="2">value</COL>
</ROW>
</FIELDS>
</GROUP>
</GROUP>
</GROUPS>
</REPORT>
Look the first highlighted piece of code - there is a STATIC link there, with a TITLE and a TARGET attributes.
Translating it: this link always (it's static!) will point to http://www.citysearch.com, it will open
on a new window, and everytime you put your mouse over this link a tooltip with "search cities here will
appears.The second piece of highlighted code is a DYNAMIC link - where we'll put the url SQL field value, and it will change according with the values of our database table. Noticed that there is a TITLE and a TARGET attributes there also - its behaviour is the same explained above.
The result is:

Note the underlined links there - city, id and name have it all, city and name with static ones and id changing as the customer id changes (http://www.mysite.com/customers.php?id=1,http://www.mysite.com/customers.php?id=2 and http://www.mysite.com/customers.php?id=3).