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.

Need help using url_segment to create a dynamic XML template

May 09, 2009 1:51pm

Subscribe [4]
  • #1 / May 09, 2009 1:51pm

    CityDesk

    16 posts

    I am using an XML-powered flash video player. I need to create an XML template that can dynamically pull the right weblog entry based on the URL of the page being viewed.

    This is a sample URL of a page that this needs to work on:

    http://www.freqcontrol.com/dev-ee/index.php?/sessions/feature/the_ludlow_lions/

    Note that the wrong band’s video is displaying in the player. The XML file is pulling the most recent entry, rather than the entry that is feeding the text on this page.

    Here is weblog entries code I am using in the XML template:

    {exp:weblog:entries weblog="sessions" disable="trackbacks" entry_id="{segment_3}" dynamic="on" disable="trackbacks|pagination|member_data" limit="1"}

    I am a it out of my depth here. Can anyone help me figure out why this doesn’t work?

    Any help is appreciated.

    Thanks,
    Jeff

  • #2 / May 09, 2009 7:46pm

    Lisa Wess

    20502 posts

    You’ll want to use url_title not entry_id - the_ludlow_lions is a URL title not a numeric entry_id.

    Moreover, if the URL title or entry_id are in segment 2 or 3, you don’t need to specify it like that.  Read through The Importance of Semantics, especially the first article.

    If you are going to define your own URL segments, you always want dynamic=“off”.

  • #3 / May 10, 2009 3:03am

    CityDesk

    16 posts

    Thanks Lisa.

    I have read your articles on semantics. They were very helpful. I also changed the entry_id to url_title.

    Unfortunately it still isn’t working right.

    I have tried it with and without the url_segment parameter. I have also tried it with dynamic off and on. none of it worked.

    Just out of curiosity, I did try it with the url_title hard coded (url_title=“the_ludlow_lions”) just to see if the url_title parameter was working at all, and it did effectively change it. Of course, this doesn’t solve my need to populate this XML template dynamically based on URL segment 3.

    This is what the weblog entries code currently looks like:

    {exp:weblog:entries weblog="sessions"  url_title="{segment_3}" limit="1" dynamic="on"}

    Any other ideas of where I can look for solutions. I really need to find my lightbulb moment on this and am really struggling with it right now.

    Thanks for any help.
    -Jeff

  • #4 / May 10, 2009 6:07am

    morph london

    47 posts

    I think dynamic needs to be “off” as I think the page will be trying to pull in the Weblog “feature” instead of the one you are passing.

    Though I am just re-writing what Lisa already told you. 😉

  • #5 / May 10, 2009 3:18pm

    Lisa Wess

    20502 posts

    Can you try this on a bare-bones template, to make sure it works on its own before incorporating it into the XML?

    But as I said, the code as you have it isn’t needed.

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

    is exactly the same thing when visited with a URL title in segment 3.

  • #6 / May 10, 2009 3:32pm

    CityDesk

    16 posts

    Yeah. The barebones template displays the right text. For instance, the right band name is being called by the template. I have that part under control. The problem is that after I use the weblog entries tag to call the band name in the feature template I embed the flash player using swf object.  The swf itself contains the link to the XML template I am struggling with in ee.

    Thanks for any help.

  • #7 / May 14, 2009 4:52pm

    Batdelfuego

    45 posts

    Did anybody came back with a solution for this problem?

    I’m also building a site with some flash players with music and the XML file called dynamically is giving me a hard time.

    It’s either only loading the latest entry or all of the entries…

    I have added Question marks” where i’m having problems… how do i call the dynamic entry in the xml…?

    {exp:weblog:entries weblog="mixtapes" disable="trackbacks" entry_id="[b]????[/b]" dynamic="off"} 
    {mixtape}
    {mixtape-track}
        <track>    
            <title>{count} {mixtape-track-name} - {mixtape-track-artist}</title>
            <info>http://www.djdivsa.com/</info>
            <annotation>{mixtape-track-name} - {mixtape-track-artist}</annotation>
            <location>{site_url}{mixtape-track-file}</location>
            <image>{site_url}{mixtape-artwork}</image>
        </track>
    {/mixtape-track}
    {/mixtape}
    {/exp:weblog:entries}


    Here is a demo of the page im working on:
    http://66.115.130.210/mixtapes/details/bring-it-back/

    thanks for any help!

  • #8 / May 14, 2009 5:02pm

    Batdelfuego

    45 posts

    Hey CityDesk…

    I just found a thread showing how to get the dynamic id to work in the XML file.. check it out here:

    http://ellislab.com/forums/viewthread/111760/


    It should also work for your picture gallery that you are implementing on your site (from what i red in another thread)

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases