Active
Project:
Content Templates (Contemplate)
Version:
5.x-2.04
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 Aug 2010 at 14:50 UTC
Updated:
23 Aug 2010 at 08:13 UTC
I am using contemplate on my site.
On some pages, this error message might appear:
warning: Invalid argument supplied for foreach() in /home/activ41/public_html/site/sites/all/modules/contemplate/contemplate.module(765) : eval()'d code on line 66.
In my contemplate, I am using the following foreach command:
<div class="course_page_block">
<h2 class="lc"> Syllabus Materials</h2>
<ul class="rc">
<?php
<?php foreach($node->field_link_to_support as $delta => $field) : ?>
<?php if ($node->field_link_to_support as $delta => $field): ?>
<h2><?php print '<li> Link: '.$node->field_link_to_support[$delta]['view'].'</li>';?></ul>
<?php endif; ?>
</div>
I can't see anything wrong with the code that should cause the error message to appear.
I know that Contemplate 5x is no longer supported, but I was wondering if someone could give me some pointers.
Comments
Comment #1
jrglasgow commentedyou get the "Invalid argument supplied for foreach()" error when the variable
$node->field_link_to_supportis not of a type that can be used (object or array) or the variable$node->field_link_to_supportis emptyI would try
Comment #2
littly_kitty commentedThanks for your help!
When I try that code I get an unexpected T_AS error.
I have had a careful look at the code, but I can't see anything wrong. (Other than the stray
<H2>tag, 5 lines up from the bottom)I'm really not sure what I am doing wrong, so any help would be appreciated.