Main

File Inclusion

Want to put a gallery inside of a normal page? Here's how...

  1. Edit the file you want the gallery to be in.
  2. Type {{NAME_OF_INCLUDED_PAGE}} where NAME_OF_INCLUDED_PAGE is the name of the gallery or page you want to include.
  3. Save


Discussion

File inclusion only works for those pages created by gpEasy and saved in the folder \data\_pages\

Currently file inclusion does not work with the blog & forum plugins.

The "name" of the file as of gpEasy 1.7a3 can be either the page slug or name of the file depending on that page's particular "details."

Some examples will help to clarify this.

Example 1: when page slug is NOT defined

  1. Create a new file/page named "Test Inclusion" edit the page, add some text to it, and then save it.
  2. Now edit a different page and add {{Test Inclusion}} or {{Test_Inclusion}} - notice that the underscore is not required.
  3. Save the page and you should see the text from the "Test Inclusion" page within the page you just added it to.


Example 2: when page slug IS defined

As of gpEasy 1.7 you have the ability to define the 'page slug' for any file/page via file manager->rename/details->more options->page slug 'edit.' Because of this the file inclusion 'name' for the page is really the page slug.
  1. In the file manager click the 'rename\details' for the "Test Inclusion" page we created above.
  2. Click the 'more options' button on the dialog that pops up.
  3. Click 'edit' below 'page slug'
  4. Enter a different page slug, enter "Test-Inclusion" and save the changes.
  5. Go to the page you inserted the file inclusion into in example one. You should see {{Test Inclusion}} or {{Test_Inclusion}} depending on which you entered. You won't see the actual page's text for the page "Test Inclusion" because we changed the page slug.
  6. Now edit that page and change the file inclusion to {{Test-Inclusion}} and save the page.
  7. You should now see the page's text again.


It is very important to keep this in mind when defining the page slug for files and using file inclusion. It is always the safest bet to simply use the page slug of the file you wish to include in another page. Simply open the file you wish to include and copy the page slug and paste that in-between {{}} in the page you want it to appear.

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 "Test Inclusion" in gpEasy by default has the page slug name of "Test_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 /Test_Inclusion while the absolute path would be http://domain/Test_Inclusion
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.



Last modified 12:34 Sat, 14 Aug 2010 by Strodtbeck. Accessed 1,255 times Children What Links Here share Share