Closed (fixed)
Project:
Dynamic display block
Version:
6.x-1.0-rc4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Feb 2009 at 19:57 UTC
Updated:
2 Mar 2009 at 17:48 UTC
Hi,
this module is really great! Now I want just to change one little thing:
I want to link to an external page instead linking to the full node.
So I think, I can do it just in modifying the code in the template.php.
There I find the hyperlink to the full node - what do I have to do to link to a cck-field containing a webadress (e.g. field_www with value http://www.linkpage.com).
Kind regards
vistree
Comments
Comment #1
ppblaauw commentedYes, you are right. You have to change the code in the template.php file.
In the content preprocess function you change e.g.
to
with your example fieldname: field_www
Just find out what the CCK fieldname really is.
You can do this by uncommenting the debug lines (drupal_set_message or dsm)
Hope this helps you further. Please let me know.
Comment #2
vistree commentedOh yes, that it is! Thank you very much!!!
Just had to modify a little thing:
It did not work with the field_www itself, instead I got the "fields name" from the view info:
node_data_field_pager_item_text_field_www_value
So it has the same form as the other fields in your template.php-code
Thank you again
vistree
Comment #3
vistree commentedComment #5
firemountain commentedi am having trouble with this issue.
how did you set this up to work. i'm not sure how to get "view info" are you linking to a view or am i just totally looking the wrong way.
if you care to i would really apreciate a pointer,
i am trying to link within the site to a url. i made a cck field and i called it field_www, and i changed the preprocess stuff. how did you do it differnt i'm not quiet sure what you mean here.
thank you
fm
Comment #6
ppblaauw commentedIf you make a field called field_www in CCK, CCK will make an internal name for it.
Your field_www will become something like node_data_field_pager_item_text_field_www_value
This internal CCK name is what you use.
With uncommenting the drupal_set_message debug lines in the preprocess functions you can see what the names is ("view info")
Now look again at post #1.
Hope this helps you further. Please let me know.
Comment #7
vistree commentedYes, this is exactly how I solved it:
I set up a CCK-text-field (not a link!) "www" (which becomes field_www) as plain text to store the full web-address inside (e.g. http://www.drupal.org)
Then I inserted in my template.php the following code:
which is only minimal manipulated example from the original code. I just changed an filled in the following code (thanks to ppblaauw!)
This is enough to link to an external web-site instead of linking to the full node.
Hope this helps.
Nice weekend
vistree
Comment #8
firemountain commentedthank so much fro your response and help. I'm still stumped tho. I did already fill in this code goin goff what i read in the earlier posts, nothing else. I have uncommented the drupal_set_message and i have created a CCK field called www (field_www) in it i enter a web address (in my case it is another page within my site but i still write the whole address)
In the info that comes up i don't see any thing showing that it recognizes my field_www?
What happens is the read more button disapears nothing else.
you have already been so kind but please
can you help more ... what do you guys think is going on here?
Comment #9
ppblaauw commentedThe content comes from the view. The views needs to contains the fields from the content type.
You need to add the field to the view.
Hope this helps you further.
Comment #10
firemountain commentedGREAT.
ppblaauw you are so good, check out how the blocks are looking. www.citizen-2012.com
Comment #11
firemountain commentedwww.citizen-2012.com