Problem: In creating a flexinode content type with a "body" textarea, the label "body" shows up (unlike the regular story content type).

What's the easiest way to suppress the label "body"but not supress other custom fields?

Sorry what seems like a simple thing...i didn't any other forum posts or documentation about this.

Comments

sangamreddi’s picture

Hi,
There are actually two ways.

add this line to css

one way
.flexinode-textarea-6 .form-item label {
display: none;
}

another way
.flexinode-textarea-6 .form-item label {
font-size: 0px;
}
use only one method
Change the textarea-6 to relavent no

Both the ways worked for me.

Sunny "The Prince"
www.gleez.com

Dextro’s picture

Fixing html with css is not a great solution. ;)

kowalke’s picture

CSS solutions don't fix RSS output, however--I cover the labels with CSS, but my RSS feeds are really ugly.

Treesong’s picture

I've included my own PHP-based solution to the problem in a new response to the original post. Scroll down a bit to see that if you want something more than a CSS solution.

The fix you provided works as a temporary hack, so thanks for the help... but it's bad/insufficient in the long run for two reasons:

(1) As a previous poster pointed out, fixing HTML flaws with CSS is generally a bad idea. RSS feeds, browser incompatibilities, etc. come into play, and it means extra processing time, bandwith, etc.

(2) Even its "success" in making the page look better is limited. Different browsers handle CSS differently. So on some browsers, "-30px" will look great, whereas others will leave it looking shabby. For example, I've tried it so far on Mozilla and Safari. It looks decent on Mozilla, but still leaves too much space on Safari.

What I'd really like to do is load the flexinode_data field called textual_area, which has the actual text without all of the random baloney that the flexinode module cruelly inserts into the node's "body" data field. But I can't figure out an elegant way of doing this.

Does anyone know how I could use the UID to grab the textual_data field directly rather than relying on the insidiously formatted $node->body ?

behindthepage’s picture

To get rid of the space left add the following to your css;

.flexinode-textarea-6 {
margin-top: -30px;
}

Margin can be adjusted until it is just right.

The only other option is to hack the module which I haven't succeeded in doing....yet.

gpdinoz

"If we see further it is because we are standing on the shoulders of giants"

Regards
Geoff

courtnee’s picture

I had to tweak the proposed fix a bit to get it working on my site, using the name (body) of the text area rather than the number:

.flexinode-body .form-item label {
display: none;
}

Cheers!

skid’s picture

your addition to my bluemarine 4.7.2 style.css file worked like a charm. :D

thanks for posting this!

Treesong’s picture

A better solution to this problem is to draw on the data contained in the textual_data field of the flexinode_data table. Here's how I did it:

    $sql = "SELECT textual_data FROM {flexinode_data} WHERE nid = $node->nid";
    $result = db_query($sql);
    $val = db_result($result);
    echo $val;

Since I'm using this method to ensure that nothing but my flexinode's body content displays when viewing such a node [no headers, sidebars, etc.], I inserted the following code at the very top of page.tpl.php:

if (arg(0) == 'node') {
  $node = node_load(array('nid' => arg(1)));
  if ($node->type == "flexinode-1") {
    $sql = "SELECT textual_data FROM {flexinode_data} WHERE nid = $node->nid";
    $result = db_query($sql);
    $val = db_result($result);
    echo $val;
    if (arg(2)) { echo $content; }
    return;
  }
}

This code checks to see if we are indeed viewing a node (Line 1). Then, loads the node's data (Line 2). Then, it determines if we are indeed viewing Flexinode Type 1 (Line 3). [You will have to change the 1 with the value of your desired flexinode.] Then, if we ARE viewing a Flexinode Type 1, it goes into the database and gets the textual_data field from the flexinode_data table. After displaying the raw data, it checks to see if there are any arguments at the end of the URL (things like "Edit", etc.), and displays the appropriate content if necessary. Finally, it "returns" so that the remainder of page.tpl.php does not execute.

When I'm viewing Flexinode Type 1, Drupal simply displays the contents of textual_data as though it were an independent/raw HTML file, then stops processing the page. The result is that Flexinode 1 is essentially a "static page" -- a page where the node's body is treated as pure HTML (or PHP, or whatever else I throw in there) without being processed by Drupal at all (no sidebars, no headers, etc.). This is helpful when you want to create a series of pages that are static, that look entirely different from the rest of your website, yet are editable using the Drupal interface. Of course, it creates the inherent security risk that someone will put malicious code in a Flexinode Type 1 node. But you can avoid this by only giving yourself permission to create such nodes (Access Permissions).

dtabach’s picture

If I understood well what you want to do, you need to write a node-flexinode-x.tpl.php. There you can choose what field's labels and field's content you will display or hide, and can apply any html/css to fit your needs.
You can see an example of this tpl.php in action here .
Read this, and search for 'node-flexinode-'.
But beware: flexinode 4.7.0 list of bugs is currently quite long...

Durval Tabach

plj’s picture

First: you find the relevant themeable function (called theme_flexinode_()) from the flexinode .inc file:

plj@system:~$ ls -l ~/www/modules/flexinode/
total 136
-rw-r--r--  1 plj www-data  5858 2005-05-10 16:12 CHANGELOG
drwxr-sr-x  2 plj www-data  4096 2005-11-08 16:45 contrib
-rw-r--r--  1 plj www-data   111 2005-05-10 16:12 CREDITS
-rw-r--r--  1 plj www-data  2550 2005-11-08 16:44 field_checkbox.inc
-rw-r--r--  1 plj www-data  3361 2005-11-08 16:44 field_file.inc
-rw-r--r--  1 plj www-data  7024 2005-11-08 16:44 field_image.inc
-rw-r--r--  1 plj www-data  3289 2005-11-08 16:44 field_select.inc
-rw-r--r--  1 plj www-data  3057 2005-11-08 16:44 field_textarea.inc
-rw-r--r--  1 plj www-data  2106 2005-11-08 16:44 field_textfield.inc
-rw-r--r--  1 plj www-data  4925 2005-11-08 16:44 field_timestamp.inc
-rw-r--r--  1 plj www-data 36395 2005-11-08 16:44 flexinode.module
-rw-r--r--  1 plj www-data  1277 2005-05-10 16:12 flexinode.mysql
-rw-r--r--  1 plj www-data  1235 2005-05-13 18:51 flexinode.pgsql
-rw-r--r--  1 plj www-data  1008 2005-05-10 16:12 INSTALL
-rw-r--r--  1 plj www-data  1253 2005-05-13 18:51 prefix1_flexinode.pgsql
-rw-r--r--  1 plj www-data 18019 2005-05-10 16:12 LICENSE.txt
-rw-r--r--  1 plj www-data  1256 2005-05-13 18:51 prefix2_flexinode.pgsql
drwxr-sr-x  2 plj www-data  4096 2005-05-10 16:12 po
-rw-r--r--  1 plj www-data  1543 2005-05-10 16:12 README.txt
plj@system:~$

In this case, I'm using textarea as an example. field_textarea.inc has the following function:

function theme_flexinode_textarea($field_id, $label, $value, $formatted_value) {
  $output = theme('form_element', $label, $formatted_value);
  $output = '<div class="flexinode-textarea-'. $field_id .'">'. $output .'</div>';
  return $output;
}

Now, you must have a template.php file in your theme's directory. If you don't, create one now. Then, insert the same function call into the said template.php, but replace “theme” with “phptemplate”:

function phptemplate_flexinode_textarea($field_id, $label, $value, $formatted_value) {
}

Finally, put anything inside the function you want, and return it. I use the return $value; as the only row in the function in my textarea setup. But using _phptemplate_callback() as a return value gives almost unlimited possibilites to customise the output.

plj’s picture

Using return $value; as I initially did at least disables <!--break-->. Perhaps it also has other potential side effects; better to use return $formatted_value; instead.