Developer forum

Forum » Development » more than one custommodule dll

more than one custommodule dll


Reply

hello




 






What do we do when a customer already has custommodules and we want to add another Custommodules.dll to the solution?


Replies

 
Nicolai Høeg Pedersen
Reply
ralf@fonqi.dk wrote:


hello








What do we do when a customer already has custommodules and we want to add another Custommodules.dll to the solution?





Hi Ralf


 


This will be officially available in the update package later this week. It already works though.


 


Create a normal custom modules solution and rename the Root namespace and the dll to something else than CustomModules, i.e. fonqi.modulename.


 


The object that is usually called from Default.aspx.vb in the CustomModuleEventhandler should be done like this:


 


Imports Dynamicweb


Imports Dynamicweb.Extensibility


 


_


Public Class Frontend


    Inherits Dynamicweb.ContentModule


    Public Overrides Function GetContent() As String


        Return "Hello from page " & Me.Pageview.ID & Me.Properties.Value("SomeField")


    End Function


End Class


 


AddInName is your systemname. This way Dynamicweb will automatically initialize the properties and pageview object and the GetConten will be called.


 


With this solution you dont have to do things in Default.aspx.vb/cs.


 


Upload your assembly, Fonqi.ModuleName.dll next to the existing /Bin/CustomModules.dll and copy /CustomModules/ModuleName/*.* to the solution.


 


Hope this makes sence...

 
Reply

 


Hi I' trying to implement this for the first time and I've got a few questions.


I'm programming in C# So I tried translating the VB code to the best of my abilities.


 


1. I get a compile error when I try to add this addinname prefix:


 


Error    1    A namespace does not directly contain members such as fields or methods  


 


----------------------------------------------------


 


2. How do I add the namespace to the solution?


 


"... copy /CustomModules/ModuleName/*.* to the solution."


----------------------------------------------------


 


otherwise my frontendclass looks something like this


 


using Dynamicweb;

using Dynamicweb.Extensibility;


 


namespace FonqiModules.VideoModule


{


    public class VideoModule:Dynamicweb.ContentModule

    {


        public string GetContent(DataRow paragraphRow, Dynamicweb.Frontend.PageView pageView)

        {


            //do your thing


        }


    }


}

 


Does this look plausible?


 


-Sune Fengel

 
Nicolai Høeg Pedersen
Reply
sune@fonqi.dk wrote:


 




Hi I' trying to implement this for the first time and I've got a few questions.




I'm programming in C# So I tried translating the VB code to the best of my abilities.




 




1. I get a compile error when I try to add this addinname prefix:




 




Error    1    A namespace does not directly contain members such as fields or methods  




 




----------------------------------------------------




 




2. How do I add the namespace to the solution?




 




"... copy /CustomModules/ModuleName/*.* to the solution."




----------------------------------------------------




 




otherwise my frontendclass looks something like this




 




using Dynamicweb;



using Dynamicweb.Extensibility;




 




namespace FonqiModules.VideoModule




{




    public class VideoModule:Dynamicweb.ContentModule



    {




        public string GetContent(DataRow paragraphRow, Dynamicweb.Frontend.PageView pageView)



        {




            //do your thing




        }




    }




}



 




Does this look plausible?




 




-Sune Fengel





 


Hi Sune


is [AddInName("Something")] in C#. GetContent does not have any parameters - so remove paragraphrow and pageview. They can be found in the base class using this.Pageview, this.Paragraphrow and this.Properties. Download /RC2008-01/CustomModulesCsharp.zip from the download page for an example.


 


2:


If you rename your solution from CustomModules, right click, chosse properties and change the name of the root namespace. Then make all you webforms work with this new root namespace, and copy your assembly to the /Bin directory and the .aspx files to /CustomModules/ModuleName/*.*. The .aspx files will reference your assembly due to the @page directive found it top of every .aspx page.


 


 

 

You must be logged in to post in the forum