February 28, 2010, 7:56 PM
Not to long a go we explained how to generate a sitemap.xml with PHP.
Well, there was something missing and I think really important, to ping Google about the changes in the sitemap.
Simplest way of doing this:
file_get_contents('http://www.google.com/webmasters/sitemaps/ping?sitemap=http://yoursite.com/sitemap.xml');Remember to register your site at Google webmaster tools, since if you don’t will not work.
February 26, 2010, 5:20 PM
Imagine that you need to have an installation form for your web app.
Of course you will need to ask many things, but before you ask, what about been sure the client match all the software requirements?
Check the PHP version:
$phpversion = substr(PHP_VERSION, 0, 6);
if($phpversion >= 5.2) {
echo "Right PHP version";
}
else{
echo "No, you can't continue with the installation";
exit;
}In this example we require 5.2 at least to continue.
Check extension loaded in PHP:
if (!extension_loaded('curl')){
echo 'Not found, please proceed to install';
exit;
}
else echo 'Found';In this example we check that CURL it’s loaded.
Checking apache module installed:
if (in_array('mod_rewrite',apache_get_modules())) echo 'Found';
else echo 'Not found';In this example we check that mod_rewrite it’s loaded.
Checking folder permissions:
if(is_writable('/images')) {
echo 'OK - Writable';
}
elseif(!file_exists('/images')) {
echo 'File Not Found';
}
else {
echo 'Unwritable (check permissions, chmod 755 should fix this)';
exit;
}Checking mysql connection:
if (!mysql_connect($_POST["DB_HOST"],$_POST["DB_USER"],$_POST["DB_PASS"])){
$msg=mysql_error();
echo 'Mysql error:' .$msg;
exit;
}
else echo "connected!";February 24, 2010, 2:57 PM
Simple function to read RSS where you can set some values:
function rssReader($url,$maxItems=15,$begin="",$end=""){
$rss = simplexml_load_file($url);
$i=0;
if($rss){
$items = $rss->channel->item;
foreach($items as $item){
if($i==$maxItems) return $out;
else $out.=$begin.'<a href="'.$item->link.'" target="_blank" >'.$item->title.'</a>'.$end;
$i++;
}
}
return $out;
}Usage example:
echo '<ul>'.rssReader('http://neo22s.com/feed/',5,'<li>','</li>').'</ul>';Using cache with the class fileCache:
function rssReader($url,$maxItems=15,$cache,$begin="",$end=""){
$cache= (bool) $cache;
if ($cache){
$cacheRSS= new fileCache();//seconds and path
$out = $cacheRSS->cache($url);//getting values from cache
}else $out=false;
if (!$out) { //no values in cache
$rss = simplexml_load_file($url);
$i=0;
if($rss){
$items = $rss->channel->item;
foreach($items as $item){
if($i==$maxItems){
if ($cache) $cacheRSS->cache($url,$out);//save cache
return $out;
}
else $out.=$begin.'<a href="'.$item->link.'" target="_blank" >'.$item->title.'</a>'.$end;
$i++;
}
}
}
return $out;
}Usage example RSS with cache:
echo '<ul>'.rssReader('http://neo22s.com/feed/',5,true,'<li>','</li>').'</ul>';Based on this one from sihan: Continue reading ‘Read RSS in PHP with cache’ »
February 24, 2010, 9:42 AM
If any of you it’s currently using Dreamhost as Hosting provider, since yesterday they had made some modificataions deprecating “Options +FollowSymlinks”.
This means your site will return an 500 Error.
After talking to the support for more than 1 hour they admitted they have made changes in the policies and now we should use “Options +SymLinksIfOwnerMatch” instead.
Pretty bad communication from them and making this changes without noticing them.
If you are affected by this issue, please your .htaccess for Open Classifieds should look like this to get to work:
ErrorDocument 404 /
Options +SymLinksIfOwnerMatch
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^category/(.+) index.php?category=$1
RewriteRule ^offer/(.+) index.php?category=$1&type=0
RewriteRule ^need/(.+) index.php?category=$1&type=1
RewriteRule ^type/(.+) index.php?type=$1
RewriteRule ^publish-a-new-ad-for-free/ new/index.php
RewriteRule ^contact/ contact/index.php
RewriteRule ^privacy-policy/ privacy/index.php
RewriteRule ^sitemap/ sitemap/index.php
RewriteRule ^advanced-search/ search/index.php
RewriteRule ^map/ map/index.php
RewriteRule ^(.+)/(.+)/(.+)/(.+)$ item.php?item=$1&type=$2&category=$3&title=$4
</IfModule>
Remember that needs to be in your language.
This would be fixed for Open Classifieds 1.6.1 that is coming soon with few improvements to make your life easier.
I’m getting pretty annoyed by this hosting, since I use a Privvate Server and this things should never happen (as this other one http://j.mp/d8WVXY).
More or support for Open Classifieds in the forum.
February 18, 2010, 10:03 PM

I’ve been using WordPress for over 4 years now. I also have developed some plugins like Twitter Badge, WP-RIR, WP-PageScroll and I wrote few more thinks about it.
We can say that I’m not the average user but neither I’m a PRO developer for WP. The point is that as user I Love WordPress but from other side as technician sometimes I HATE IT.
I had a few discussions with people about the good and the bad things of WP, of course at the end for me it’s positive, but it bothers me that there’s few known issues that they should take care of and they don’t.
Anyway here’s my list with a short description.
The Love
- Easy, yep WP it’s easy and everybody knows how to use it. Great work on it.
- Community, there’s a huge community of developers and designers that releases their work for free making this software good.
- GPL, free software license, what else do you want?
- Custom, it’s pretty easy for any normal user to install plugins, themes…even change them.
- Upgrades and updates, they are automatically making your life easier, same as 1st point.
- WordCamps, this is a great idea I may say and I love it!
The Hate
- Slow, it maybe fast to you, but for me it’s a really heavy application to be a blog software. Without plugins to cache content you can’t run an instance of WP in a shared hosting….
- Data Base, this is terrible, still uses MySam, now many people will say this is an advantage, come on we are in 2010! relational data bases it’s a must have, and what about normalization?
- Download size, now a days this is no trouble, but how can be over 2MB size?
- Bugs, there’s so many WP installations that some people is trying really hard to hack this software and for instance finding bugs. Thankfully we have a great community that seems to work 24/7.
- Plugins, I love the plugins and the work from the community, but you need to be aware what you install in your WP, I know it’s not the fault of WP, but some how as they do with the themes being picky, should be with plugins testing them even just a little bit.
As conclusion I will say that they should focus to improve performance instead of adding features and more and more features….And as I said before WP it’s my favorite blogging and even CMS tool.
Last words: Thanks to the WP team and the community for the work they have done, this is just a constructive opinion meaning the best intentions.