The client wants a page to tell the time. As a solution they have delivered some code to use that we need to upload on the server. The code consists of:
- One asp.NET page and one dll file. I am unsure as to how to implement this code correctly.
The solution that this code is suppose to run on, is www.chrisco.dk.
I cannot attach the code at present time.
How do I test if this code can run on the solution?
Developer forum
E-mail notifications
Implement a customer created code on site.
Posted on 10/01/2011 10:16:55
Replies
Posted on 10/01/2011 10:49:23
Hi there,
If you just want to tell the time, take a look at the global date and time tags: http://templates.dynamicweb-cms.com/TemplateTags/Dynamicweb-template-tags/General-tags/Global-template-tags/GlobalServer.Date.aspx
Alternatively, you can create a notification subscriber. For an Intro, take a look here: http://devierkoeden.com/Articles/[CatId/1]/Notification-Subscribers.aspx
You can use something like this:
[Subscribe(Dynamicweb.Notifications.Standard.Page.OnGlobalTags)]
public class GlobalSessionTags : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
Dynamicweb.Templatev2.Template template = (args as Dynamicweb.Notifications.Standard.Page.PageviewNotificationArgs).Template;
template.SetTag("Global:Whatever", DateTime.Now);
}
}
And then use a template tag like this in your page:
<!--@Global:Whatever-->
Since Whatever is a DateTime, you get all the date time extensions for free: http://templates.dynamicweb-cms.com/TemplateTags/Dynamicweb-template-tags/General-tags/Date/time-tag-extensions.aspx
If all this doesn't help, I think you'll need to provide more information about what it is you want to accomplish.
Cheers,
Imar
If you just want to tell the time, take a look at the global date and time tags: http://templates.dynamicweb-cms.com/TemplateTags/Dynamicweb-template-tags/General-tags/Global-template-tags/GlobalServer.Date.aspx
Alternatively, you can create a notification subscriber. For an Intro, take a look here: http://devierkoeden.com/Articles/[CatId/1]/Notification-Subscribers.aspx
You can use something like this:
[Subscribe(Dynamicweb.Notifications.Standard.Page.OnGlobalTags)]
public class GlobalSessionTags : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
Dynamicweb.Templatev2.Template template = (args as Dynamicweb.Notifications.Standard.Page.PageviewNotificationArgs).Template;
template.SetTag("Global:Whatever", DateTime.Now);
}
}
And then use a template tag like this in your page:
<!--@Global:Whatever-->
Since Whatever is a DateTime, you get all the date time extensions for free: http://templates.dynamicweb-cms.com/TemplateTags/Dynamicweb-template-tags/General-tags/Date/time-tag-extensions.aspx
If all this doesn't help, I think you'll need to provide more information about what it is you want to accomplish.
Cheers,
Imar
Posted on 10/01/2011 11:17:42
Thanks for the quick reply. My problem is that our client have supplied us with some code, that they want to run on their server. We need to find out is that code can run on their DynamicWeb solution. Please contact me if you need more information.
mail: tom@innovisio.dk
mail: tom@innovisio.dk
Posted on 10/01/2011 11:18:26
I have attatched the code that our client wants to run on their DynamicWeb site.
Posted on 10/01/2011 12:44:58
Is this what they literally want? Or is this just a demo project to see if they can inject some code into a Dynamicweb page? The only thing the sample project does is output DateTime.Now.ToLongTimeString(); on a Literal in an ASPX page.
The way it's set up now, you can't directly use this code in a Dynamicweb page. Depending on what exactly they want to do, you can use the default Dynamicweb templates, or you can ask your client to create a NotificationSubscriber instead of an ASPX page.
Hope this helps,
Imar
The way it's set up now, you can't directly use this code in a Dynamicweb page. Depending on what exactly they want to do, you can use the default Dynamicweb templates, or you can ask your client to create a NotificationSubscriber instead of an ASPX page.
Hope this helps,
Imar
Posted on 10/01/2011 12:51:09
Thanks for the response. Thats exactly what I needed to know :)
You must be logged in to post in the forum