User login

string

Overriding a string the second-simplest way in Drupal 7

Here's the situation: You don't need administrator-customizable strings like the String Overrides modules provide, but you'd like the changes in a more share-able (or consistently version controlled) place than settings.php, which details an easy $conf way of doing string overrides.

Well, here's how to do it with a variable set function that can go in a module's install or update hook:

Remove a trailing slash (if any) from a string with PHP

php remove traling slash
php remove last character
http://us2.php.net/manual/en/function.rtrim.php

From a line in template.php that also takes out leading http:// to present a more human-friendly web address.

<?php
    $display = rtrim(str_replace('http://', '', $url), " /");
?>

Syndicate content