PHP

Display Content for a Specific Role - Drupal

Tags:

Sometimes, is can be a requirement to only allowed a specific group of users to view some content on a page. I'm not talking about showing or hiding the entire page to a specific role.

What I am talking about is that an authenticated user sees some different or additional content than an anonymous user will see on the same page.

I recently had a requirement to do just this on a community website that I am building. I needed to show a discount Coupon Code to registered users but not to anonymous users.

A Simple PHP Watermark

With a recent requirement to protect some images with a non-destructive watermark on a Pixelpost implementation I came across the following fairly simple solution. Using PHP and mod rewrite, you can easily apply a transparent png watermark to images as they are served or "on the fly". The original image remains unmodified! You can easily change the watermark at any time by replacing the watermark image with a different image file.

There is however a downside of some additional load on the server, as each image has to be created each time it is viewed. You do also lose some quality in the image (but I have found the result to be quite acceptable).

PHP Zebra Striping

Tags:

Alternating the colour of blocks of content (or zebra striping) can make things easy on the eyes for your website visitors and enhance their overall experience on your site.

Zebra striping may be the ideal solution for separating the comments on your blog. If you are using a PHP powered website such as Wordpress (or any other PHP powered site) this is extremely simple to implement.

Let's assume that we want to add an odd and an even CSS class to alternate comments.

Syndicate content