I'm getting following messages when displaying service links rendered in a node template, but only on the return page AFTER a Service Link "Send To Friend" request has been submitted:
Notice: Undefined property: stdClass::$service_links_rendered in include() (line 7 of /home/raretear/public_html/sites/all/themes/raretearepublic/templates/node--product.tpl.php).
In line 7 I have tried all manner of print statements, all produce the same result.
<?php print render($content['service_links']); ?><br>
<?php print $node->service_links_rendered; ?><br>
<?php print $service_links_rendered; ?>According to this page: http://drupal.org/node/949406, service_links_rendered is a variable that should be available in node templates.
The page and service links render fine initially, it's only AFTER Service Links returns to the page after submitting a "Send to Friend" request through Service Links that the Notice shows up.
What do I need to change my print statement to in order for this message to not show up?
Thanks in advance.
Comments
Comment #1
TheCrow commentedusing
print (isset($node->service_links_rendered) ? $node->service_links_rendered : '');or
print (isset($service_links_rendered ? $service_links_rendered : '');should go well, just clean the cache after apply it.
Comment #2
TheCrow commentedComment #3
botrisTo display the links in my node.tpl.php I use:
print $node->service_links_rendered;This works fine for the visitor, but if I clean my cache I get the same error:
Notice: Undefined property: stdClass::$service_links_rendered in include() (line 97 of /Applications/MAMP/htdocs/website/sites/all/themes/mytheme/templates/nodes/node--product.tpl.php)Comment #4
TheCrow commentedwhat about #1 ?
Comment #5
botrisTried that but can't get it working with the render() function.
Comment #6
TheCrow commentedcan you post the code here?
Comment #7
botrisIn node--product.tpl.php:
print $node->service_links_rendered;Works for visitor but gives error:
Notice: Undefined property: stdClass::$service_links_rendered in include() (line 97 of /Applications/MAMP/htdocs/website/sites/all/themes/mytheme/templates/nodes/node--product.tpl.php)print render($node['service_links_rendered']);Does not work at all, nor does:
print render($node['service_links']);Comment #8
TheCrow commentedremember to enable SErvice Links also for you nodes "Product"
Comment #9
digital fire commentedI tried all of the above and nothing has worked. I also have service enabled for my products.
I should also mentioned that I was never able to get the service links working by calling it via its own var. I was only able to get them to show up by populating the links for the node.
Comment #10
digital fire commentedAlso, I read in another thread that adding the preprocessing in template.php isnt necessary anymore.
Is this correct?
I added it to theme's template filing using my product node type 'just in case' although from what I read this isn't required anymore.
Comment #11
digital fire commentedAnother issue, I'm running into a cross browser compatibility problem when calling the $content["links"] (Since I can't call each service link individually). The problem was with Safari & Opera, works fine with Firefox and IE. I'm running some tests today to see if it has to do with my site running on 7.12 so I will post updates.
CORRECTION: Just figured out the cross browser issue. My permission weren't set up properly. =/
Comment #12
TheCrow commentedhttp://servicelinks.altervista.org/?q=about/customizations/render-servic...