This forum is for assistance with theme development.

Workaround: block translation using flexinode and i18n

Hi,

Using flexinode.module and i18n.module I have managed to create multilingual blocks.

Here's what I've done and I'm looking forward to some comments, as I want to know how useful this workaround might be and what kind of polishing it needs :) I'm not a programmer, so please keep your comments simple and understandable...

It started with my wish to have some kind of news / sidenotes / links in the sidebar of my website. Therefore I needed: title, link, date, content.

First I created a flexinode called "sidenote", which got id 2, so let's say flexinode-type 2. As flexinodes are connected with their nodedata, I already had a title and a date. Therefore I defined two additional flexinode fields: link (which was given id 16) and content (which was given id 18). Now I was able to enter the necessary content just as easy as stories, blogposts, et cetera.

Second I had to create some php for the block. Using php I wanted to take care for both logic and themeing. First time ever... But I got it done, wooohaaa! For explaining the basic idea, I will suffice with quoting my code, as the comment lines will explain the logic. I implemented this code as part of a new block, which has been made visible in the right sidebar. Now all content of type sidenote (type 2) is showed as short stories with a title, link, date and content in the right sidebar and, moreover, in the right language as well! I also added a link at the bottom of the sidebar, which links to an overview page using taxonomy terms (this part needs some polishing definitely...).

The result can be found here:

NOTE
At the bottom of the code there are a lot of comment lines; these are for future use, when I want to show certain sidenotes in certain sections, using sections.module.

As said before: I'm looking forward to some feedback, thanks in advance!

Marc


<?php

// determination of the site's language using i18n.
$site_language = _i18n_get_lang();

// definition of flexinode-type for creating content:
// - 2 = custom defined type for nodes in sidebar (sidenotes).
$flexinode_type = 2;

// defintion of flexinode-type fields providing content:
// - 16 = custom defined field for storing weblink;
// - 18 = custom defined field for storing content.
$flexinode_field_link = 16;
$flexinode_field_body = 18;

// initialization of sidebar's block.
$block_initialized = FALSE;

// query:
// selecting (flexi)node data
// where the flexinode-type is the one for sidenotes
// and the node's language is the site's language
// and the node's status is published
// sorted by date created.
$result_fn = db_query
(" SELECT *
FROM {node} n
, {flexinode_data} fn_d
, {flexinode_field} fn_f
, {flexinode_type} fn_t
WHERE fn_t.ctype_id = '$flexinode_type'
AND fn_t.ctype_id = fn_f.ctype_id
AND fn_f.field_id = fn_d.field_id
AND fn_d.nid = n.nid
AND n.language = '$site_language'
AND n.status = 1
ORDER BY n.created DESC
");

// loop for every row of the query above.
// NOTE: one node will have multiple rows,
// namely one for every flexinode field.
// rows for one node are next to each other,
// because of ordering by date and time created.
// the transition from one node to another
// will be determined by comparing:
// - $previous_node;
// - $current_node.
while ($row = db_fetch_object($result_fn))
{
if ($block_initialized == FALSE)
{
// at the start of the first loop,
// the block needs to be initialized:
// row defines $current_node and $previous_node.
$previous_node = $row->created;
$current_node = $row->created;
$block_initialized = TRUE;
}
else
{
// at the start of other loops,
// row defines $current_node only.
$current_node = $row->created;
}

if ($current_node < $previous_node)
{
// if $current_node and $previous_node are not equal,
// the query has just entered the data of another node,
// so the gathered content needs to be printed
// and $previous_node needs to be updated.
print ' ' . $titel . '' . '

A "sexy" administration interface. Is it possible?

Hei.

I'm fairly new to drupal, but have setup a couple of sites now. I really like it, but I miss something very important (in my customers eyes): A more "sexy" administrator interface with a custom look and feel. I have tried the control panel module, but this is really just a simple table with some images that link to the different administrator tasks. It's a start, but I need to:

- Customize the appearance of the "add content" forms. Changing style on the form elements etc, kan be done with CSS, but what if I want to change the order of the elements or simply create a totally different layout on the entire page containing the form? I cannot see how I can do this with themes and my current knowledge of drupal :)

- Maybe even display the entire administrator interface in a completely separate layout, making sure I can use the entire window width for editing etc. without worrying about users using a "small-width" theme which makes the FCK-editor narrow, making adding articles and other content cumbersome...

My experience with drupal so far is that once you get the hang of it, it's fast, scalable and easy to use, but every time I show it off to people I get the same response: "What's up with that evil text-based administrator menu? It looks like something made by computer engineers made for computer engineers! I want it to be more sexy to be able to enjoy using it in my day to day work!". I guess it's quite true. Remember that people are used to administrator interfaces like the ones found in mambo and seagull.

How to use primary & secondary links on any theme

Hi,

I am tying to use the links and everytime i get this error. It is happened on any selected themes which have these links. I don't know how to use them. I would appreciate if someone can help me on this and it would be helpful to have code samples if i need to any theme files.

Fatal error: Only variables can be passed by reference in /var/apache2/www/modules/system.module on line 649

Thanks

Dont get how to edit the themes

HI

Ive have used mambo, and then i could open the php templates in dreamweaver, but now with dupral i have no ide how to change the theme. Is there no program that can read the theme files?

Have an annoying bug in democratica theme

Hey folks. The site in question is here: http://unfilterednewsnetwork.com

As you can see, if there is an image in a node that is promoted to the front page, it messes up any nodes promoted below it. I have been wracking my brain trying to fix this and am no longer able to look at code to try and figure it out because my eyes just glaze over at this point.

So tell me, oh wise ones, what is it I need to change to make sure that nodes clear enough to not overlap the node below?

Deleted my admin, created same name account can't find UserID in phpMyAdmin to change

Can someone direct me to where it might be? And what to change exactly?

I need my adminship back ;)

God Bless

Pages

Subscribe with RSS Subscribe to RSS - Theme development