Browse | Submit A New Snippet
Snippets by category: HTML
| Snippet ID | Title | Creator |
| Snippets | ||
| 5 | util_build_select_box_from_array() | tim_perdue |
| Takes an array and converts it into an html pop-up box | ||
| 8 | AE Browser Detection | jmanstarr |
| This php script returns a series of variables that define the browser type, version, and platform by interpreting the User Agent. Use a REQUIRE or INCLUDE to incorporate this file into your pages | ||
| 20 | Random Quote Generator | transistor |
| This script selects one random quote from a MySQL database. Allows the use of HTML tags, so it can be used to display banners, images, bg images, text, links, etc. Features a marker that prevents displayed quotes to repeat themselves until all quotes have been displayed. | ||
| 21 | Prev 123 Next | scamo |
| This script will output a link list in a table with PREV 123 NEXT navigation links. The main logic is taken from Rod Kreisler's article in PHPbuilder.com. I'm a beginner at PHP programming and would like to thank Rod for the built in bugs. There's no better way to learn programming than trying to fix the mistakes of other's. No sarcasm intended. | ||
| 46 | Object HTML | mogmios |
| A set of classes that will allow you to build HTML documents completely w/ objects in PHP. This is only the most basic layer but it is easy to build onto. | ||
| 58 | OO HTML Table Generation | hermanv |
| Automatic generation of HTML for table. - Colspan, rowspan, table style, column style, cell style, and data style may all be defined. - OO interface - Simple but effective | ||
| 80 | MetaSearch | shaggy |
| A simple search through Metatags. When you've programmed a better Version contact me -> shaggy@gmx.de | ||
| 83 | Quickbar | shaggy |
| This is a combination Javascript/PHP You can jump to a Destination in a "main" Frame. | ||
| 90 | Html table tag analysis | nirvani |
| Helpful for debugging bad HTML code. This program counts the number of opening table tags and how many imbedded tables exist. | ||
| 95 | PREV_123_NEXT function | gavster |
| The logic of this function is based on the prev123next code snippet, but rewritten to return an array of links that can then be ouput anywhere on the page. Also added some boundry checking for the offset variable. Hope this is helpful, as I am somewhat new at programming. =0) | ||
| 319 | HTML function | tuxmonkey |
| Just a simple little function for those who hate going back and forth between html and PHP code. | ||
| 119 | Search the PHP-documentation off-line | watski |
| An ugly hack that searches the php-documentation. The script includes the selected/found file and makes some replacements in it so that the search form is always presented. I guess the official search engine at php.net is better, but since I only have modem access I feel reluctant to connect everytime I need to check the docs :) | ||
| 126 | Cache and Include extension for PHPLIB Templates | toma42 |
| This is an extention of the phplib class template and implements: caching of pages - store pages for X seconds before re-running the php to build the page allow of includes for template vars - this is most useful for sites migrating to phplib templates from embedded php as it allows both .ihtml and .inc files to work together in templates. | ||
| 127 | URL to Hyperlink | aram3207 |
| This function searches text for URL's and changes them into hyperlinks (http://phpbuilder.com becomes <a href=http://www.phpbuilder.com>http://www.phpbuilder.com</a>. It's especially useful for times when you don't wish to let your visitors use html in forums or other such public areas. | ||
| 1293 | Comments Form | pilotbrian0 |
| A simple Comments submission and reading system. Allows for protection of comments keeping them hidden to anyone who doesn't know the username and password. | ||
| 1307 | Parse html (title :: meta) | olaf2 |
| With this script it's possible to obtain the first part of a remote file to parse the html elements in local script. The title element, the meta description and the meta keywords are parsed while using eregi() function. Additional meta elements are possible, by adding some extra rules and regex patterns. The script reads only the first part of a remote file, until the closing tag of the html head element is passed, the result is a better performance. The script will not follow url redirections. This script is very usefull in forms to add new links to a linklist. Check the demo here: http://www.finalwebsites.com/classes/examples/get_meta_data.php | ||
| 168 | Replace a Text Are Field with a WYSIWYG editor in a browser | wroges |
| Ektron's eWebEditPro for PHP Easily replaces a HTML text area field with a WYSIWYG editor, so content contributors can create and publish their own Web content while Webmasters and IT professionals maintain control over a Web site's look and feel. We provide sample PHP code for a mini content manager. | ||
| 170 | Safe HTML | gautehk |
| Cleans up HTML by removing unwanted tags. Great when you want to allow some HTML in form content that is to be posted on a HTML page, but don't want to risk ruining the page. | ||
| 172 | Prev 123 Next Script | zjortiz |
| This script displays the records in a resultset into pages. It also displays the current page as a text, rather than a link. | ||
| 184 | Breadcrumbs navigation | reywob |
| This code will produce a useful navigation resource, showing visitors where they are in your site. This form of navigation is recommended by Jakob Nielson, and it really does make navigation less confusing. Has been tested on PHP4 - not sure if it'll work on PHP3, as I only wrote the code when my old PHP3 version stopped working when the server was upgraded. | ||
| 234 | LongDesc Page Generator | pkellum |
| A simple php page that makes adding LONGDESC pages for images much easer. Can also be used for 'd' links for images. It's extreamly simple code, took like ten minutes to write, but I thought it might be of use to someone else. Based in part on the LONGDESC page at CAST: Center for Applied Special Technology [http://cast.org/]. | ||
| 243 | HTML Template Library | marini |
| HTML template library for abstracting logic from html interfaces. Acts like your standard template library except provides for callback handlers for template variables amount some other nifty features. | ||
| 244 | Simple HTML Parser | heknat |
| First pass at a simple HTML parser. Give it a chunk of HTML, and it will call your methods for every tag it encounters. | ||
| 252 | Using Javascript and php to preview form selections | phreq |
| When a value in a drop-down box is changed, a window will open showing the user the selection. Useful for showing the effect of a selection before the form submits data to the database. | ||
| 397 | PHP Syntax Highlighter | mjewell |
| PSH highlights and indents source code using highlight configuration files (which are similar to Ultraedit highlighting files). As such, it currently supports C, C#, Java, Perl, PHP, Pascal, Lisp, Mumps, Eiffel, Euphoria, and x86 Assembler, amongst others. PSH handles line/block comments, keyword highlighting, correct indentation, and string highlighting, as well as the harvesting of comment text to allow for easy source code indexing. | ||
| 1331 | TagCloud Maker | calevans |
| PHP5 class to take an array and create a TagCloud. | ||
| 302 | alternate_row_colors() | befriend |
| Alternate row colors in rows in a table. Includes three separate versions of the function to demonstrate multiple ways to achieve same effect. | ||
| 304 | Alternate Row colors in a table (2, ulimited, gradient) | amelhedi |
| Alternate Row colors in a table (2 colors, ulimited colors, gradient, shade) don t look further if u need to put some colors in your tables or any where else this code can help you, Any comment or opinion email me | ||
| 306 | HTML Form. | exocomp |
| A simple script allowing a form to be filled and emailed to the corresponding e-mail. It has only a very simple check for certain feilds to be entered but it quite useful. | ||
| 310 | PHP formcache | drbrain |
| Persistently cache whole pages identified by their md5 hash. | ||
| 317 | XSLTransform | melvyn |
| A modification of Justin Grant's class to be compatible with the new API, in php 4.0.3 and higher. Tested on WinNT 4SP6 and BSD unix, both with Sablotron 0.52 and PHP 4.0.4pl1. Usage example is included in the comments section. | ||
| 333 | Yahoo style parent folder navigation links | tsmith |
| Include for parent folder links | ||
| 359 | Lavve-Counter | lavve |
| This counter isn't like all the other... With this You can choose if You want a image- or text-counter on Your site. | ||
| 364 | Move from one Multiple Select Box to Another | zimmer62 |
| Displays two multiple select boxes, allowing you to move items from one to the other, then submit the values of both boxes. Uses JavaScript to submit only once. | ||
| 365 | Use content from another site | mattlemon |
| This short script lets you take content from another page and embed it into your own pages. Just put the URL of the page who's contents you would like and then in the start and finish lines, find something in the original source code that you can use to mark the start and finish cut points. | ||
| 1252 | GMenu | redgeoff |
| GMenu is a highly customizable multilevel drop down menu. GMenu is written in JavaScript and is customized using CSS style sheets. Using GMenu, you can quickly create a dynamic drop down menu that: 1. Organizes your website hierarchy 2. Is stylish and interactive 3. Works in IE, Firefox, and Netscape 4. Can even drop down over form fields in IE and much more! | ||
| 374 | Random Html Pages | karita |
| Allows you to have random splash pages for your website...an example can be seen at http://specialk.cleotis.com | ||
| 454 | Form Fields | webgirl |
| This function creates a form set in tables. It makes creating a form in a table a little less of a hassle. If you have any suggestions to make this a little better please e-mail me at formfieldsphp@kewlio.com. This is not gauranteed to be perfect. | ||
| 1251 | PHP Input Filter | animachine |
| This class can filter input of stray or malicious PHP, Javascript or HTML tags and to prevent cross-site scripting (XSS) attacks. It should be used to filter input supplied by the user, such as an HTML code entered in form fields. I have tried to make this class as easy as possible to use. You have control over the filter process unlike other alternatives, and can input a string or an entire array to be cleaned (such as $_POST). | ||
| 478 | Random Image Class | einavb |
| this simple class is used to show a random image from an array of image paths. see class for usage.. | ||
| 489 | Session Management | ravenswood1000 |
| Provides session management without the use of cookies. Logs people in and out. Prevents duplicate log-ins. Forces log-out of expired sessions. Changes session variable at every webpage viewed or refreshed. Very robust. | ||
| 491 | Dynamic List Boxes | chloro |
| Two listboxes filled up with data from two related tables. As the user selects the first listbox, the second listbox changes accordingly.. This code uses mySQL and PHP as well as Javascript. The example tables will be automatically created for you but you have supply the correct database parameters.. This is my first submission to phpBuilder.. | ||
| 498 | Directory Navigation Bar | omagasohe |
| Use directories to make dynamic Navigation bars. | ||
| 508 | PHP Drop Down Menù | steo_gpi |
| PHP code that generates a DHTML Drop Down Menù. See http://www.steo.it/phpddm for demo. | ||
| 523 | HTML Templates | sezaiy |
| HTML Template language with advanced features. It supports simple variable replacements, and advanced expressions like looping, inclusion, conditioning. | ||
| 531 | Easy function to link URLs | yuppie_ony |
| I searched the net for a long time to find a bugless and short PHPfunction to easily link URLs. But most of the functions were either too long or they had two bugs: 1. When one puts the URL between single quotes ('), there is an error if the string is put in a MySQL-database by the script after the function is executed (because strings are between single quotes there) 2. When one put a full stop or question mark after the URL, the full stop or question mark is linked too. So I made my own function: | ||
| 532 | HotMAIL | lentin64 |
| This is kind of like HotMail, I just call it Hotmail because It looks like it. | ||
| 537 | Unique IP Counter | jszymczak |
| This is a pretty rudimentary way to keep track of unique hits, but It works. | ||
| 552 | Extract Links | mcrbids |
| Get all links from any web page just by specifying the URL. | ||
| 564 | untag - gets the content from any given tag | codepo8 |
| This function extracts the content from any given tag and returns it as a string or an array (if there is more than one occurance of the tag in the string). It's a bit like a step toward an xpath functionality and very good for cleaning up HTML and getting XML data. | ||
| 597 | phpMan: Unix Manual www interface | chedong |
| This is a www interface for unix man command | ||
| 1249 | Pager For Lots o' Data | agent |
| This function echo's a pager. The pager looks like this: < 1 ... 4 ... 7 8 9 10 11 ... 14 ... 17 > The ellipses are collapsed when needed. It works for any size dataset. It builds URLs that have a query parameter indicating the item (not page) number at the top of the current page. It preserves all other query parameters of the current URL. This function requires the ReplaceQueryValue function from http://www.phpbuilder.com/snippet/download.php?type=snippet&id=1923 in order to construct the queries. | ||
| 602 | PHP Weather | lentin64 |
| Gets the weather through my site and pastes it to your own site. Pretty neat! | ||
| 603 | viewman | mavetju |
| View unix man-pages with PHP | ||
| 622 | insetTable.inc.php | dmorrigan |
| This function allows you to create a table inside a table. | ||
| 626 | HTML Tags Generation ,Style Editing as Bold,italic,A,,Font | usebabu |
| Parser for Inserting HTML TAGS Adding Font Style, Font Weight,Hyperlink Can Add more Tags | ||
| 627 | HTML Tags Generation ,Style Editing as Bold,italic,A,,Font | usebabu |
| Parser for Inserting HTML TAGS Adding Font Style, Font Weight,Hyperlink Can Add more Tags | ||
| 628 | HTML Tags Generation ,Style Editing as Bold,italic,A,,Font | usebabu |
| Parser for Inserting HTML TAGS Adding Font Style, Font Weight,Hyperlink Can Add more Tags | ||
| 632 | Templates | luistena |
| Try this simple to use template manager to separate the logical part from the html part. | ||
| 639 | HTML Writer | smk_bk |
| Set of functions to generate HTML Tags such as Table, tr, html, body, etc through easy interface like Start_Table, End_Table, Start_Td, End_Td. Main advantage of this is, it can be EASILY EXPANDABLE to support any tag. | ||
| 667 | The Slasher | ldavis |
| This function removes ALL backslashes from any given variable. It should work with PHP3 and PHP4. It can be used in place of the native stripslashes() function. | ||
| 1283 | phpFaber TynyLink | phpfaber |
| By using phpFaber TinyLink you are able to create a tiny URL. Are you sick of posting URLs in emails only to have it break when sent causing the recipient to have to cut and paste it back together? Then you've come to the right place. By using this script you are able to create a tiny URL that will not break in email postings and never expires. | ||
| 695 | Display mysql restult as table | tsmith |
| Problem: Take a row from a table of images and display thumbnails x number across. Just change the value of $tds to change how many it shows across the row. | ||
| 707 | 1.11 | chedong |
| added option checker and color syntax | ||
| 721 | Integrating Ektron eWebEditPro in PHP | lethanek93 |
| Ektron eWebEditPro, the leading multi-language, browser-based, WYSIWYG Web content authoring tool offers business users a familiar editing toolbar for authoring content without needing to know HTML -- which broadens the organization's authoring base and lowers costs. With Ektron eWebEditPro, Webmasters and IT professionals maintain stylistic control over their Web content, yet they no longer need to perform simple routine editing tasks. This cross-platform tool works with leading content management solutions and all dynamic Web application servers. Replaces a text area field. The following lines will show you how to integrate Ektron's award-winning WYSIWYG editor into your site with just a few lines of code. To learn more, visit www.ektron.com | ||
| 754 | generic_url class | polysulfide |
| This is a Generic URL class, complete with to_String() for text display, and to_HTML() for generating hyperlinks. Convenient for storing and retrieving ULRs from databases. | ||
| 761 | PHP within templates | nick_p_doyle |
| Allows you to build pages from templates containing PHP (can be nested). Requires phplib's template class (template.inc) (normally installed by default I think). Some people may disagree with this class' existence, saying that the reason for templates is to separate HTML from PHP and keep HTML/frontend people out of coders' hair. Not for me. Since I do both design/HTML and PHP aspects of my project, the major benefit of templates has been a central point of control for the UI. This class means that I can modularise elements like 'search for a user' (which contain PHP) and re-use them in different pages. Since I'm working on a portal, it has the added bonus of elegantly facilitating user-customised UIs, where users could choose what elements appear where on their interface. | ||
| 765 | DbHtmlTable | eojlin |
| - constructs a customizable advance HTML <table> from SQL queries Author: - Nil Angsioco - http://www.biskwit.com/ - eojlin @ biskwit . com Key Features: - extends the HTML extended PHP functions - parses SQL query statement as main parameter - updates SQL query statement automatically - allows most simple to complex SQL queries - developed and tested under PHP 4.0.6 - supports MySQL DBMS - supports transitional XHTML - optional user-defined function(s) as parameter(s) for a more customizable record display/formatting - enable multiple instances and multiple database connections in one script - all instances have independent column sorting and pagination in a script - including a LIMIT clause in your SQL query statement will automatically enable pagination (previous - next links) Required Files: - dbhtmltable.class.php - htmlext.class.php | ||
| 789 | nbsp() - Replace whitespace with "nbsp;" | perfectom |
| If you are getting ugly tables because of strings getting split into two lines, us this to turn your whitespace into nbsp; to prevent new lines. | ||
| 791 | PHPrint | garrotte |
| Printer friendly pages from anywhere on a website. This dynamic "Print This Page" script works right out of the box - cut and paste. Has the option to leave images in the new print friendly page if required. Just link to this script, and it will give a printer friendly version of any page, whether it's a PHP, ASP, CGI, or HTML page. | ||
| 828 | FormHandling | skennedy |
| This is a simple class for handling data from forms. At the moment, it only supports the input tag with the following attributes: "text" and "radio". At the end of the file there is a short sample and description of how to use this class. | ||
| 861 | safeHTML | i3_l_t |
| I got the idea from the safeHTML snippet elsewhere in PHPbuilder. I wanted more control, and I wanted it to escape all other the extra < and >. | ||
| 866 | Another "prev 123 next" navbar | mp96brbj |
| Returns XHTML for a sequence of links á la "search results". Doesn't need a database to function; you just specify how many items there are to display, how many to display per page and what HREF the links should point to. The XHTML is easily styled with CSS. To prevent very long navbars, redundant links are removed when needed. | ||
| 874 | ASTemplate | atomm |
| ASTemplate is a powerful but easy to use template engine for PHP. It uses an XML format to specify templates, and it then links to other files specified in the root XML code. It supports looping (see documentation) which is a unique but very useful feature, especially for sites with dynamic content. | ||
| 1327 | Expose template engine | expose |
| Expose is a PHP template engine. It supports server and client-sided caching, a plugin system (to simplify common tasks like inserting a date picker) and localization (to write templates in multiple languages using external translation files). Unlike most template engines, Expose's template script language is based on PHP itself, which means you don't have to learn a new syntax. You can use most of the PHP language elements and functions the way you're familiar with. | ||
| 920 | Url to Link (it works!) | lorenz |
| This function trasforms a string (or a text) to an hyperlink. Example: my site is http://www.lolloland.com will be trasformed to: my site is <a href="http://www.lolloland.com"; target="TARGET">www.lolloland.com</a>. This function replaces a http, https or www in a text with a html A tag. It works! Belive me! | ||
| 927 | Email Address Obfuscator PHP to Javascript | spock42 |
| This little function creates a chunk of javascript based on Tim Williams' Email Obsfucator Version 2.1 It will do a pretty good job of hiding an e-mail address on a webpage on-the-fly. | ||
| 981 | The simplest HTML parsing | smoky |
| This is most simple and easy to use HTML parsing. You define your tags, and this function does the all the work. | ||
| 1226 | ListMenu | pmolchanov |
| ListMenu is a dynamic menu system designed to meet the following requirements: * handicapped accessible * standards compliant * cross-browser compatible * does not use JavaScript * does not need frames * compatible with the Dreamweaver template system ListMenu is a simple PHP Class which produces a dynamic menu from an easy to configure menu-structure text file. This menu system will work with ANY browser that accepts cookies. | ||
| 1303 | text/plain Table | benadin |
| PHP Class to build tables without tag "<table>". Usefull for building text/plain tables. | ||
| 1029 | Simple HTML Class | m_k4ml |
| This class will create the normal html table and also the table content. It also can create nested HTML table with some creativity :-) . | ||
| 1031 | HTML Toolbar Class | bjlevine |
| Here's a neat class to do a toolbar that uses imagebuttons for an HTML form. Button clicks emulate a form submit, and can also call a user supplied Javascript function. eMail me at bjlevine@hotmail.com for a bunch of 3d button images to use. | ||
| 1035 | Random HTML splashpages | karita |
| Have a random splash page at the entrance of your website. See an example at http://www.taffysmack.com | ||
| 1083 | splitHTMLcolor | zubfatal |
| A small function which takes a html colorcode e.g #ffffff and returns an array with the decimal values. I created this, because i was tired of defining seperate colors when using GDlib. This is my first submission, and I don't know how useful it will be for you guys, but here it is ;) - zubfatal | ||
| 1096 | Customized HTML tags - BBS Style | silrayn |
| this is a small, easy to understand function for use of newbies. Modelled on blog design tags. It replaces custom tags like [TAG] with content in a user-defined associative array. Full instructions are with the code. | ||
| 1098 | JavaScript -> PHP | danny66 |
| Convert JavaScript variable to PHP variable. | ||
| 1134 | OwnLinkSite Automatic link generator for adult sites | ownlinksite |
| The OwnLinkSite link engine consists of a database and some php-based scripts. The user gets access to hundreds of thousands of links to adult pick- and video- sites. Free scripts and templates make both design and daily updating a breeze. The system is particularly useful for attracting as many readers as possible. OwnLinkSite.com has a very extensive tutorial explaining how to set up use the system, and how to get a high rating by Google.</ | ||
| 1137 | Alternate row colors -simple | adrianpopa |
| Litle script for alternating row colors in html tables. | ||
| 1138 | Alternate row colors -simple | adrianpopa |
| Litle script for alternating row colors in html tables. | ||
| 1148 | XHTML doc Type Passing | andy_117 |
| A way to pass the xml doc type in a php script.... | ||
| 1345 | List posted variables from HTML form. | bfsog |
| This example is 2 files. One .htm file that contains a HYML form. The other is a PHP file which loops through all of the posted variables and displays them. Comments appreciated | ||
| 1348 | PHP function for cleaning up HTML and JavaSctipt code | jonhoo |
| This is a function for PHP scripts to clean up HTML code before outputting it. The function applies correct indentation to HTML/XHTML 1.0 and JavaScript and makes the output much more readable. You can specify the wanted indentation through the variable $indent | ||
| 1404 | Ip Ban | brentwags |
| IP BAN | ||
| 1411 | Web Search | gtscout |
| This is a script that I created for use on my intranet at work. It's really basic, it doesn't come with a lot of bells and whistles, and I realize that something bigger, (and better), has probably already been posted, but for those that can use my humble effort, I offer it up. Basically, it's just a search script that allows the user (via the form), to select which search engine they'd like to use, and then to submit a search query. That aspect of it was *really* simple, and if that's all this was, I'd probably not bother posting it. However, in an effort to emulate the behavior of Google Toolbar, I wanted the user to be able to go directly to a specific URL if they typed one in. So, by using some really basic regular expressions, the script will "sense" when someone has typed in an actual URL, and will take them to that URL instead of performing a search. That's all there is to it, and I'd warn that I'm very new to regular expressions. If there's anyone who can suggest a better one to use for URL validation, I'd really appreciate it. | ||
| 1443 | hoooplah | xbraindeadx |
| kevins trick | ||
| 1463 | Skor PHP Template | auirio |
| Skor PHP template class can assign individual variable values or arrays with several variable values. A separate sub-class extends the base class to support delimited template section replacements. | ||

