Feed
Google+
Contact
XING
LinkedIn
Twitter
ICQ
meebo.com

write my macros dasBlog-

by Roland Schumacher alias GENiALi 6. August 2007 -- 1074 words  -- 1 mal gelesen

The dasBlog allows one to write your own macros.
A file Macros.cs (in the project newtelligence.DasBlog.Web.Core) exist in the source code of dasBlog.
There are macros in it which brings dasBlog of House. There his own Makors
place is not sent. Therefore you can his macros
create in its own project and then integrate the dasBlog.

The original postings there to here and here (both EN) find.

First you must get dasBlog so that access to a few
DLL's has. Can you download the dasBlog at SourceForge. Note
that take the dasBlog XX Source.zip file.

After you created a new class library project in Visual Studio.
How you want to name the project I leave yourselves.

Next, you must add a few DLL's as references.
You click on references in Solution Explorer, select on the shortcut menu
From the Add reference .

Which is the first reference to System.Web. For me it is the version 2.0.0.0 because
I work with Visual Studio 2005 and by the .NET Framework 2.0 is installed.

Then you have still the two DLL's from the dasBlog bin folder reference.
You must search according to the installation folder itself. That would then
the DLL newtelligence.DasBlog.Web.Core.dll and newtelligence.DasBlog.Runtime.dll.

So you would have registered all DLL's. The folder should now
References in similar to this.

Then can or must to finally deal with the code itself. :-)
I would adjust a few things.

  1. The class Class1 renamed in macros or MyMacros or...
  2. Just what meaningful.
  3. Customize the namespace.
  4. I will from the namespace MyDasBlogMacro
    GENiALi.MyDasBlogMacro. Simply not like in the example.
  5. In the project properties to create even a post-build event.
  6. xcopy "$(TargetDir)GENiALis*.*" "E:\Dev2005\dasBlog\source\newtelligence.DasBlog.Web\bin" / Y"
    The statement copied me all the assemblies in the bin directory of the dasBlog Web folder.

Now you can write code so much you want. I here simply copy the original example of
dasBlog purely. To refer to the "DasBlog ALL" solution. The project is called FooMacroPlugin.

   1:  using System;
   2:  using System.Web;
   3:  using System.Web.UI;
   4:  using newtelligence.DasBlog.Runtime;
   5:  using newtelligence.DasBlog.Web.Core;
   6:  
   7:     / / In your web.config, you need to create a mapping between a name and
   8:     / / the .NET type that handles it
   9:     //
  10:     / / web.config:
  11:     //   
  12:     / / < configSections >
  13:     / / < section name = "newtelligence.DasBlog.Macros" type = "newtelligence.DasBlog.Web.Core.MacroSectionHandler, newtelligence.DasBlog.Web.Core" / >
  14:     / / < / configSections >
  15:     / / < newtelligence.DasBlog.Macros >
  16:     / / <!-the format for a QN is TypeName, AssemblyName.
Do NOT include the .dll extension. --
  17:     / / < add macro = "foo" type = "FooMacroPlugin.FooMacros, FooMacroPlugin" / >
  18:     / / < /newtelligence.DasBlog.Macros >
  19:     // 
  20:     / / Then your macro DLL would go in your \bin folder.
If you need to debug, include your PDB files.
  21:     //
  22:     / / Within your homeTemplate.blogtemplate or itemTemplate.blogtemplate you'd like this. use the macro
  23:     / / They are not fully supported in dayTemplate.blogtemplate
Be aware.
  24:     //
  25:     / / < %TestControl("here_is_some_text") |foo % >
  26:     / / < %TestControlWithinEntry()|foo% >
  27:     //
28:   
  29:  namespace FooMacroPlugin
  30:  {
  31:     / / / < summary >
  32:     / / / This is an example of how to write a custom macro
  33:     / / / < / summary >
  34:     public class
  35:     {
  36:        protected SharedBasePage requestPage;
  37:        protected entry currentItem;
  38:  
  39:        public FooMacros(SharedBasePage_page,_Entry_item)
  40:        {
  41:           requestPage = page;
  42:           currentItem = item;
  43:        }
  44:  
  45:        //be sure to check and see that currentItem and / or requestPage are emergency NULL before you use them!
  46:        public virtual control TestControl(string_text)
  47:        {
  48:           return new LiteralControl("There_are_"_+_requestPage.WeblogEntries.Count  "_entries_on_this_page");
  49:        }
  50:  
  51:        //be sure to check and see that currentItem and / or requestPage are emergency NULL before you use them!
  52:        public virtual control TestControlWithinEntry()
  53:        {
  54:           return new LiteralControl("The_Title_of_this_entry_is_"_+_currentItem.Title);
  55:        }
  56:  
  57:     }
  58:  }

You can access various information about the dasBlog with requestPage currentItem.
Here is just a little research.

Examples:
int itemCount = sharedBasePage.WeblogEntries.Count;
Returns the number of entries on the page one.

currentEntry.Content
To get the contents of the entry with all HTML's.

content = Utils.FilterContent (currentEntry.EntryId, content);
The utils class is also useful. If I get the content with currentEntry.Content
is everything so in it like in HTML. Then, the smileys are converted graphics.
When I run the content filter leave but already.

There are many things you will find. The macros are useful
Macros.cs (in the project newtelligence.DasBlog.Web.Core) file. There can be much abschauen and learn.

If the macro as desired work you must embed it yet. Oh well. First
You must include it in the web.config / enable you ever test
can. There are two things you have to change.

1. Execution of macros allow.

1: < section name = "newtelligence.DasBlog.Macros" type = "newtelligence.DasBlog.Web.Core.MacroSectionHandler, newtelligence.DasBlog.Web.Core" / >

This line is commented out normally. Without which nothing will work.

2. The own macro to register

   1:     < newtelligence.DasBlog.Macros >
   2:        < add macro = "GENiALi" type = "GENiALis.dasBlog.Macros.Macros, GENiALis.dasBlog.Macros" / >
   3:     < /newtelligence.DasBlog.Macros >

Here is there a name the macro class. He is still needed. < add macro = "GENiALi"
The type is as follows. type = "namespace + class name, namespace".

Now it comes the macro in the dasBlog only assemble. Depending on where the macro is active
to it must be placed in the homeTemplate.blogremplate or itemTemplate.blogtemplate.

The call is for example: look.

1: < %GetItem ("themes/directionalredux/item/Empfehlung.item" true false [next item]) |GENiALi % >

GetItem is the name of the method. The rest are simply parameter passed to the method.
In the end, that |GENiALi, is the same as < add macro = "GENiALi". Now is clear what the name.

According to which everything should now work smoothly. If no one helps further the debugger.
You can write also to the event log of dasBlog. To do that as follows.

   1:  catch(Exception ex)
   2:  {
   3:  an error occurred while processing the GetShortCurrentEntry < br > < br > < br > < br > string string     . format ({0} currentEntry.Link);
   4:  (    sharedBasePage.LoggingService.AddEvent(newstring.Empty));
   5:  }

Here is a list of related links.
dasBlog - new URL to the source code
dasBlog 1.9 source code download
-dasBlog 1.9 compile with Visual Studio 2005
Create Macro (dasBlog homepage)
Creating custom macros for dasBlog (the original)
DasBlog Macros (description of that dasBlog already brings)

-Vasanth 14 "Extra" macros
-John Forsythe "My DasBlog themes and macros"

Tags: ,

It runs: alter bridge - One Day Remains - the find real


Tags:

Kommentare sind geschlossen

Statistik

Gesamte Posts: 1025
Dieses Jahr: 7
Diesen Monat: 1
Diese Woche: 0
Kommentare: 929
Total Bewertungen: 91
Ø Bewertung: 4,42
Meisten Kommentare
Google+ ... (28)
Beste Ø Bewertung
Tastaturlayout von Visual Stud ... (5)
Meiste Bewertungen
Windows 7 und die ersten Erfah ... (5)

Buttons

Stop Spam Harvesters, Join Project Honey Pot Benutzerprofil von GENiALi connection speed test network connection Bloggeramt.de Slug.ch Blog Verzeichnis und Blog Webkatalog Schumacher Roland Seitwert Valid XHTML 1.0 Transitional

writing