Creating Dynamic Lists with EE

I’ve run into a bit of an IE6 snag here and was wondering if anyone could help out. I’m trying to have a list of my most recent 5 articles post in a unordered list at the bottom of my page using Expression Engine. What Freeway is doing is it’s making the list’s:

<ul class="name">
    <li>Dynamic Items</li>
</ul>
<ul class="name">
    <li>Dynamic Items</li>
</ul>
<ul class="name">
    <li>Dynamic Items</li>
</ul>

Instead of how I’d like to see it as:

<ul class="name">
    <li>Dynamic Items</li>
    <li>Dynamic Items</li>
    <li>Dynamic Items</li>
</ul>

It’s late here and I may be losing it, but any ideas?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

How are you making the dynamic list? What sort of tag are you using?
That’s going to be the key to this. If you have made a list with one
item, and then made that your template for your loop, you’re going to
get what you show here. I can’t see a way to add an Action to a list
or to make a template out of one row of a list using Freeway 5. If
you’re doing this in EE, you’re going to need to have a tag that
makes the container UL, and then another tag nested inside that which
iterates over the collection of dynamic items and makes a LI for each
one.

Walter

On Sep 26, 2008, at 1:16 AM, Dan J wrote:

I’ve run into a bit of an IE6 snag here and was wondering if anyone
could help out. I’m trying to have a list of my most recent 5
articles post in a unordered list at the bottom of my page using
Expression Engine. What Freeway is doing is it’s making the list’s:

<ul class="name">
    <li>Dynamic Items</li>
</ul>
<ul class="name">
    <li>Dynamic Items</li>
</ul>
<ul class="name">
    <li>Dynamic Items</li>
</ul>

freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Well I wrapped a title permalink inside of a list-item in hopes it’d just list itself it out within the

    tag.

    But as you saw from my example it creates separate bunches of UL tags. How would I go about your route? Perhaps a few more google searches will turn something up.

    Also I need to find out why IE6 doesn’t like lists with graphic backgrounds. When I refresh sometimes it loads it, sometimes it doesn’t.


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options

What do you do in EE when you want to loop over a collection of
items? I know how I would write this in my framework, but I don’t use
EE at all.

$things = ActiveRecord::FindAll('things','foo = "bar"','added_at  

DESC’, 5);
//gets 5 things, latest first
$out .= ‘

    ’;
    foreach($things as $thing){
    $out .= '
  • . $thing->link_for(‘view’,‘title’) . ‘</
    li>’;
    }
    $out .= ‘
’;
//now $out is your list, you can print() it or whatever

Walter

On Sep 26, 2008, at 1:39 PM, Dan J wrote:

Well I wrapped a title permalink inside of a list-item in hopes
it’d just list itself it out within the

    tag.

    But as you saw from my example it creates separate bunches of UL
    tags. How would I go about your route? Perhaps a few more google
    searches will turn something up.

    Also I need to find out why IE6 doesn’t like lists with graphic
    backgrounds. When I refresh sometimes it loads it, sometimes it
    doesn’t.


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Looks like an EE tag would have to go inside the UL tag:

    {ee:tag}
  • {title permalink}
  • {/exp}

Looks like a markup item will have to do. I think an action would be too rough, or would it?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

k, that didn’t work.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

What would you use in EE code to make a loop over a collection?

Is there some tag that looks like this:

loop
	do something each time
/loop

If you look at the code I posted (which does this) you’ll see that I
start with an array of found objects, then iterate over that array
with foreach. While I doubt that EE exposes anything that primitive
to you, there has to be an equivalent construct. If you post the code
to generate an entire list, perhaps there’s a way to snake that into
the list with an Action.

Another thing to do is look at Joe Muscara’s EE Actions. I believe
that they are designed to let you do this sort of thing.

As far as making an Action to attach to a list itself, that’s going
to be quite messy. Freeway doesn’t expose paragraph or list tags to
developers as something you can attach to and modify. What an Action
would have to do is attach to the parent DIV or TD, then “burn” the
contents to HTML and use text-replacement techniques to find the
Freeway-made list and modify it.

Another approach would be to add an instance of my [CrowBar Action]
1 inline in your text instead of the list, and then have your EE
code generate the entire list code. You might want to explore that
because it will avoid the Freeway issue of inline markup items always
being enclosed with a P tag.

Walter

On Sep 27, 2008, at 1:31 AM, Dan J wrote:

Looks like an EE tag would have to go inside the UL tag:

    {ee:tag}
  • {title permalink}
  • {/exp}

Looks like a markup item will have to do. I think an action would
be too rough, or would it?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I am actually using Joe’s actions. I’ll rinse, recycle, and retry this evening. It’s the last thing on my list which is having just recent article titles posted and then I’m done with this part.

I’ll take your suggestions Walt and get back on it. Thanks for the help.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

[Solved]

Here’s what I was missing:

The EE tags did have to go inside of the

    tags like:

      {exp:weblog:entries weblog="name" limit="5" dynamic="off"}
    • {title}
    • {/exp:weblog:entries}

    But what I was missing was that the entries tag had to go in there as well, not just the title permalink that I was doing. Not a duh! moment, but a good learning experience.

    Then a drop in of “Remove Paragraph Tags” action and bam…it works.


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options

Hi Dan,

I’m glad to see you got this solved. Getting the EE tags in just the right place can be tricky sometimes, and it looks like you’ve hit upon a good way to do it. Cleaning up the code with Remove Paragraph Tags Action is a good idea as well.

Care to share how you got all the pieces where they needed to be inside the

Yeah, I did a Markup Item and wrote it out manually since Walt said an action that would go in-between the

    tags would be messy to do. Then after dropping the Remove Paragraph Tags action, my code came out messy, but it worked across the browser board.

    There are some tags that have to be done this way, like using the word_limit plugin and such. I am going to run a few trial and error methods today and see how it works. I need to figure out how the tag system works in the actions for doing it manually as well. Like how pair tags work and so on.

    Otherwise, i’ve been happy with it. I simply am using EE for blog entries and then listing them underneath on the home-page for reference. Not even getting into related articles and such. A simple, but time consuming design process.


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options

Try the CrowBar. It will allow you to put a chunk of markup inline without generating any surrounding tags.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The Crowbar action only allows one piece of the code part right? EE needs an opening tag and a closing tag, and I see Crowbar only gives me the beginning or the end, not options for both.

It works like this:

<ul>
{ee:word_limit total="25"}
<li>{summary}</li>
{/ee:word_limit}
</ul>

I’m leaving in a few to head out and mess around with it since my NFL football game is now over. I’ll see what I can figure out.

I think Walt and I discussed an Action that could wrap the outside of a

  • tag inside of a
  • Joe,

    Can I get a global path variable action for the EE suite? I’d like to link back to the home-page, but Freeway keeps adding the the “22” part for the quotes if I add the hyperlink manually. I think it should be easy, considering the title-permalink action works the same way. You’d just have to change title-permalink to output this:

    <a href="{path=''home/index''}">Back to the main page</a>
    

    It’d also be beneficial to have it goto other specific template pages as well.

    EE Discussed here: http://expressionengine.com/docs/templates/globals/path.html

    Thanks if you can do that, it’d be a time saver.


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options

    If you use the CrowBar as an inline action, as the only bit of “text”
    in a UL, then it will make this construction for you. You would place
    an inline instance of the CrowBar, then style it as a list, and then
    in that CrowBar’s markup box, you would put

     {ee:word_limit total="25"}
     <li>{summary}</li>
     {/ee:word_limit}
    

    When an inline CrowBar is the only thing on a line, it removes the
    container tag entirely. I have not tested this in anything but a P
    tag, but I believe I wrote it to remove any legal block text tag. If
    it doesn’t do so now, it’s a ten second change to make it do.

    Walter

    On Sep 28, 2008, at 4:19 PM, Dan J wrote:

    The Crowbar action only allows one piece of the code part right?
    EE needs an opening tag and a closing tag, and I see Crowbar only
    gives me the beginning or the end, not options for both.

    It works like this:

    <ul>
    {ee:word_limit total="25"}
    <li>{summary}</li>
    {/ee:word_limit}
    </ul>
    

    I’m leaving in a few to head out and mess around with it since my
    NFL football game is now over. I’ll see what I can figure out.

    I think Walt and I discussed an Action that could wrap the outside
    of a

  • tag inside of a

  • freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options

    When an inline CrowBar is the only thing on a line, it removes the container tag entirely. I have not tested this in anything but a P tag, but I believe I wrote it to remove any legal block text tag. If it doesn’t do so now, it’s a ten second change to make it do.

    I just tried this, and it works as expected. Make sure you have the latest version of CrowBar, available at http://actionsforge.com

    Walter


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options

    On 28 Sep 2008, 9:50 pm, Dan J wrote:

    Can I get a global path variable action for the EE suite? I’d like to link back to the home-page, but Freeway keeps adding the the “22” part for the quotes if I add the hyperlink manually. I think it should be easy, considering the title-permalink action works the same way. You’d just have to change title-permalink to output this:

    It’d also be beneficial to have it goto other specific template pages as well.

    Dan, I’m not sure what you are asking. The Action automatically changes links to path variables except for certain circumstances or based on options in the Action.


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options

    Well I’m trying to create a path variable similar to the example I had above. The title_permalink action drops in a permalink to the title, but a path variable would be like in the example.

    Path Variable Link

    <a href="{path=weblog/archives}">My Archives Page</a>
    

    Title Permalink:

     <a href="{title_permalink="home/index"}">Home Page</a>
    

    Maybe I’m missing the boat but whenever I use a title permalink to go back to the home page because it still keeps the URL tag of whatever page I am on. When I use the path variable method I don’t get the folder structure.

    Course my client files are now corrupted on their end, so it’s just a mess now.


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options

    Right, but if you are on a page that has EE Resources applied (or a page that is in a folder that has EE Resources applied to it), and simply create a link to another page in your Freeway document, the Action will convert the normal link to something like

    <a href="{path=weblog/archives}">My Archives Page</a>
    

    If I’m still missing what you want, maybe you can send an example of what you’re doing to me directly and we can go from there.


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options

    Walt,

    Looking good. I do get the results on my end. I didn’t at first, but for some reason it just works. The only real super nitpicky thing is that it doesn’t tab over in my Freeway code, but I can adjust it later.

    I had to update the action to get an inline item selectable.

    Thanks for your help.


    freewaytalk mailing list
    email@hidden
    Update your subscriptions at:
    http://freewaytalk.net/person/options