Skip to main content

Posts

Cache it! Solve PHP Performance Problems

<p><strong>In the good old days when building web sites was as easy as knocking up a few <a href="http://www.sitepoint.com/glossary.php?q=H#term_75" class="glossary" title="HTML stands for HyperText Markup Language.">HTML</a> pages, the delivery of a web page to a browser was a simple matter of having the web server fetch a file. A site's visitors would see its small, text-only pages almost immediately, unless they were using particularly slow modems. Once the page was downloaded, the browser would <a href="http://www.sitepoint.com/glossary.php?q=C#term_21" class="glossary" title="Cache, pronounced "cash", refes to a stored copy of (or pointers to) previously accessed data. ">cache</a> it somewhere on the local computer so that, should the page be requested again, after performing a quick check with the server to ensure the page hadn't been updated, the browser could displa...

FCKEDITOR table cell background Image implementation

Add Add <tr> <td nowrap ><span >Backgrund Image</span>:</td> <td><input id="txtUrl" style="WIDTH: 100%" type="text" onblur="UpdatePreview();"></td> <td id="tdBrowse"><input id="btnBrowse" onclick="BrowseServer();" type="button" value="Browse Server" fckLang="DlgBtnBrowseServer"></td> </tr> code in fck_tablecell.html after <tr> <td nowrap><span fckLang="DlgCellBorderColor">Border Color</span>:</td> <td> <input id="txtBorderColor" type="text" size="8" name="txtCellPadding"></td> <td> <input type="button" fckLang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Border' )"></td> </tr> and add a js file for browsing and upload the image and t...

Using PHP 4's DOM XML functions to create XML files from SQL data

Intended Audience This tutorial is intended for developers who wish to extract data from a database and insert it into XML files so that it can be processed in some way, usually by transforming it into HTML using an XSL file. This method completely splits the presentation layer (i.e. the generation of HTML documents) from the business layer (the application of business rules using a language such as PHP) so that any one of these layers can be modified without affecting the other. In the samples below the code is generic in that no column names are ever hard coded. Data is retrieved from the database as an associative array (a series of 'name=value' pairs), and every element of the array is extracted and transferred to the XML file. The contents of the associative array are therefore governed entirely by the SQL 'select' statement. In the samples below I will show how to deal with data from a single table, and then data from two tables with a one-to-many relation...