1-866-277-9958

PHP

Theme node body with a template file in the feature

This code can be used to add tpl.php files instead of implementing theme functions to your feature

<?php
 
/**
* Implementation of hook_theme().
* DRUPAL WONT SEE THIS HOOK UNTIL YOU CLEAR YOUR CACHE
*/
 
 
//Create myfeature-node-body.tpl.php in your feature and use $node to theme the node body
 
function myfeature_theme() {
  return array(
    'myfeature-node-body' => array(
      'template' => 'myfeature-node-body',
      'arguments' => array('node' => null),
    ),
  );
}
 
/**
 * Implementation of hook_nodeapi().
 */

Adding Customize Dashboard Magic to Your Drupal Theme

If you haven't already tried Open Atrium, you should immediately do so. Once you do, you'll want to put all their cool customize stuff into your website. While the documentation says that it uses context, spaces and features to accomplish their "whiz bang" features, they also use a few theme tricks to bind it all together.

I'm going to show you what is necessary to get your theme ready for the "Customize dashboard" functionality in openatrium.

Automated Logout with Drupal

Drupal, by default, does not support automated logouts based on inactivity. Thankfully, there is the "Automated Logout" module, which allows granular control of automated logouts. And for browser exits, there is a value you can set in your settings.php file.


Get Drupal help when you need it most! Find hundreds of great tutorials. Track, rate, comment and more. Create Account

If you enjoy our content, please consider subscribing through RSS, so you can read our posts in your application of choice.

Drupal errors "Notice: Undefined index: profile in..."

Solution: 

Ah the joy of procedural programming in a weakly typed language.

There are two issues here:
1. Drupal is reporting notices
2. Datastructure mismatches

The particular above notice is created when php tries to access a index of an array where the variable is not holding an array. In general this notice will not cause problems with Drupal functionality. You may want to turn off php reporting notices. To do this you can change php's error reporting.

In php.ini use:
error_reporting = E_ALL & ~E_NOTICE

In .htaccess user:
php_value error_reporting 2039

How do I fix Drupal's fatal error for memory size exhausted?

Problem: 

Ideally, for a memory issue, you would want to change your php settings to increase php memory allotted. In the case of most hosting providers, you do not have permissions or the ability to change the php.ini file, so here is another option:

1. Log-in to your site via FTP
2. Locate the base install of your Drupal installation - often "www" or "public_html"
3. Open/edit the .htaccess file
4. Insert the following into the .htaccess file: php_value memory_limit 96M
5. Save the file and rewrite the .htaccess file on the server
6. Most memory issues should be resolved


Drupal Web site cutover checklist

I wrote up a doc detailing Drupal related stuff that needs to be done to launch a Drupal site. Here is the info for discussion and anyone who finds this useful.


Get Drupal help when you need it most! Find hundreds of great tutorials. Track, rate, comment and more. Create Account

Expose server side data from your module for client side javascript use

Adding the following code in any PHP area in Drupal will give you settings values available client-side that you can use when writing JavaScript code.

Pass a key/value associative array to drupal_add_js() and give it type value of 'setting'. Note that I am using an array of arrays with the key of the first array as the name of the module. This is to namespace the settings. This will keep your settings from overriding others and others from overriding yours.

//PHP code in your module or in a PHP snippet anywhere on your site
 
$jquery_settings = array(
  'myModule' => array(
    'mySetting1' => 'myvalue1', 
    'mySetting2' => 'myvalue2' )
);
drupal_add_js($jquery_settings, 'setting');


Get Drupal help when you need it most! Find hundreds of great tutorials. Track, rate, comment and more. Create Account

How to keep osCommerce Session ID's on non-store pages.

Solution: 

Instead of using the standard link convetion: <a href="new-page.php">

Use the following format: <a href="<?=tep_href_link('new-page.php')?>">

If you really want to get creative and are looking at SEO specifically you can create custom pages for each product category by copying the index.php page and saving it as new-category-specific-index.php page. This page will function just like the default index.php page in osCommerce, to have the page return only the specific category you need, you'll need to use the following code:
<a href="<?=tep_href_link('new-category-specific-index.php','cPath=28')?>">

Remember to change the cPath=28 to the actual desired category or you'll get all the products.

IMCE button not showing up in TinyMCE

Solution: 

The solution is to add a function to your administrative theme's template.php file. For a complete description of the solution visit:
http://drupal.org/node/241753#comment-792305

PHP

PHP - Hypertext Preprocessor

PHP is a very common server-side scripting language most commonly run in Linux or UNIX servers it is often the p in the lamp environment. PHP can be extended through various libraries to accomplish an endless array of tasks from serving basic HTML to generating images. It powers hundreds of forums blogs e-commerce and other industry standard web applications.

Our practices:

Syndicate content
Syndicate content

©1999 - 2011 LevelTen Interactive - Dallas, TX