Jump to content

foreach looping through array


budove58

Recommended Posts

I created this code this morning and I think I have it right but not sure because I'm getting an error.  The error is related to Oracle's RightNow CX so I'm not sure if it's my code, or if something RightNow is not allowing for some reason.  Here is the code...

		<!-- *** Citation Form 1 *** -->
    	<div id="anotherCitNum" style="float:left;">
        <!-- Widget: Text Input for Citation Number -->
        <rn:widget path="standard/input/FormInput" name="incidents.c$citationnumber1" label_input="Citation Number:" />
        </div>
    	<div id="anotherCitDate" style="float:left; padding-left:15px">
        <!-- Widget: Date Selection for Citation -->
        <rn:widget path="standard/input/DateInput" name="incidents.c$citationissuedate1" label_input="Citation Date:" />
        </div>
   		<br clear="all"/><br />
        
<?php

$citcount = array_fill(2, 9, array_fill(2, 9, 0));

$citationform = '<!-- *** Citation Form '.$citnum.'*** -->
        <details>
        <summary>Enter another citation</summary><br />
            <div id="anotherCitNum" style="float:left;">
            <!-- Widget: Text Input for Citation Number -->
            <rn:widget path="standard/input/FormInput" name="incidents.c$citationnumber'.$citnum.'" label_input="Citation Number:" />
            </div>
            <div id="anotherCitDate" style="float:left; padding-left:15px">
            <!-- Widget: Date Selection for Citation -->
            <rn:widget path="standard/input/DateInput" name="incidents.c$citationissuedate'.$citnum.'" label_input="Citation Date:" />
            </div>
            <br clear="all"/><br />';

foreach ($citcount as $citnum) {

		echo $citationform;
}

?>    
    	
        
                            			</details>
                                    </details>
                                </details>
                            </details>
                        </details>
                    </details>
                </details>
        	</details>
        </details>
        <br style="clear:all;"/><br />

Here is the error I'm getting...

Parse error: syntax error, unexpected T_STRING in g/scripts/euf/application/rightnow/optimized_includes.php(180) : eval()'d code on line 25

If there's no problem with my code, then I'll assume it's something in RightNow.  This is my first attempt at a Custom Widget so any help would be appreciated.

Edited by budove58
Link to comment
Share on other sites

Here are lines 1-7...

<?php /* Originating Release: May 2012 */ ?>
<rn:meta controller_path="standard/input/FormInput" 
    base_css="custom/input/Citations"  
    compatibility_set="November '09+" 
    required_js_module="november_09,mobile_may_10"/>
    

		

This is a RightNow Widget so I'm wondering if something I'm trying to do has been restricted by the framework.

Link to comment
Share on other sites

since the code is being eval()'ed, it cannot start with an opening php tag (throws a different error from the one you are getting.)

 

the full code you have posted doesn't produce the original error when eval()'ed. the only general php help that comes to mind is your actual code contains something like a smart/curly-quote that is being changed to a straight-quote by this forum's software. you could zip the code and upload/attach it to a post.

 

there is a rightnow forum that could give targeted/specific help - http://communities.rightnow.com

 

about the only other thing that comes to mind is if you post the original logic from the file (assuming it contains any php code at all) so that someone here could see the expected usage.

Edited by mac_gyver
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.