This forum is for assistance with theme development.

Getting a node access to a template variable

I have a variable ($tracking) defined in page.tpl.php . I'm trying to access this variable with code that's embedded in the body of a regular page node (input format set to PHP).

How do I get individual nodes to have access to variables defined in the template file?

Primary Links deleted from menu item but still shows up.

I had someone working on theme development and just messing around in general, and they deleted the primary links menu from the site.

Now it is still showing up as Edit Primary Links, but I can't figure out how those menu items are created since they are referred to be themes in general, and have their own variable. I tried creating a new menu item called Primary Links but this didn't replace it.

Is this a bug in the menu system or is there a simple way to fix it from within Drupal ?

How to modify the html of a block?

I'm completely new to Drupal, so forgive me if this is a newbie question (and yes, I have searched the docs and forums). Is there any easy way to modify the output of a block? For example, to change the length of the user login form text fields, or the layout of the login forms?

User page, how to change and other

Hi. Is there a way to change the user "node" (phptemplate engine) ?

Where I can change/add some text to the login page/node ?

Where I can get the form displaied in "?q=user/X/contact" (X is the uid) ?

Tnx in advance

obfuscate emails with your theme

Here's yet another way to obfuscate emails. Setting aside the question of whether it works and how long it might work, on this particular site we wanted the site-wide but weak protection that this provides. Most of the existing obfuscation techniques are parts of modules, but here the more reliable (and potentially efficient?) mechanism is to do all your obfuscation at once at the theme level. In this case, the emails were being exposed by the civicrm module in the profiles.

So here it is in two parts:

1. In the template.php file, add these two functions:


function _phptemplate_encode_mailto($mail) {
$link = 'document.write(\'' . $mail . '\');';
$js_encode = ''; for ($x = 0; $x < strlen($link); $x++) {
$js_encode .= '%' . bin2hex($link{$x});
}

$link = '

eval(unescape(\''.$js_encode.'\'))

';
$link .= ''.str_replace(array('@','.'),array(' at ',' dot '),$mail). '';
return $link;
}

function phptemplate_safemail($text) {
if (strpos($text, '@') === FALSE)
return $text;
// Split at and so that we can avoid encoding addresses in link text.
$t = preg_replace(":( $a = explode("\001", $t);
$n = count($a);

for ($i = 0; $i < $n; ++$i) {
if (preg_match('/^(]*)mailto:([^@]+@[-.a-z0-9]+)(.*)/i', $a[$i], $m)) {

Does profile_load_profile not work anymore?

Have a sticky problemI can't work out.

the following used to work perfectly before for extracting and displaying a particular profile field in a block/node.tpl.php/php page...but it won't work for me with Drupal 4.6.6.

<?php global $user ;?>
<?php profile_load_profile($user->uid); ?>
<?php print $user->profile_companyname; ?>

Anyone any ideas? did a quick search to see if there were any notices about a change in how Drupal works.

Phil

Pages

Subscribe with RSS Subscribe to RSS - Theme development