PHP
Simple Template Engine - your lightweight templating engine in PHP
Monday, February 2nd, 2009The Simple Template Engine is a very lightweight template engine to use in PHP if your webhost does not allow you to run something like Smarty. It is simple, lightweight and fast.
To parse a file:
<?php
// include simple template engine
include(“tpl.class.php”);
$tpl = new template();
$tpl->assign(Array(‘content’=>“Hello World from Simple Template Engine!”));
// If you want to display it directly
$tpl->display(‘example.tpl’);
// If you want to send it to another function/class for more processing
some_function($tpl->parse(‘example.tpl’));
?>
example.tpl is:
<html><head><title>{content}</title></head><body><h1>{content}</h1></body></html>
If you found this article useful or helpful, please help Compdigitec spread the word. Don’t forget to subscribe [...]
Set of patches to allow PHP-GTK2 to compile with PHP6 (incomplete)
Saturday, January 24th, 2009If you try to compile PHP-GTK 2.0.1 with PHP 6 (available at the Compdigitec Packaging Department), you will need a series of patches to allow it to compile with PHP 6 because the PHP-GTK generator does not like PHP 6. Here are a set of (incomplete, missing main/phpg_support.c) patches for the PHP-GTK2 generator:
ext/gtk/gen_atk.c - patch, [...]
How to build a CLI interpreter of PHP in Linux
Friday, January 23rd, 2009After you have installed the related development packages (eg libmysqlclient15-dev for MySQL support), configure PHP with the following options:
‐‐prefix=/usr ‐‐enable-debug ‐‐with-openssl ‐‐with-zlib ‐‐with-curl ‐‐enable-ftp ‐‐with-gettext ‐‐with-mhash ‐‐with-mysql ‐‐enable-sockets ‐‐enable-soap ‐‐with-tidy ‐‐enable-zip ‐‐with-xsl ‐‐disable-cgi
If you found this article helpful or useful, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more [...]
Binary packages: PHP CLI 5.2.8 and PHP-GTK 2.0.1
Wednesday, January 14th, 2009Update (2009-05-18): libglade support is not included with this package. It has been deprecated and will soon be replaced with GtkBuilder (coming soon).
If you happen to need a clean CLI package of the latest PHP and a copy of a clean PHP-GTK 2 package, we have compiled a .deb (for Debian, Ubuntu and derivatives) binary [...]
Patch for phpGladeTool
Saturday, January 10th, 2009Although phpGladeTool is a very good tool to generate PHP from glade interfaces, it has many bugs that makes it run slowly and unstable. Below is a patch to phpGladeTool to fix some of the bugs. Keep in mind that this is only a small patch and that it does not fix all the bugs.
Patch [...]
Disable the jump box of the FAQ in phpBB 3
Saturday, December 20th, 2008If you think that the “jump to” box at the bottom of the FAQ in the phpBB 3 package is annoying or unessesary, you can use this article to disable it in four easy steps.
Download faq.php from your phpBB3 installation.
Open it with a text editor.
Comment out (add a #) line 170 (“make_jumpbox(append_sid(”{$phpbb_root_path}viewforum.$phpEx”));”).
Reupload and you’re done! [...]
phpBB force login hack
Tuesday, December 16th, 2008To set up a private forum in phpBB, you could simply make all the forums “No Access” to guests and bots. But if they can still view your member list and profiles, that is a security leak. Here is a patch to remedy that by forcing the guest or bot to login before they can [...]
Simple timer script for command-line PHP
Wednesday, November 12th, 2008Are you looking for a simple timer script written in command-line PHP? If so, here is one pre-written (released under the GPL v2 or later):
<?php
define(“endl”,“\n”);
// Timer script
if($argv[1] == “”) {
echo “Usage: ”.$argv[0].“ minutes”.endl;
die();
}
$dtime = strtotime(“+”.$argv[1].“ minute”);
while(true) {
echo “Enter to check time: ”;
$tt = fgets(STDIN);
$i = date(“i”,$dtime-time());
$s = date(“s”,$dtime-time());
echo “$i minutes, $s seconds”.endl;
}
?>
Usage: When launching use first parameter as number or minutes to count (0-59 min). Press enter to check the [...]
Allowing shorter passwords in AutoIndex
Thursday, October 30th, 2008If you’ve ever found AutoIndex PHP Script’s password valiator’s resrictions on a long password annoying, you’re not alone. Fortunately, we have found a workaround for it.
Steps
Download the AutoIndex script.
Extract the archive and open classes/Admin.php
Find the line that says “private static function validate_new_password($pass1, $pass2)“.
Move further down to the line that says “if (strlen($pass1) < ” and:
Change [...]
SimpleXML - solution for XML manipulation in PHP
Sunday, September 7th, 2008If you ever do get the need to manipulate (read/write) XML, you could try using the PHP DOM API, but it’s very difficult to use the DOM. An good extension-less way to access and manipulate XML instead is SimpleXML. It’s very easy to use compared to DOM and features a easy way to access attributes [...]
« Previous Entries