plainblack.com
Username Password
search
Bookmark and Share

    

How is page asset order determined?

User iadawn
Date 4/20/2007 5:41 am
Views 2278
Rating -6    Rate [
|
]
Previous · Next
User Message
iadawn

Hi,

Sorry if this is a second post, 'something weird' (tm) happened to my first post on this topic... if it is not the second post then ignore my ramblings!

I have a workflow activity which is used to create an historical record of some system graphs. The activity retrieves the image of the graph from a specified url and adds it as an article to a specified container. The following code is used to shift the new article to the top of the container:

        my $object = $container->addChild({
            className       => 'WebGUI::Asset::Wobject::Article',
            title           => 'VM Stat Graph ' . $today->strftime( '%e %b, %Y' ),
            menuTitle       => $today->strftime( '%e %b, %Y' ),
            url             => $self->get('container') . "/" . lc( $today->strftime( '%d-%b-%Y' ) ),
            styleTemplateId => $styletemplate->getId,
            templateId      => $template->getId,
            isHidden        => 1,
            description     => "<img src='" . $store->getUrl( $file ) . "' />",
        });

        # Move the item to the top of the list
        while( $object->promote ) { }

As far as I can determine from the docs, the 'promote' while loop will push the create article to the top rank within the container.

The main aim is to have a descending date view of the graphs by pushing any new graph to the top of the page. I had seen this code work when I was testing but it does not seem to work now and on playing about with rank I am not sure what the relationship between asset rank and page display order is.

My question (finally) is, what determines the order of asset display on a page? And, how can I manipulate this programmatically.

Thanks for any assistance,

Kevin 



Back to Top
Rate [
|
]
 
 
iadawn

Hi Again,

Well after a bit of playing around with bits and bobs I found out how this was done. Seems page asset order is determined by a comma separated list of asset ids in the container. The property is 'contentPositions' and the additional code required to put my new graph at the top of the page is:

        # Update the content position on the page
        my $contentPositions = $container->get( 'contentPositions' );
        $container->update({ contentPositions => $object->getId . ",$contentPositions" });

Thanks me :) 

Kevin 



Back to Top
Rate [
|
]
 
 
JT
Incidentally, the rank is used to control assets in nav. The reason that it's not used in page layouts is that you need to be able to control the position of assets across multiple content areas.


Back to Top
Rate [
|
]
 
 
    



© 2010 Plain Black Corporation | All Rights Reserved