I have created a flexinode and then have customized the theme with node-flexinode-1.tpl.php. Each time a flexinode of this type is created it is allocated a category.

When the page is called a listing of the flexinodes associated with this type are displayed correctly, but when the user clicks on one of the items to view it in more detail, I want to have a different layout for the full details, but it is picking up the brief display I have in the node-flexinode theme.

Basically I want a teaser on the listing and then more details when viewing the items. How is this acheived?

Thanks
Bernard

Comments

gollyg’s picture

I don't know if it is the right way, but I use a conditional. You should find that one of the variables passed to your theme is $node->teaser. If this is true, we are in the short version of the story, else we are in the long version.
In my template file for the flexinode I add an if-else statement that checks the value of that variable and serves up the correct layout. Remember if you call you flexinode content yourself through php to put in a parameter in the theme function to set teaser to true or false.

if($node->teaser) { //format the teaser
  ...some code;
}
else { // format full story 
  ...other code;
}

The other thing that I have found is that flexinode doesn't pass all of the variable fields to my template. This was driving me nuts, so I added a query in my template file along the lines of:

$studies = new Array();
$result = db_query("SELECT * FROM flexinode_data WHERE nid = ".$node->nid);
while ($e = db_fetch_object($result)) {
  $studies[$e->field_id] = $e;
}

You can then check the contents by adding a temporary line of code:

print_r($studies);

This lets you access the variable using the following syntax (as an example):

$studies[7]->textual_data

But don't take my word for it - there are definitely smarter Druplers out there and most likely much more elegant ways of achieving what you need.
HTH

bernardwright’s picture

Thanks for the suggestion it has worked fine and thanks for the extra info.

Marc Bijl’s picture

Hi,

Nice topic here, exactly the information I was looking for! But now I have another problem...

Some textareas I created (i.e. flexinode type 1, field 2) are filled with paragraphs(!) of text, with the full html option turned on. However, displaying such a textarea using "print $node->flexinode_2;" it becomes just one long piece of text...

Displaying all the content at once using "print $content;" the textarea is split up into paragraphs the way it should be; but this way I can not control the way it's displayed :-\

Anyone suggestions for keeping the full html option doing it's job?

___________________
discover new oceans
lose sight of the shore

gollyg’s picture

I puzzled over that for a while - the basic problem is the filters are not being applied. You need to run the content throught the filters by using the check_output($content, intFilterType) function.
It usage, from memory, is you pass the node that contains the content as the first parameter and the id of the filter type as the second paramater. This can be found from your database table filter_format table, but will probably be 1 for filtered html and 3 for full html.
full usage would be:

print check_output($content, 1)

or substitute the 1 for a 3. Not sure what effect this has on caching/performance, but it works.

hth

Marc Bijl’s picture

At this forum, no one solved a problem of mine so quickly; many thanks mate!

___________________
discover new oceans
lose sight of the shore

gollyg’s picture

i only did it cause you have a picture of my home town Sydney on your home page ;)
thanks for the thanks, nice to be able to help out people sometimes

veelo’s picture

 print check_markup($node->flexinode_n, $node->flexinode_n_format, FALSE);

for field number n.

Bastiaan Veelo.

Marc Bijl’s picture

With some help (thanks to gollyg) I managed to setup a custom theme (node-flexinode-1.tpl.php) for flexinode type 1. Well, nearly... I can't figure out how to display the labels.

Does someone know? Thanks!

___________________
discover new oceans
lose sight of the shore

jozef’s picture

<tr>
  <td><?php $fld = flexinode_load_field(1); print $fld->label; ?></td>
  <td><?php print $node->flexinode_1 ?></td>
</tr>
Marc Bijl’s picture

Excellent, it works! Cool stuff: now I can really customize the flexinode's theme...

Thanks Jozef!
___________________
discover new oceans
lose sight of the shore

astra’s picture

It's what I want.

astra’s picture

I use field_tabel to create field 3 of flexinode type 1, and try using

print $node->flexinode_3

to output its result. But it only display text "array" without my data.

How to print out the table list of the field_table? Thanks!

oziumjinx’s picture

In regards to theming flexinodes; are you all referring to the appearance of the teaser/node itself or are you talking about theming the entire page?

Here's my scenario: I have a custom theme setup. I'd like to create a new content type and have the appearance of the teaser and actual node themed differently than the blog entries, stories, etc. but I would like the rest of the page to stay the exact same.

Is this exactly what Flexinode does?