gpEasy's PHP Include Function

gpEasy CMS has a built in PHP include function to make it easier to include a php file.

The Function is very simple, includeFile(). That's it! But what does it mean and how do I use it?

It's used to call another php file into your theme. For Example, on this site I use it to include a php file that checks the browser type coming to the site and if it's Internet Explorer it redirects them to a page that asks them to use a better browser. . . That's not very nice is it? Well, MS hasn't been very nice with IE over the years and I feel it's time to support the open source browsers and web standards. Anyways, here's how I call the redirect.php page into my theme.

<?php includeFile('../themes/redirect.php'); ?>
Is placed at the beginning of the theme because that's where I need the php page called to work properly. You can see that I'm using a relative path. That's because the root of the  includeFile() function in gpEasy is the /include/ folder; therefore, I need to tell gpEasy that the file I want is one level higher than the root and in the /themes/ folder.

If I had put my redirect.php in the include folder then I wouldn't need anything in the path other than "ie_redirec.php"

However, that's not the best place to be putting files since I tend to delete the /include/ folder when I upgrade.

That's all there is to it. Instead of using the regular php include function use gpEasy's to make it easier on yourself.

I like the short ones. . . go to the gpEasy tutorials for more.

 

gpEasy B2sq Theme by CS @True Acupuncture