Developer forum

Forum » CMS - Standard features » ItemPublisher:Item.Url

ItemPublisher:Item.Url

Thomas Schroll
Reply

Hi

I'm trying to create a page to send as newsletter via ItemPublisher. I want to select specific page items, show a teaser text from those items on the page and send the page to subscribers. I need a link to the items in the newsletter. I've noticed the tag ItemPublisher:Item.Url (http://developer.dynamicweb.com/releases/all-new-features-in-8-x/items.aspx/item12327) but I cant find it anywhere in the available tags.

Does anybody know in which loop the tag is?

Regards Thomas


Replies

 
Thomas Overgaard Nielsen
Reply

Hi Thomas

It is in the ItemPublisher:Items.List loop

 

Regards

Thomas

 

 
Thomas Schroll
Reply

Hi Thomas

That's strange: IsNullOrEmpty on the tags return true and it isn't in my list of TemplateTags().

can the tag be used on Page Items?

Regards Thomas

 
Thomas Overgaard Nielsen
Reply

I believe the tag was added in 8.3.0 .. you did confirm your version, right?

Yes it works on page items.

So you have an item type, say 'newsitem,

And several newsitems published somewhere in your pagetree

And then you have a seperate page with an item publisher, where you manually select the NewsItems, you want published on that page?

I do something like that all the time .. as far as I remember however never wifth explicitly selected items. But that should not make a difference.

 

 
Thomas Schroll
Reply

Hi Thomas

The version is 8.5.0.1. I do explicitly select the items, and I probably need it that way. I cannot use a static list because the newsletter have different sections, which mean I need multiple ItemPublishers. I really do not see another way.

I'll contact support, but thanks for looking at it.

Regards Thomas

 
Thomas Overgaard Nielsen
Reply

No problem.

Don't forget to post an update, if the solution has general relevance :)

Best regards

 
Mikkel Ricky
Reply

This is a know bug (#15654). A fix has been made and is planned for release in Dynamicweb 8.5.1.

Best regards,
Mikkel

 
Thomas Schroll
Reply

Thanks Mikkel

I'll delete the support ticket. Do you know a workaound or is it possible to try a fix before 8.5.1?

Regards Thomas

 
Mikkel Ricky
Reply
This post has been marked as an answer

We're currently finalizing 8.5.1 and we cannot release the fix before releasing 8.5.1.

You can get the id of an item based page using a Razor function like this

@functions {
    // Get id of item based page
    int GetItemPageId(string itemType, string itemId) {
        // @TODO Cache results to prevent accessing the database every time
        using (var command = Dynamicweb.Database.CreateConnection().CreateCommand())
    {
      command.CommandText = "select PageId from Page where PageItemType = @itemType and PageItemId = @itemId";
            Dynamicweb.Database.AddStringParam(command, "itemType", itemType);
            Dynamicweb.Database.AddStringParam(command, "itemId", itemId);
            var value = command.ExecuteScalar();
            return value != null ? (int)value : 0;
        }
    }
}

but that should only be used as a very temporary workaround.

Best regards,
Mikkel

Votes for this answer: 1
 
Thomas Schroll
Reply

Thanks Mikkel, it's working perfectly.

I'll make sure to replace the code as soon as 8.5.1 is available.

Regards Thomas

 

You must be logged in to post in the forum