gpEasy File Inclusion Tutorial

Note: gpEasy 2.x introduces sections into the content area (see the creating pages tutorial). Therefore, you no longer need to use this type of file inclusion as you can do it via a section. However, if you wish to use this type of file inclusion--maybe you want to format in a way that a File Inclusion secion can't be--it still works.

File Inclusion is a simple way to add a page or gallery within another page in gpEasy simply by adding its name/label or page slug/URL. I use it considerably on this site especially for the pictorial tutorials. Those tutorials are a page with a gallery included via File Inclusion.

How does it work?

Simply put the page's name/slug/URL between {{}}.
Example: {{File Name Page Slug Here}}

Basically you only have to use the name of the file if it is the same as the slug/URL. Example: This page's file name is "File Inclusion" and the slug/URL is "File_Inclusion"--that's the gpEasy generated slug/URL thus I can use either File Inclusion or File_Inclusion between {{}} to call this page within another page.

As long as you are using a gpEasy generated slug/URL, like File_Inclusion, then you don't need to include the underscores of the page's URL. Therefore, File Inclusion and File_inclusion placed between {{}} would act the same. However, if I gave this page a unique slug/URL like "File-Inclusion" then I would have to place that between the {{}} instead of the page's name, "File Inclusion."

The best practice is to ALWAYS use a file's slug/URL for the file inclusion.

Sorry I'm not able to give better examples here but if I actually give a valid example it will work and include the page. So head on over to the gpEasy Documentation Wiki for my writeup there on file inclusion if this didn't give you enough clarity.

Once you get used to using file inclusion you will use it more and more. There is one problem that may arise for you. When you use file inclusion before the end of a page and include a gallery your page's text may wrap the gallery. To prevent this add <div style="clear:both;"></div> after the file inclusion. This will clear the included file from the page's content.

What is a "page slug?"

A page slug is the URL friendly version of a file name. It is the relative path of any file without the '/' at the beginning. In the above example the file "File Inclusion" in gpEasy by default has the page slug/URL of "File_Inclusion" - this is generated automatically by gpEasy.

Notice the added underscore (_) where there was a space. This makes the file name URL "friendly." The relative path of that file is /File_Inclusion while the absolute path would be
In other words, the page slug is the part of the URL that specifies the file and only the file thus excludes the domain and/or install directory.


gpEasy B2sq Theme by CS @True Acupuncture