PHP error
newswatch - July 2, 2008 - 04:43
| Project: | Link |
| Version: | 5.x-2.3 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I am using the following to display the 'link:
<div style="margin-bottom:10px">
<?php if (content_format('field_website', $field_website[0]) != '') : ?>
<b>»</b> <?php foreach ($field_website as $website) { ?><?php print content_format('field_website', $website) ?> <?php } ?>
<?php endif; ?>
</div>This is resulting in the error messages:
warning: Invalid argument supplied for foreach() in /home/xxxxxx/public_html/modules/node/node.module on line 521.
warning: implode() [function.implode]: Invalid arguments passed in /home/xxxxxx/public_html/modules/node/node.module on line 525.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /home/xxxxxx/public_html/includes/database.mysql.inc on line 172.This does not happen with other CCK fields. Any pointers would be greatly appreciated :)

#1
If you have token module installed, link needs to do a node_load() to replace the tokens in the link, if any. The call to content_format() needs to include all the parameters (most importantly the node object needed for the node_load()).
content_format('field_website', $website, 'default', $node);#2
I must add one thing.
This happens in different situations:
i) when the Title is Static; placeholder tokens disabled; multiple values OFF (works fine when Title is Optional)
ii) when Title is Optional; placeholder tokens enabled; multiple values ON (works fine when tokens are disabled)
#3
hi quicksketch:
thanks for the pointer. but it did not work. i have added some more symptoms in my earlier message.
#4
I'm pretty sure this is the case. Is there a $node object where you're trying to pass it in to content_format()? The error you posted in the original request is the exact same as what will happen when you try to node_load(NULL), which is what would likely happen if the $node object didn't exist, or you didn't pass one in at all.
#5
I don't think there is any $node->object that I am inadvertently passing on? But in any case, what would be the best way to ascertain that?
#6
I'm sorry I haven't been able to provide further support on this request. Please reopen if you still have further questions on this issue.