Posted by nhoeller on August 8, 2009 at 7:23pm
4 followers
Jump to:
| Project: | InsertNode |
| Version: | 6.x-1.3 |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Alexis, from the description, your InsertNode was exactly what I was looking for. I wanted to pull in the teaser from a node and provide a link to that node if the visitor wanted more information. The 'link' option works great. Is there a way to suppress the redundant node title and node submission information when the 'teaser' option is specified?
Second question - if the previous is possible, s there a way to get the link and teaser on the same line?
Thanks, Norbert
Comments
#1
Norbert,
The teaser is displayed using a theme() call. By implementing a corresponding template you can capture the current implementation and display the teaser the way you'd like it to show up (i.e. echo $node->teaser; -- consider security though and use a format...)
And obviously you can tweak your teaser the way you want...
<?phpecho strip_tags($node->teaser), l('more...', "node/$node->nid");
?>
Thank you.
Alexis
#2
Automatically closed -- issue fixed for 2 weeks with no activity.
#3
Alexis, I was able to write CSS that suppressed the parts of the InsertNode display that I did not need. I even got the link and teaser to display on one line, but only in Firefox - Internet Explorer displayed bizarre and inconsistent formatting. Something to research further when I have some spare time (:-).
#4
Hi,
I'm trying to achieve a similar thing (i.e., display the node teaser, without the title). I get duplicate titles and would like to get rid of the one that's pulled in through insert node. All I want is to pull in the teaser text, not the title. How can I go about that? (I read #1 but am still not sure how.) Thanks for any direction you can provide.
#5
You want to also use the CCK field:
[node:123 cck=teaser;]
Thank you.
Alexis
#6
Thank you Alexis. That got the teaser to pull in without the title; however, I am using the ImageCache module as well and it is not displaying the image created for teaser view.
Is there a way to get it to show up?
Thanks.
#7
I tried
[node:123 cck=field_image; cck=teaser; ]and it worked in terms of pulling in the image as well; however the size of the image, generated by imagecache is the wrong one used. The large version is used instead of the medium version of the image, which is specified for teaser view. Any ideas on how to solve it?Thanks.
#8
Ok, I looked into it further and found a feature request at http://drupal.org/node/748696 .
It worked for me with [node:123 imagecache=field_image:medium:link; cck=teaser; ]
#9
*Note: I didn't see it mentioned anywhere in the documentation at http://www.m2osw.com/doc_insert_node_usage --not sure if I missed it? If it isn't in already, it would be good to add it as part of the "Insert Node" usage documentation. Thanks.
#10
Okay... I added a page for the imagefield (imagecache) parameter.
http://www.m2osw.com/doc-insert-node-parameter-imagefield
I guess that means everything is fixed? 8-)
Thank you.
Alexis
#11
Hi Alexis.
Thank you for adding it to the documentation.
I noticed though that the teaser version of the image links to the image instead of the node. Is there a way to link it to the node instead? The only options are "link" and "default" for the below code.
imagefield=field_photo:large:link:2Thanks.
#12
The next 6.x-1.x-dev will include a change to support "nodelink". Let me know whether that works for you.
Thank you.
Alexis Wilke
http://drupalcode.org/project/InsertNode.git/commit/6c8634b
#13
Hi Alexis,
I tried the patch but for some reason, I get the image linking to "http://www.mysite/node/", without the node id (nid). Could it be that the $node object is out of scope within the theme function?
Thanks.
#14
OK, I managed to make the $node object accessible my making some modifications, as shown below. It now returns a node but it's not the one I want though.
I made the following adjustments to the code in InsertNode.module, line 203:
Add
'node' => NULL,to the list of InsertNode_imagefield parameters.In InsertNode.page.inc, line 269, added
$node:$output .= theme('InsertNode_imagefield', $node, $filename, $imagecache_value, $type);and line 396:
function theme_InsertNode_imagefield($node, $filename, $imagecache, $type) {The image now links to the original node (i.e., the original one that was used for the node insertion into the new node). Is there a way to get it to link to the new node instead? (I am using the image in teaser view). Thanks.
#15
new_B,
Yes. Indeed. 8-)
Thank you for the info. I wrote the fix just before I saw that new message!
I suppose this is fixed then.
Note that I put the $node at the end in case some other user overloaded that function already (it would otherwise break their theme function.)
Alexis Wilke
Commit:
http://drupalcode.org/project/InsertNode.git/commit/941f3c3
#16
Thanks, Alexis. Would it be possible to make the image link to the new node instead of the original one inserted?
#17
You mean link to the node where it is being inserted?
We'd have two nodes available: the node where the image is defined and the node where the image is being inserted.
Thank you.
Alexis Wilke
#18
Yes, link to the node where it is being inserted.
#19
We can check the current path (with arg(0) = 'node' && is_numeric(arg(1))) but that's about it... We're inside a format filter and those don't automatically apply to nodes so we have no direct access to the current node otherwise.
Would that work for you? It means it wouldn't do much in case of a macro (i.e. node A inserts node B that inserts node C... such a link in B would link to A when you are on A, but to B if you go directly to B.)
#20
Sorry, Alexis. I'm not quite sure what you mean. Can you please clarify?
=> What is the purpose of the check for the current path? (*Note: I'm using pathauto/url aliases as well.)
=> Do you mean in my case, if I insert a hyperlinked imagecache preset say from nodeD into the teaser of a new node, call it nodeE, using the insertNode module, then it will link to the full version of nodeE, which is what want?
If is too much trouble, or causes other issues with linking, etc. then it is ok. I will just use 'default' for the image, and not make it linkable.
Thanks. I really appreciate your time and help.
#21
Well... actually, if you know the destination, you could just write <a href="destination">...</a> around the tag. 8-)
Anyway, a filter is applicable to many different things, not just nodes. For instance, you could use it in a block and then place that block on a page showing a view. In that case, there is no node. And I don't see the need for adding a link to a page itself.
#22
I tried
<a href="[destination]">[node:123 imagefield=field_image:medium:default]</a>but the code just gets displayed instead of being interpreted. No image displays.Thanks for the info and all your time and help.
#23
Hmmm... it could be that I skip all anchors. But if you see the anchor as is, that means you entered <a> and not <a> which happens whenever you use a WYSIWYG editor and don't edit the actual HTML code. 8-)
I think there is a system call one can use to get a link to the current page. Although, it may just have been the one to get the home page URL... I'd have to give it a quick look.
Thank you.
Alexis
#24
Thanks for all your time & help, Alexis.
I tried again and somehow, the link works now, it wasn't the WYSIWYIG issue above though...not sure what it was, possibly a syntax error somewhere.
I used
<a href="[destination]">[node:123 imagefield=field_image:medium:default;]</a>followed by
[node:123 cck=teaser;]The only thing now is that when the hyperlinked image is clicked, there's a border that goes around the whole teaser and image, instead of just the image.
#25
Images that are inside an anchor are given a blue edge by default. You have two solutions, in general:
1) Add the border="0" attribute to the img tag, which in this case is going to be difficult
2) Edit the style sheet and add
img { border: none; }
(you may also want to specify which img tag should be affected instead of all of them as shown here)
Thank you.
Alexis Wilke
P.S. Could it be that you changed the Input format filter? The default filter doesn't allow for HTML tags...
#26
No, I didn't change the input format filter. I just re-entered the code again--it must be some typo or something.
To clarify the issue with the borders showing up, it is showing up around the teaser text as well, even though the
<a href>...</a>only encloses the image. Any ideas? Thanks.