Jump to content

PHP output in source code but doesn't render


proggR

Recommended Posts

Ok this has been driving me absolutely crazy. I have a script that gets called by Prototype's Ajax.Updater() class which should then update a div. It does update the div but a portion of what gets outputted doesn't render.

 

											
if (is_array($PROCESSED["associated_proxy_ids"]) && count($PROCESSED["associated_proxy_ids"])) {
foreach ($PROCESSED["associated_proxy_ids"] as $student) {
                if ((array_key_exists($student, $STUDENT_LIST)) && is_array($STUDENT_LIST[$student])) {
?>
		<li class="user" id="audience_student_<?php echo $STUDENT_LIST[$student]["proxy_id"]; ?>" style="cursor: move;"><?php echo $STUDENT_LIST[$student]["fullname"]; ?><img src="<?php echo ENTRADA_URL; ?>/images/action-delete.gif" onclick="removeAudience('student_<?php echo $STUDENT_LIST[$student]["proxy_id"]; ?>', 'students');" class="list-cancel-image" /></li>
<?php
	}
}
}

 

I've echoed from within the foreach and the following if and the $student variable does have a value, however I'll point out that it also doesn't render but that may be because its not a <li>, I'm not sure. Now, if I take that li element lin end output it outside of the foreach loop it renders just fine(once I substitute the $student variable for a known index of course). Inside the loop it doesn't. I can see it in the source code of the page but for some reason its not rendering. I'll put the output from the source of the page below, the top is the code output from within the loop and the bottom is from outside of the loop. The bottom renders as expected, the top doesn't.

<!--foreach li element:doesn't render-->
<li class="user" id="audience_student_2" style="cursor: move;">Hudson, Tom<img src="http://localhost/entrada/www-root/images/action-delete.gif" onclick="removeAudience('student_2', 'students');" class="list-cancel-image" /></li>

<!--non foreach li element:renders-->
<li class="user" id="audience_student_2" style="cursor: move;">Hudson, Tom<img src="http://localhost/entrada/www-root/images/action-delete.gif" onclick="removeAudience('student_2', 'students');" class="list-cancel-image" /></li>

 

They're identical.

I can't figure out for the life of me why this isn't working. Any help would be great.

 

 

Link to comment
Share on other sites

Nevermind, that was my fault entirely. It was running when the page initially ran and I didn't realize so when I called the Ajax.Updater and it passed in the users that were already displayed it skipped a part of the script above. The code showing up in the source was from the initial page loading, not from the call I was making. Its working now. That took far too long to figure out. :\

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.