SubClosure

{ Don't Repeat Yourself ! }

Browsing Posts published in March, 2009

Creating a new standard object in PHP 5 is simply achieved by using stdClass:

$obj = new stdClass;

another possible way:
$obj = (object) array()

yet another – slightly more complicated method to achieve the above:

class foo {}; //must be declared on top level
$object = new foo();

It’s a bit difficult to get this information from the PHP docs.

In order to get my virtual host setup working with xampp under windows vista,
I had to add this to my virtual hosts file (c:\xampp\apache\conf\extra\httpd-vhosts.conf):


NameVirtualHost 127.0.0.1:80
< VirtualHost 127.0.0.1:80 >
DocumentRoot C:/xampp/htdocs
ServerName localhost
</VirtualHost>

after that I could then add other virtual hosts like so:


< VirtualHost alive >
ServerName alive
DocumentRoot "c:\www"
< Directory "c:\www" >
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</ Directory >
ErrorLog logs/www_error.log
LogLevel warn
CustomLog logs/www_error.log combined
</ VirtualHost >

and of course also need to change the windows hosts file and add this line:
127.0.0.1 alive.localdomain

I just realized that after doing a custom google search on my photo gallery the search results looked somewhat like this:

Best hiking photos. 1. Great North… … 78. Sunset in… 79. Walking in … 80
. Walking in … 81. Walking in … 82. Blue Tounge… 83. Flinders. …
www.allgreatwalks.com/photos/main.php?g2_itemId=267 – 18k – Cached – Similar pages

Extremely annoying.

By default Gallery2 does not seem to add any meta tags to its generated page headers, so google just displays some jibberish about some link fragments found within the document.

In order to fix that you’ll have to add some description and keyword meta tags to your pages.

Unfortunately there is no real convenient way to fix it, it only works after editing the theme.tpl file by hand.
Here is a link on how to do it:

http://chumby.net/2007/03/27/adding-meta-tags-to-gallery2/

In this article the author describes how to edit
gallery2/themes/matrix/templates/template.tpl

But actually it is
gallery2/themes/matrix/templates/theme.tpl
that needs to be changed.

Now Gallery 2 should automatically add your titles and descriptions to its meta tags.

Get Adobe Flash player