Jump to:

23550 Posts in 19336 Topics by 2890 members

General Questions

SilverStripe Forums » General Questions » renderwith() help

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

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

Page: 1
Go to End
Author Topic: 1655 Views
  • b0bro
    Avatar
    Community Member
    38 Posts

    renderwith() help Link to this post

    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");
       }

  • Willr
    Avatar
    Forum Moderator
    5511 Posts

    Re: renderwith() help Link to this post

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

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

  • b0bro
    Avatar
    Community Member
    38 Posts

    Re: renderwith() help Link to this post

    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)

  • Willr
    Avatar
    Forum Moderator
    5511 Posts

    Re: renderwith() help Link to this post

    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.

  • b0bro
    Avatar
    Community Member
    38 Posts

    Re: renderwith() help Link to this post

    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()

  • b0bro
    Avatar
    Community Member
    38 Posts

    Re: renderwith() help Link to this post

    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!

    1655 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.