Create a Custom Dynamic PHP Page on AV Arcade Script

PHP LogoNote: This guide shows the exact steps for AVArcade 3 script, but if you understand the idea you could apply similar changes to other versions of AVArcade or even to completely different PHP softwares.

I run an arcade website using AVArcade software & wanted to add a custom page with some text in it, I could have done that using plain HTML but the page would have been rigid & kinda fake, even if I made it look like the other pages, there’s data in the sidebar & navigation menus that is supposed to update itself & if I decided to edit the theme of the site I’d have to do the job again for my custom page.

So the best was to be able to create a page that is just like the other pages created by the script, a dynamic PHP page.

I’m not a PHP geek, I’m very careful when messing with PHP files, but I managed to track some codes from file to file inside the script & finally found the way to create just what I wanted, here’s how I proceeded (you really don’t need any PHP knowledge to do this):

Note: Backup the files we’ll modify in case anything goes wrong!

1. Create a new PHP file

Can be just a simple text file with .php extension or formatted using HTML tags & CSS. In this file you will write the content you want in the body of your future page; if you want a page containing an article for example, just write the article, nothing else. Name the file article.php for example. Then upload it to your server in the folder named “content”.

2. Create a task to load the file you created

Don’t worry, this is simple, open a file called content.php you can find in the “content” folder, you will find several code sequences like these two:

if ($_GET[task] == ‘login’) {
include (‘login.php’);
}
else if($_GET[task] == ‘register’) {
include (‘register.php’);
}

Those sequences define tasks, for example in the 1st 3 lines above the task login will show in a URL like this: /index.php?task=login & will ask the script to load the file login.php

After those tasks we will create a new one for our new file (article.php if you want):

else if($_GET[task] == ‘my_great_article‘) {
include (‘article.php’);
}

Save content.php & upload it. The page was created! We just will make it better in the next step!

3. Create a title / title tag for your page

To do that, open a file named content_title.php in the “modules” folder, this time you will find code sequences like these two:

if($_GET[task] == ‘login’) {
echo ‘Login';}
else if($_GET[task] == ‘register’) {
echo ‘Register';}

Remember the task we created to call the article.php ? We will use it to call the & display title this time (be careful where to insert the code, better after the last task):

else if($_GET[task] == ‘my_great_article‘) {
echo ‘My Great Article';}

OK, now save & upload your file!

4. Create the URL of your page!

Simple, the URL will be http://www.yourarcadesite/index.php?task= followed by the name of the task which is in our example my_great_article

http://www.yourarcadesite/index.php?task=my_great_article

Note that unlike other pages, I couldn’t use the SEO friendly version of the page even with SEO friendly URLs feature enabled, I didn’t take a look at the issue because frankly I couldn’t care less, I have my cool dynamic flexible custom PHP page that’s all what matters!! :p

4. Extra: Track & understand the codes!

Now if you want to know more on how that works (to make a custom page for a different software maybe) you can see how the content.php & content_title.php are called by opening the index.php file in your theme’s folder (not the one in the root) & reading its code.

content_title.php is called in the header section for the title tag & then for the title in the body.

content.php is called in the body of the page & is responsible of the main content of any page on the site, when this file is read by the script & depending on the task (in the URL), a specific file will be loaded.

The codes in index.php look a bit like this:

<? include(‘./modules/content_title.php’); ?>

<? include (‘./content/content.php’); ?>

Usually they are wrapped by HTML tags or other PHP codes.