MosModule: How to use snippet?

What is snippet?

Snippet is just php code that MosModule will execute just like you put php in your article but without all the php intermix inside your article. It turn your article into php program! Another words snippet is inline PHP code but nicely file away and just reference it with an article ID.

How to use snippet?

First you just need to create a content that you can put your php code in it but without < ?php ? > and give it a name and take note of the article ID.

Then in the article that you want to use snippet just do something like this:

{mosmodule snippet=ArticleID}

You can call as many snippet as you want just like you would with php function but in this case it is more of a block of php code that you want to run in your content.

The thing that you need to be aware is that all your variables that executed in any snippet will be available through out your content.

What is that mean, it mean you can define function in any of the snippet that you execute prior in the later snippet calling!

You can even add some HTML code in your article to wrap around your snippet if your snippet output something! This will help to do code and design separation!

It is open for all kind of possibilities!