This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

advanced body attributes

I just set some code up in my template.php to give the body tag some usefull attributes on the way to get some more styling power. It is at a realy early state of development but it kinda works quite nice so far. It allthough became quite feature rich and I thought I'd share the code so far and see what others think. Maybe someone can help me optimise it a bit and I allthogh can see it in a module in the future. Heres what I got in my template.php:

<?php
function css_body_attributes( $arg, $is_front, $sidebar_left, $sidebar_right )
{
$uid = css_uid( $arg, $is_front );
$sec = css_section( $arg, $is_front );
$col = css_columns( $sidebar_left, $sidebar_right );
$usr = css_user( );
$osb = css_useragent( );
$lang = css_language( );
return 'id="'.$uid.'" class="'.$sec.' '.$col.' '.$usr.' '.$osb.'"';
}

function css_uid( $arg, $is_front )
{
if ( is_string($arg(2)) ) $body_id = $arg(0).'-'.$arg(1).'-'.$arg(2);
elseif ( is_string($arg(1)) ) $body_id = $arg(0).'-'.$arg(1);
elseif ( is_string($arg(0)) ) $body_id = $arg(0);
if ( $is_front ) { $body_id = 'front'; }
return 'page-'.$body_id;
}

function css_section( $arg, $is_front )
{
if ( $is_front ) { $body_class = 'front'; } else $body_class = $arg(0);
return 'section-'. $body_class;
}

function css_columns( $sidebar_left, $sidebar_right )
{
if ( $sidebar_left && $sidebar_right ) return 'column-both';

Customizing Final Image display page with Image module

Hi,

Probally a simple question (hopefully!) regarding the image module.

Forum module hacks.. unrolling topics!?

Hi There,

I could do with a bit of advice..

I need to make the topics in the first page of each forum indent & unroll.
Ideally I'd also like to lose the 'Replies' and 'Last Reply' column and display the originating user for each post on each line.

e.g.
Hey cool new forum ( posted by John on 01/MAY/2006 )
re: Hey cool new forum ( posted by Mandy on 01/MAY/2006 )
re: Hey cool new forum ( posted by Lars on 02/MAY/2006 )
I disagree ( posted by John on 02/MAY/2006 )

This is my plan.. please tell me if you think this is a sensible approach or if my assumptions re: how drupal/php works under the hood, are way off mark.

1) Copy the existing forum module files
2) Look through them to find the file containing (a) the bit of PHP that generate the table in question
3) Find the the (b) function/api call it uses to display the thread name
4) Make a renamed copy of this function and hack at it til it returns a formatted string as per the example above
5) Change the code in file (a) leaving just a single column
6) Change the code in file (a) so that it uses the new function.
7) Replace file (a) on my production server with the newly modified file (a)

I don't have time to learn how to write a custom module from scratch; as my php totally sucks ass this is going to be a stretch anyway! Should I be looking in forum.module? Will these mods be overwritten by future upgrades? Is there a faster/simpler way? How long might an experienced drupal developer take to do this sort of hack? I might want to pay/hire someone if it's the waking nightmare I'm expecting it to be!

Any suggestions for how to clone page.module

This sounds like a very strange request, I know, but I want to clone the page.module, changing the name to membersonly.module. This seems like the most basic solution to a problem I've been having where I want certain content restricted to (wait for it) members only. That way, when I click on create content, I can select the function that will operate exactly as a page made by page.module, but will be called something differerent.

If someone could guide me in the right direction/suggest an alternative/slap me like a fool, I would be most grateful.

Regards,

Turning off categories fieldset

Hi there,

I am building a site and generating a new node type, I followed the instructions here and almost understand what I am doing, but I am trying to remove the "Categories" fieldset.

My site will use taxonomy terms for organisation and collection, but instead of having the user explicitly navigate through the lists, I am going to obtain the terms from the node input.

Is there anyway to remove this from the add node page?

URL id

I have this code at the moment...

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions