Archive
About me...
Nicolai Høeg Pedersen
Nicolai Høeg Pedersen - Dynamicweb creator, runner and co-founder of Dynamicweb.
About | Contact
Get e-mail notification on new posts.
Developer network
We love the web
Powered by
Dynamicweb CMS

Dynamicweb 8 - Files and Images folder

Date Wednesday, 18 January 2012 07:39

All files in Dynamicweb are located in subfolders under /Files which is the root of the file manager. 2 of the subfolders are named “Billeder” and “Filer” – Danish names from back in last millennium.


The change

Since Dynamicweb is an international product, having Danish names in the file structure is unwanted. In templates etc. these names are included in paths to images and files.

With Dynamicweb 8 the names for these 2 folders change to the English equivalents, Images and Files.

This is only on new Dynamicweb 8 installations – Dynamicweb 7 installations upgrading to Dynamicweb 8 will keep the names.

What does that mean?

If you have sites made in Dynamicweb 7 you would have image references like this:
<img src=”/Files/Billeder/MyProduct.jpg” />
In websites installed as Dynamicweb 8 the same reference will look like this:
<img src=”/Files/Images/MyProduct.jpg” />
Dynamicweb 8 installations have another set of templates where all references to the /Files/Billeder folder has been updated.

Can the names be changed on upgraded solutions?

Yes – but it can be a hassle. Usually you would have some hardcoded paths in your templates, in the editor ect. so changing would require some work.

Use some search and replace on the templates, and use the database search & replace tool in Dynamicweb Management Center to locate content in the editor with hard coded references.

To update what folder Dynamicweb will use in its code base, an update of /Files/GlobalSettings.aspx is required – add these 2 keys to it, and Dynamicweb will switch to using these folder names.

<System>
<Filesystem>
<FilesFolderName>Files</FilesFolderName>
<ImagesFolderName>Images</ImagesFolderName>
</Filesystem>
</System>
All from here.



Dynamicweb 8 - Changes to template extenders

Date Tuesday, 17 January 2012 08:10

Dynamicweb 7 offers a number of template extenders that allows 3rd party developers to extend the rendering of elements in Dynamicweb. They are changed in Dynamicweb 8.


Background

In Dynamicweb 7 the template extenders works in 2 different ways making the API in this point inconsistent. With Dynamicweb 8 we’ve aligned the way template extenders work and also implemented template extender base. This will improve the usability on the API.

I.e. the product template extender looks like this:
public class ProductTemplateExtender1 : ProductTemplateExtender
{
public override void ExtendTemplate(Dynamicweb.Templatev2.Template template)
{
template.SetTag("myTag", "myValue");
}
}
And the page template extender looks like this:
public class PageTemplateExtender1 : PageTemplateExtender
{
public override void RenderTemplate(Dynamicweb.Templatev2.Template template)
{
template.SetTag("myTag", "myValue");
}

}
So to different names on the member that needs to be overridden.

Also some of the template extenders have more than one parameter on their EextendTemplate or RenderTemplate method.

The change

In Dynamicweb 8 all template extenders are based on the same Template Extender base, Dynamicweb.Extensibility.TemplateExtender – so all template extenders in Dynamicweb now derives from this base class.

This means that all template extenders follow the same way of implementation. They all have a RenderTemplate method with one parameter, a template instance.
If there are need for other context information in the template extender, i.e. the product being extended, it will be a property on the template extender itself and not a parameter in the extended method.

So taking a look at the page template extender when used in Dynamicweb 8:
public class PageTemplateExtender2 : PageTemplateExtender
{
public override void ExtendTemplate(Dynamicweb.Rendering.Template template)
{
template.SetTag("myTitle", this.PageView.Meta.Title());
}

}

New extenders

3 new template extenders have also been added to Dynamicweb. 
  • User management
    • User template extender
    • Group template extender
  • eCommerce
    • Group template extender

Upgrading existing template extenders

If you have code already using template extenders upgrading is fairly easy. References are the same, so in the cases where the overridden member has been renamed, your implementation of that method needs a new name – and you are up and running again.

So just a quick update of a method name and a recompilation and you template extender is up and running again.




Dynamicweb 8 - Dynamicweb.Ecom7 namespace

Date Monday, 16 January 2012 09:47

Dynamicweb 8 does not have the Dynamicweb.Ecom7 namespace as we know it from Dynamicweb 7. Here’s why and were it has been moved.


Background

With Dynamicweb 7.1 we introduced a new cart (Cartv2) and checkout procedure for the eCommerce platform. These features were placed in Dynamicweb.Ecom7 namespace. With Dynamicweb 8 all the things in this namespace are moved to Dynamicweb.eCommerce namespace.

The update to this change is extremely easy – simply change your namespace reference from Dynamicweb.Ecom7 to Dynamicweb.eCommerce:

Dynamicweb 7:
using Dynamicweb.Ecom7.Cart;

Dynamicweb 8:
using Dynamicweb.eCommerce.Cart;
If you have i.e. a CheckoutHandler this is the only change needed to be done before a recompile can be done.

Notifications

In Dynamicweb 7 the Ecom7 namespace contains all the notifications for the cart – they are found in Dynamicweb.Ecom7.Cart.Notifications.

In Dynamicweb 8 these notifications are moved from the namespace to the Dynamicweb.Notifications namespace and can now be found in this location: Dynamicweb.Notifications.eCommerce.Cart

Below how notification subscribers looks like in Dynamicweb 7 and Dynamicweb 8

Dynamicweb 7
[Dynamicweb.Extensibility.Subscribe(Dynamicweb.Ecom7.Cart.Notifications.BeforeRenderingEmptyCart)]
public class EcomCartCreatedObserver1 : Dynamicweb.Extensibility.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
{
Dynamicweb.Ecom7.Cart.Notifications.BeforeRenderingEmptyCartArgs cArgs = (Dynamicweb.Ecom7.Cart.Notifications.BeforeRenderingEmptyCartArgs)args;

}
}
Dynamicweb 8
[Dynamicweb.Extensibility.Subscribe(Dynamicweb.Notifications.eCommerce.Cart.BeforeRenderingEmptyCart)]
public class EcomCartBeforeRenderingEmptyCartObserver1 : Dynamicweb.Extensibility.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
{
Dynamicweb.Notifications.eCommerce.Cart.BeforeRenderingEmptyCartArgs beforeRenderingEmptyCartArgs = args as Dynamicweb.Notifications.eCommerce.Cart.BeforeRenderingEmptyCartArgs;

}
}

Why this change?

This change was made because having an Ecom7 namespace was a little confusing. So this was done for usability reasons. The notifications were moved so they are located in the same structure as other notifications.





Dynamicweb 8 - Default.aspx, Global.asax and web.config changes

Date Sunday, 15 January 2012 19:02

With Dynamicweb 8 we’ve made some changes to how Default.aspx and Globals.asax needs to be handled in custom solutions. For solutions running a standard Dynamicweb, no changes are required.


Background

When making Dynamicweb custom solutions there are 3 files in the frontend implementation which is copied to the custom solution and therefore does not inherit all code from the version of Dynamicweb API. When upgrading custom solutions from Dynamicweb 7 to Dynamicweb 8, these files need to be upgraded due to a number of minor but important changes.

Global.asax

In Dynamicweb 7 custom solutions need a reference to Dynamicweb.Admin to get hold of references to the events fired in Global.asax. That gives code like this:

Dynamicweb.Admin.Global GlobalAsax = new Dynamicweb.Admin.Global();
public void Application_Start(object sender, EventArgs e)
{
// Fires when the application is started
GlobalAsax.Application_Start(sender, e);
}