ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Passing Entry Id To An XML Template (MonoSlideShow)

June 03, 2009 4:31am

Subscribe [3]
  • #1 / Jun 03, 2009 4:31am

    simplyee

    104 posts

    So I’ve searched and read, searched and read, and just not getting it.

    Trying to embed a small MonoSlideShow in single entry pages, using a regular weblog with custom fields for 5 images. When I hard code the entry_id it works, but how to pass the entry_id on to the xml template? Got to be pretty simple. The 5pieces method with the gallery module is where I started, but just can’t get it to work in a weblog.

    In the MSS xml I have this:

    <album imagePath="path/to/images">
        
    {exp:weblog:entries weblog="weblog"limit="1" entry_id="3"}
    {image_1}
    {image_2}
    {image_3}
    {image_4}
    {image_5}
    {/exp:weblog:entries}
    
    </album>

    But need to have a dynamic entry_id of course. Do I need a custom query for this? Any help appreciated, thanks.

  • #2 / Jun 03, 2009 10:32am

    Boyink!

    5011 posts

    If this is an embedded template, can’t you just pass in the entry id as an embed variable for an embedded template?

    Otherwise if you are calling the XML as a URL - look into using a segment variable.

  • #3 / Jun 03, 2009 11:25am

    simplyee

    104 posts

    Well, it’s not embedded. I’ve got the MSS, or actually using swfobject, on the single entry page. I would have liked to use the entry_id, like

    {exp:weblog:entries entry_id="{entry_id}"}

    But that doesn’t work. I saw your tut using MSS and the category archive, but that doesn’t work for me, so still trying to figure out how to get that entry_id passed to the MSS xml template.

  • #4 / Jun 03, 2009 11:34am

    Boyink!

    5011 posts

    What’s the code in your parent template look like?

  • #5 / Jun 04, 2009 2:01am

    simplyee

    104 posts

    {exp:weblog:entries weblog="weblog" limit="1"}
    <div id="mssHolder">
    
    Temporary holder for the Flash object
    
    </div>
    
    [removed]
    var so = new SWFObject("/monoslideshow.swf", "mss", 253, 214, "7", "#ffffff");
    so.addVariable("showLogo", "false");
    so.addVariable("dataFile", "/xml/mono_xml/");
    so.write("mssHolder");
    [removed]
    
    </div>
    {/exp:weblog:entries}

    I’ll try and write a query. Again, it works fine if I hard code the entry_id in the xml template, so I need to figure out how to pass the entry_id to the xml.

  • #6 / Jun 04, 2009 5:06am

    Mark Bowen

    12637 posts

    If you’re trying to use a {variable} within javascript then you are very likely coming into errors due to the curly braces of the variable being interpreted as javascript braces.

    If you place this line into your config.php file though it should hopefully clear it up for you.

    $conf['protect_javascript'] = 'n';

    Documentation Link

    Hope that helps a bit.

    Best wishes,

    Mark

  • #7 / Jun 04, 2009 6:23am

    simplyee

    104 posts

    Not a problem here, although thanks for that link. Not using it inside javascript, it’s just not recognizing the entry_id in the XML template.

  • #8 / Jun 04, 2009 6:45am

    Mark Bowen

    12637 posts

    Can you show us all the template code(s) that you are using as the code above is pretty much just hard-coded and I’m not really seeing what it is getting from having a weblog tag surrounding it.

    As the code inside the tag isn’t actually using any variables (as far as I can see anyway) from the weblog tag then I’m a little confused as to how you are going about all of this.

    As Mike said before if you are using an embed to get at what you need then something like this should work :

    {exp:weblog:entries weblog="default_site"}
    
    {embed="slidehow-xml" entry-id="{entry_id}"}
    
    {/exp:weblog:entries}

    Then in your embedded (slideshow-xml) template you will be able to do this sort of thing :

    {exp:weblog:entries weblog="default_site" entry_id="{embed:entry-id}" dynamic="off"}
    Whatever you need here…
    {/exp:weblog:entries}

    Again without seeing exactly what you are doing I’m pretty much guessing but the code you have shown above isn’t actually taking anything at all from the weblog tag so that’s why I’m a bit confused.

    Best wishes,

    Mark

  • #9 / Jun 04, 2009 9:42am

    Boyink!

    5011 posts

    Another way:

    so.addVariable("dataFile", "/xml/mono_xml/{entry_id}");
    {exp:weblog:entries weblog="weblog"limit="1" entry_id="3" dynamic="off" entry_id="{segment_4}"}
    {image_1}
    {image_2}
    {image_3}
    {image_4}
    {image_5}
    {/exp:weblog:entries}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases