Skip to main content
Home
Blog

Main navigation

  • Home
User account menu
  • Log in

Breadcrumb

  1. Home
  2. MosModule FAQ

MosModule: How to use snippet?

By ongetc , 4 October, 2009

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!

Book traversal links for MosModule FAQ

  • MosModule: How to show contact form in content?
  • Up
  • MosModule: Show MosCom latest 5?
  • Printer-friendly version

Reseller hosting (free)

Hosting24 (w/ ssh)

A2 Hosting

Monthly archive

  • September 2009 (14)
  • October 2009 (11)
  • January 2010 (2)
  • June 2010 (3)
  • October 2011 (1)
  • March 2012 (1)
  • July 2012 (1)
  • February 2017 (564)
  • March 2017 (5)
  • April 2017 (2)

Pagination

  • 1
  • Next page

Popular content

Last viewed:

  • CPAINT
  • Core Enterprise PHP
  • flatCMS
  • eAdmin
  • CDAY PHP
  • MosModule: How to embed video in content?
  • Google Domains Registration
  • SciTE
  • @-Tension CMS
  • YaPiG

User login

  • Reset your password