Code Organization

Posts   
 
    
Cadmium avatar
Cadmium
User
Posts: 153
Joined: 19-Sep-2003
# Posted on: 17-Jul-2006 18:41:22   

Hi, me again simple_smile

I'm writting a variety of ltp templates using LogicCSharp. I find myself using the same code on a lot of pages. Is there a way to share this code across my templates so I dont have to include it every time?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Jul-2006 19:22:15   

Use include templates simple_smile Or you can use 1 template with methods you call from other templates. As lpt templates will be converted into classes with the templateid as name, you could use that to access the shared methods.

Frans Bouma | Lead developer LLBLGen Pro
Cadmium avatar
Cadmium
User
Posts: 153
Joined: 19-Sep-2003
# Posted on: 17-Jul-2006 21:27:08   

That got it. I had tried it before but didn't have it quite figured out. I have now put all of my common functions in their own lpt template and marked them all static.

Thanks simple_smile

Posts: 1255
Joined: 10-Mar-2006
# Posted on: 19-Jul-2006 15:59:24   

Cadmium, I was looking at doing a few templates. I quickly realized I was going to have to write a bunch of common functions to get the job done.

Would you mind sharing? Maybe create a standard set of common/useful functions to help with the templates.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 19-Jul-2006 16:18:20   

Another idea might be to add the methods you need to share among templates to a class in an assembly. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Cadmium avatar
Cadmium
User
Posts: 153
Joined: 19-Sep-2003
# Posted on: 19-Jul-2006 19:14:51   

WayneBrantley wrote:

Cadmium, I was looking at doing a few templates. I quickly realized I was going to have to write a bunch of common functions to get the job done.

Would you mind sharing? Maybe create a standard set of common/useful functions to help with the templates.

I wouldn't mind sharing, but the stuff I have is rather specific to what I'm doing, which is basically generating a crud site. And since I'm new to writing this stuff, probably not very well written. And what is there assumes a lot about the way the application is built. Besides, the most interesting functions I have so far I stole from the manager templates wink

I'm not trying to be super secretive or stingy or anything, but specifically I'm trying to build a better app than http://www.xlinesoft.com/asprunnerpro/

It outputs sh*t (classic) asp code that is impossible to work with (though I think in the latest version they've added code regions). My boss is too cheap_frugal_ to buy the .net version (which still probably sucks) or another app, so the only hope I have is to write something in house.

I have made some modifications to the project file task performer to better deal with aspx pages and codebehind, as well as a bare bones solution file task performer. Both are very hackey at this point though disappointed

*Full disclosure: I know generated crud sites are limited and stupid and suck and all of that and I know there are other website code generators out there (IronSpeed,Codecharge, etc) and I'm probably wasting my time simple_smile

Otis wrote:

Another idea might be to add the methods you need to share among templates to a class in an assembly. simple_smile

I may have to try that as I'm getting more comfortable working with this stuff.