By tinem on
return array(
0 => array('url' => value for url, 'title' => value for title, 'attributes' => value for attributes),
// You'll usually want to stop here. Provide more values
// if you want your 'default value' to be multi-valued:
1 => array('url' => value for url, 'title' => value for title, 'attributes' => value for attributes),
2 => ...
);This is what's under the the PHP code window. How is this supposed to be understood?
I have made this
return array(
0 => array('url' => "www.google.co.uk", 'title' => "link to google uk", 'attributes' => ""),
1 => array('url' => "www.google.com", 'title' => "com version", 'attributes' => ""),
2 => array('url' => "www.google.co.au", 'title' => "co.au version", 'attributes' => "")
);on a testsite http://www.tinemuller.dk/test_drupal/node/1186 and as you can see only the last link is showed. Need to make some advanced use of this CCK link with PHP code but first need to understand how to use the code, so please explain.
Comments
How many links do you have
How many links do you have the field configured for? (Fields by default are limited to 1 instance).
Thanks for your info that
Thanks for your info that helped. Now to the advanced thing which I hope somebody can help me with and I will try to explain as good as I can.
On this site I have a content type called Copenhagen where I use http://drupal.org/project/user_force_term so that when member Københavns kommune and Odense kommune and Roskilde kommune the info about the toilets are saved with the taxonomy for each and it's functioning great which you will see if you click on different links for CRUD. Now to the part I need help to:
Each kommune also have their own map which you can click to from NEW GOOGLE MAPS and Københavns kommune, Odense kommune, Roskilde kommune. From infowindow you can click on the link Make a comment and read more about this toilet hereyou will get to that special toilet with further info and from here you can link BACK to the BIG radius map clicking Hele Danmark - radius samt Flere kommuner which also is functioning from ALL 3 maps.
My problem is whenever the 3 diff. people save info from their toilets the links as you can see from this toilet http://www.tinemuller.dk/test_drupal/list/kobenhavns_kommune shows 3 links but it should ONLY show link to Københavns kommune map and on a toilet from Odense kommune there should be a link back to Odense kommune map and from Roskilde kommune a link to Roskilde kommune map. Hope you understand?
This is what I have in CCK link PHP code:
and in node-copenhagen.tpl.php:
So think in PHP code in CCK link there should be some code saying something like:
When member Københavns kommune save this content the link should be:
0 => array('url' => "node/1182?nid= ", 'title' => "Københavns kommune", 'attributes' => ""),
When member Odense kommune save this content the link should be:
1 => array('url' => "node/1183?nid=", 'title' => "Odense kommune", 'attributes' => ""),
When member Roskilde kommune save this content the link should be:
2 => array('url' => "node/1184?nid=", 'title' => "Roskilde kommune", 'attributes' => "")
AND maybe some code should also be changed in node-copenhagen.tpl.php or maybe use tid=6 which is Københavns kommune and tid=7 which is odense kommune and tid=8 which is Roskilde kommune.
I'm not a php programmer and fairly new to Drupal so can't figure out how to make this.
If you are confused about all this linking to and from the InfoWindow it's because in the maps I have this code in the top:
Maybe this site
Maybe this site http://drupal.org/node/69076 can help some of you to help me with the code to use. Think it looks a little similar to what I want but only for a link instead.
If I understand correctly you
If I understand correctly you want to replace
with
since in each case there is only one value. Note you will need to change the psuedo code for testing what they are a member of.
Thanks a lot for trying to
Thanks a lot for trying to help me I really appreciate it. I'm about going crazy figuring this out.
I'm not sure what you mean here. Do you mean that I should change ( member of Københavns kommune )? Københavns kommune, Odense kommune, Roskilde kommune is usernames.
Doesn't I need to change something in the code in this file node-copenhagen.tpl.php too?
It's only me as an admin user-1 that is aloud to see and change this info. When the 3 users enter their info in Copenhagen content they DON'T even see this link - it's made behind the scene automatically to not confuse them.
In the end there will be 98 kommuner/cities with each own map but don't mind making it like this as long as it's functioning.
Edited: 31.12.09, 14.00 Table users
uid=76 name=Københavne kommune
uid=77 name=Odense kommune
uid=78 name=Roskilde kommune
if you need this info.
The previous poster almost
The previous poster almost solved it for you, but I'm wondering if you're going about this in the right way - it would seem the normal security model in Drupal should be able to handle what you're doing.
You need a role for each commune (e.g. "Roskilde Members"), and then use a menu for the links - you can then configure the permissions on the menu items via normal Drupal configuration. Make sense ?
There will only be ONE user
There will only be ONE user for Københavns kommune, ONE for Odense kommune, ONE for Roskilde kommune and so on. They ALL have the same role which is called "Kommune editor" but when they log in they will only be able to change, delete make new toilets for the info made by themself. They should NEVER see this link and it's ONLY for admin user1 to change.
If it can't be done this way can it be done in Theming?
If it can't be done this way can it be done in Theming and if yes how?
What code in here do I need to change and to what, please?
After weeks and a lot of
After weeks and a lot of struggling I "think" I have found a solution MYSELF and are very proud if this really can be done like this but it seems to functioning the way it should now.
http://www.tinemuller.dk/test_drupal/ from the menu New Google Maps there are different maps and from each infowindow you can click to just that toilet and then again back to what map you choose. And it opens in the correct city map for this toilet.
I have used Custom links and Token and URL alias.