Closed (fixed)
Project:
Service links
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Jan 2008 at 02:25 UTC
Updated:
25 May 2016 at 14:21 UTC
Jump to comment: Most recent
Comments
Comment #1
wayland76 commentedWhere have you positioned the block in the Blocks admin settings?
Do you have a link we can see?
Comment #2
apsivam commentedcannot reproduce here. can you provide more information about your setup/configuration ?
Comment #3
luke76 commentedHi
I decide the block was overkill anyway in the end and have decided to go without, just using links on nodes. The set up was drupal 5.7, on MAMP using Firefox - positioning the block at the top of the left sidebar.
Thanks for your response anyway, sorry can't be more specific, had to be honest forgotten the issue.
Comment #4
jenlamptonI was having the same problem. It turns out my issue was that the service links are designed only to show on node pages, not on views, panels, the home page, or anywhere that's not a node. I would like my users to be able to bookmark and share any page on the site, so I would like to propose a second non-node specific block for these other locations.
I tried to alter the block that was there, adding a setting for where admins wanted that block to be, but It looks like this approach won't work because the node is needed for building the links. Can we create another function that can build service links using the current url rather than relying on a node?
Jen
Comment #5
wayland76 commentedComment #6
yuriy.babenko commentedjenlampton,
I also needed the ability to bookmark the current page regardless of whether it's a node or not, so I just threw together a working solution. You will need to modify two functions in the service_links.module file:
find function service_links_block()
replace this:
with this:
find function service_links_render() - it should be the next one down
replace the function arguments with:
remove everything up to the line:
and in front of the same line place:
... and you should be good to go :)
Comment #7
giorgio79 commentedWow, thank you very much for this patch. I was getting a bit irritated by the fact that I could not see service links on my frontpage and category pages after putting it in as a block :)
Will try this solution now and I hope this gets committed to the module.
Comment #8
giorgio79 commentedI just did it, and it works except it still does not show on my frontpage :)
Any ideas?
Comment #9
wflorian commentedthis is great. but i have one problem. one a views page, it doesn't show the url alias, instead it shows taxonomy/term/6 for example. is there a possibilty to use the url alias instead? i would be really thankful if somebody could find a solution!!
florian.
EDIT: it does not matter if the page is a views page. this happens on all taxonomy term pages. on these pages the url alias is not shown with the service links, instead urls like taxonomy/term/X
Comment #10
wflorian commentedNo idea anybody??
Comment #11
jenlampton@ wflorian,
you should be able to get around this problem by using the url function... from the code above, replace this...
with this...
The url function adds all those other bits, and also checks for aliases in the system.
Please note: I have not tried this, but it should work. if it doesn't you can also try something like...
...but that should be a last resort.
Good Luck!
Jen
Comment #12
wflorian commentedHey Jen,
thank for looking at my problem.
$url = url(implode('/', $_GET));didn't work right, when using this, it just showed the url-alias without the domain-name!$url = $protocol.'://'.$_SERVER['HTTP_HOST'].base_path().drupal_get_path_alias(implode('/', $_GET));works absolutely perfect!Thank you for that!!!!
Florian.
Comment #13
jenlamptonMy concern arises because you really shouldn't ever need to tell drupal to add the protocol or the host. In fact, url is supposed to return base_path as part of it's result... did you set the $base_url variable in settings.php?
something about appending base_path to $_SERVER['HTTP_HOST'] seems wrong to me.
If it were me, I'd adjust settings.php and try to get something working with url.
Comment #14
wflorian commentedhmm i just tested the code on my localhost. maybe on my webserver the other code would also work...
Comment #15
jenlamptonWell if it's good code, it should work in both places.
What url does is take base_path() and then tack url-encoded results of drupal_get_path_alias() on to the end of it. So there's no reason that shouldn't work.
I still think your issue is around base_path, and if your links work right on your dev server without base_path returning anything, then they will certainly be broken on your live site if it does return something.
Food for thought.
Jen
Comment #16
xjessie007 commentedJust a thought, have you selected categories in Administration -> Service Links? In addition to enabling the block in Administration -> Blocks, you also have to define where you want to display the block in the Service Links config.
In regards to positioning Service Links, here is more info from other post I just wrote:
Re: i'm trying to print the service links at the top of the page, underneath the title.
There are two functions in service_links.module.
The theme_service_links_node_format() is responsible for theming the output when it is appended to the node.
The theme_service_links_block_format() function themes the content if you display it as a block.
hook_block() is where the output is passed to Drupal.
For some reason, if you enable block display, service links gets displayed at both places - appended to the node and in the sidebar block too. So, if you want to display the service links as a block but not in the sidebar but let's say at the top of the post (and you want to turn off displaying service links at the end of a node too), you need to modify these functions here a little.
Uncomment everything from inside of theme_service_links_node_format. This will stop displaying service links at the end of a node.
Because theme_service_links_block_format displays the service links as UL-LI by default which is ok for sidebar block but not very nice for a top/bottom content block, you need to modify theme_service_links_block_format. I probably did not do it the best way, but I think it was the easiest way. I used the strip_tags($a, 'div a img') function to just strip all but a, div, img HTML tags from the already themed output.
Now you just enable your block and position it to content top or whereever you like. Works fine.
Note, here are other Drupal thread related to the same or similar problem:
http://drupal.org/node/257361
http://drupal.org/node/288612
http://drupal.org/node/214939
__________________
Drupal cache clean up - cache_clear_all()
How to delete or clear Drupal cache tables?
Comment #17
joachim commented+1
subscribing.
Any chance of this being in the next release?
Comment #18
joachim commentedRegarding the url / $GET debate -- read the API docs!
url() can be made to give a complete URL including the protocol, like this:
Comment #19
fleshgrinder commentedI always had the URL
http://www.example.org/nodewithin my frontpage, so I created the following:Maybe this is useful for anyone.
Kindest regards
Fleshgrinder
Comment #20
quotientix commentedThanks fleshgrinder, your version is showing me the service links on the front page, but not on the regular nodes.
On the original module it's the other way round.
Any ideas on how to show the service links on both?
Thanks!
Comment #21
TheCrow commentedRead this issue for non-node pages and keep using the original block for node pages, or combine the two... many ways.
Comment #22
byant commentedI am newbie here,
could you tell more detail how to put this function strip_tags($a, 'div a img') to get top/bottom block work with service links?
thanks
Comment #23
okokokok commentedStill relevant today on 2.x-dev.
Comment #24
span commentedThanks you Fleshgrinder, this is a crucial issue in my opinion...together with larger icons of course :]
Thanks for a great module.
Comment #25
mark. commentedDoes anyone have any tips on how to make fleshgrinder's code work when the homepage is set to user/register?
Comment #26
Melissamcewen commentedsubscribe
Comment #27
TheCrow commentedFeature Added!
Comment #29
knalstaaf commentedComment #30
knalstaaf commentedHmm, will close this one again for tidiness sake.
Comment #31
knalstaaf commented