By awrowe on
But its one I'm not sure how to solve.
I want to create a node of only a few words in length but display it as a block on the left hand side of the page.
At first I thought I could do this with views and to be honest, I can but I'm not satisfied with the result. For a start, I don't want a title on the node, I just want it to be the words themselves.
Can CCK create something like this for me? I'm using Drupal 5.1.
Looking forward to hearing from you.
Alan Rowe
Comments
Why not use a custom block
If you visit Administer -> Site Building -> Blocks, there will be a tab labled 'Add Block'. Place the text in the box, and starting with 5.0 there is not title by default (you could add one under configure if you wanted).
Can a custom block contain content items?
I had thought about using a custom block but I'm not sure how to get the block to contain content items.
I guess what I am looking for is something like what might be considered a newsflash in Joomla!, without the title. The idea behind it is if users find something which doesn't require a full blog post but want to bring it to the attention of the rest of the site, they can use say 25 words or less to get it onto the front page.
Make sense?
Alan
There's a flip side?
Create a Menu?
Can you create a menu of items from that category or content type, or a filter on the "Most Recent" for a particular type. These are the options I have yet to look into as I want to do the same thing. Or do you only want to see all the text of the node in the block, not just a link or teaser?
So the question is when creating content, can it be assigned to a block, rather than a 'page' or node? I haven't found a way to do that.
I was thinking I could use
I was thinking I could use the CCK to create something like this and to be honest I haven't yet tried it on my testing server (which I am just about to do) but I was sure there was way I could do it without adding yet another module to my install. Perhaps using Views, which is what I tried, but without success.
I'll have a go with CCk and let you know how it works.
cheers,
Alan
There's a flip side?
A way to do it without
A way to do it without creating a custom module is to make a custom block and set its input type to php.
Then insert this code and set $nid to the node id you want to load.
If you want it to be dynamic then enter some logic in the php for how and when $nid is set to a new number.
dLd
hey very good!
I think I now need to hit the php sites to find a way of adding the logic!
php = not my strongest suit.
Thanks very much for that!
cheers,
Alan
There's a flip side?
Specific node type?
How would I implement this for a particular node type?
cheers,
Alan
You mean dynamically only
You mean dynamically only load posts of a certain type?
You'd need to get a little fancier and use some SQL.
That will get the the newest, published (status = 1) node of type, YOUR_TYPE.
dLd
Node as Block?
How about the Node as Block module (not tested)?
http://drupal.org/project/nodeasblock
That comes close
In fact it does more than that, but I need it to work for 5.1, rather than 4.7.
I used this module or something very like it in a 4.7 site I put together once, but I couldn't find anything like it for 5.x.
If I had any idea how to update a module so it would work in 5.1, I would do it, but unfortunately I don't. Anyone reading this fancy helping me out with this?
cheers,
Alan
There's a flip side?
Offhand, I'd create a new
Offhand, I'd create a new content type with nothing besides the title but a body text field. Then use Views to create a block that filters for only that the body field of that content type (don't use view type:full nodes -- use view type:list and then you can select which fields you want, excluding the title.) Display only 1 latest node. Then put the block wherever you want, with or without its own block title. [In essence, doing exactly what dldege suggests, except using Views to create that php/SQL code for you.] If you don't like the way it's themed, you can use the Contemplate module to easily change the way that content type's body text is displayed. Cheers!
Yeah, that's a good approach
Yeah, that's a good approach - I was shooting for something quick and easy that didn't require additional modules. If you need anything more then the simple block then definitely views is a good way to go or make a custom module for handling your custom types.
dLd
Perfect
That was exactly what I wanted to do, thats perfect.
I can even have more than just one of that type of content in the block and it separates the two very nicely.
Thank you very much for that!
cheers,
Alan