Smarty integrates overLIB with a very simple construction, {popup ... }. In the file inc.file_list.tpl, there is an example of overLIB use:
{include file='files.pop.tpl' assign='filePop'}
...
<a href="{$smarty.server.PHP_SELF}?id={$file.id}¬_crypted=1"
{popup
trigger=onClick
width=360
sticky=true
caption='Action'
closeclick=true
text=$filePop
}
>{$file.filename}</a>
...
In this code snippet, you see how you can attach an overLIB pop-up with a single instruction. You can set up all the overLIB parameters listed here and separate HTML code for pop-up in an another file, files.pop.tpl.
Beautify Your PHP Code
It is normally difficult to set a right indentation or good spacing rules during coding, and PEAR PHP_Beautifier can help a lot. Install it as follows:
pear install PHP_Beautifier
Then run this on the command line:
php_beautifier [some_file].php --output new_file.php
The new_file.php file produced will be rearranged with great improvement in readability.
Furthermore, PEAR provides a set of coding standards. With the mechanism of filters, for example, you can format your code accordingly by running this:
php_beautifier --filters "Pear()" [some_file].php --output new_file.php
Because HTML and CSS coding are not my strengths (you may have guessed that already), I looked for a method to separate presentation from logic in a small Internet file-sharing application so I could easily delegate the presentation to an experienced graphic designer. The result was a practical example of using a database abstraction layer and separating HTML design from PHP programming using open source libraries and frameworks. You can leverage my example to create an Internet file-sharing application that lets your users securely share files and classify them with tags and metadata.