Remove text between two HTML comments.

  • Remove text between two HTML comments.
Well, one way is to make use of assertions. By using look behind and look ahead assertions (they are not included in any matches), you can grab what is not part of them:


$tmp_tpl
= preg_replace(‘#(?<=<!–COMMENTBOX–>).+(?=<!–ENDCOMMENTBOX–>)#’, , $tmp_tpl);

Of course, to test this out, when you say echo $tmp_tpl, you won’t see anything, as these are comment tags (and thus do not display). So you would have to right-click and view source to see the ‘<!–COMMENTBOX–><!–ENDCOMMENTBOX–>’ effect.

Troubleshooting SMTP problems

SMTP or sending mail problems are common and usually easy to troubleshoot. This document will help customers troubleshoot SMTP problems on all (mt) Media Temple hosting platforms.

The first step in any troubleshooting procedure is to try to identify and recreate the problem. Use your mail program to send an email messageto a verified working address. If you receive an error message it will likely be one of the following. Please click on the one relevant to your error:

Configuring cron jobs on Windows

To setup a Windows machine to run cron.php at a specific time follow the specific instructions below. This can be useful if you are not familiar with Linux/Unix, or if your web host does not offer the ability to run cron jobs; you can run them remotely from your own computer.

Note: These instructions were written for Windows XP but should be similar in other versions of Windows. Continue reading “Configuring cron jobs on Windows”

Ubuntu Server:Install GUI and Webmin in Ubuntu 8.10 (Intrepid Ibex) Guide

http://www.ubuntugeek.com/ubuntu-serverinstall-gui-and-webmin-in-ubuntu-810-intrepid-ibex-guide.html

We have already discussed how to install ubuntu 8.10 LAMP server .If you are a new user and not familiar with command prompt you can install GUI for your ubuntu LAMP server using the 2 options

Continue reading “Ubuntu Server:Install GUI and Webmin in Ubuntu 8.10 (Intrepid Ibex) Guide”

PHP and XML Sitting in a Tree

There are scores of ways to store, work with, and retrieve data on the web. Simple databases, relational databases, XML, even custom flat files can hold our product catalogs, user information, and other repositories of important stuff that we want to share with the world. There are some logical ways to work with different kinds of data—for example, many people who use MySQL databases for storage will write PHP scripts to hook into their data, because of PHP’s native support for MySQL. On the other hand, XML purists often use XSLT(which is itself also XML) to work with their marked-up files. As web developers, it often comes down to us to make the decisions about how to store new data, and even more importantly, how to work with data that our clients give to us.

by http://www.digital-web.com/articles/php_and_xml_sitting_in_a_tree/ Continue reading “PHP and XML Sitting in a Tree”

Short If Statement in PHP

PHP – One Line If Statement – Short If Statement – Condensed If Statement

I always have to look this up, so here it is for easy reference. Sometimes is makes the code look less cluttered if you can express and if in one line.

The one line if statement is also known as the ternary operator if you want to look it up in the PHP documentation. It has also been called the short if statement and the one line if statement.

$x = ($myvalue == 10) ? "the value is 10": "the value is not 10";

In the line of code above, if the value of the variable $x is equal to 10, the string “the value is 10″ is printed out. If the value of $x is anything other than 10, the string “the value is not 10″ is printed out.