Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

renderwith() help


Go to End


6 Posts   2159 Views

Avatar
b0bro

Community Member, 38 Posts

15 September 2009 at 5:13pm

How can i send my $xURL value to the template in this function????

ie this is what i have but dosnt work. I was using $ParamsXML.xURL in the template.

function ParamsXML() {
	$xURL = "test";
    	return $this->customise($xURL)->renderWith("slideshowProParamsXML");
	}

Avatar
Willr

Forum Moderator, 5523 Posts

15 September 2009 at 5:24pm

You pass $this->customise an ArrayData object with the values.

return $this->customise(new ArrayData(array('xURL' => $xURL))->renderWith('slideshowProParamsXML');

Avatar
b0bro

Community Member, 38 Posts

16 September 2009 at 3:15pm

omg thank you, i must have tried a million variations but not that one!

One more thing!

Is there a way i can append .xml on the end of the url??

At the moment that function creates an xml file at this location;

www.domain.com/home/imagesXML

but i want it to read;

www.domain.com/home/imagesXML.xml

Im not 100% sure but i think ie6 wont load my xml file into flash unless it has the .xml on the end (tested with a static xml file)

Avatar
Willr

Forum Moderator, 5523 Posts

16 September 2009 at 3:23pm

Should work fine without the xml extension. I use this method for all our flash / xml integration work and as long as you have the correct template encoding for the HomePage_images.ss template (and it needs to be at the root of the templates folder - not in layout) then it should work perfectly.

Avatar
b0bro

Community Member, 38 Posts

16 September 2009 at 4:00pm

could you elaborate on the template encoding?

links:
www.apartmentscartagena.com/home
www.apartmentscartagena.com/home/imagesXML

It used to work with a previous flash banner view but now we have purchased Slide Show Pro and it only works in Firefox, so strange.

Only Two templates used, homepage.ss and imagesXML.ss

this is what imagesXML.ss looks like

<?xml version="1.0" encoding="UTF-8"?>
<gallery>
    <album id="ApartmentImages" title="Album One" description="Description of Album One">
    	<% control Images %>
        <img src="http://www.apartmentscartagena.com<% control Image %><% control CroppedImage(700, 389) %>$URL<% end_control %><% end_control %>" title="$Name" />
        <% end_control %>
    </album>
</gallery>

This is the flash error i get in ie6

Error: Error #1096: XML parser failure: Unterminated element.
	at Error$/throwError()
	at flash.xml::XMLDocument/parseXML()
	at net.slideshowpro.slideshowpro.data::XMLParser/onCompleteHandler()
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at flash.net::URLLoader/onComplete()

Avatar
b0bro

Community Member, 38 Posts

16 September 2009 at 4:41pm

RESOLVED:

It seems AS3 is alot more strict on reading xml files.

I had

<img src="image.jpg" />

however AS3 didnt like the self closing img tag so i tried

<img src="image.jpg"></img>

And that has seemed to resolve it. Still no idea why it was working in Firefox all this time though!