as a registered user you have some advantages like free downloads, comments and posting on our forums, depending upon this site's configuration and options.
Forums
Documentation
MAXdev Community
|
How To Create A Front Page Using pnHomeWe have received many requests in the forum about people wanting to have a similar frontpage as MAXdev by using several blocks. The secret lies in a small module that most MDP users ignore: pnHome. pnHome is composed of 3 files:
The only file worth an interest from us is pnuser.php. However, if you open this file you will see that it contains very little code:
Unless you know how to develops blocks and modules on MDPro, this is going to be of little help for most of us. The way around it is to use Autotheme and some blocks. For our example, we are going to create a page similar to the one on the MAXdev website but simplified:
The first "block" ("About MDPro") will be for us a short text introducing your website and written in HTML. The second part is a block showing the "10 latest stories published". Let's start. 1. Ok, this step is not essential and you can skip it, but I would recommend to copy your pnHome folder and rename it into something else (i.e. "frontpage") so that if you want to create several pages using pnHome, you'll always have the original to base them on. Now when you have renamed your folder into "frontpage", you will have to change the occurrences of pnHome inside the file frontpage/pnuser.php:
While you are in this file, you can also delete the following line (otherwise it will be displayed on your frontpage):
2. Go to your site administration and initialize / activate the module frontpage. 3. Go to you site administration / Autothemes / Autothemes / YOURTHEMENAME / Autoblocks.
NOTE: You can change the name and instead of having "Area9" you can have a more descriptive name (i.e. laststories). 4. Create an HTML template for your frontpage and call it "frontpage.html". A good way to start with is to use your default theme.html in your theme folder. Copy it and rename it, then customize it to suit your needs (ie remove the AT command ). Please be aware that you need to KEEP the AT Command otherwise you theme will not work. 5. Create an HTML template for your blocks. If you use a different template for each block, create one template per block. In our case, we will use the same and it's called "area.html". Again, a good way to start is to use one of your original block templates as a base. 7. Select a new custom module (i.e. "frontpage") and click "Add". 8. Edit this custom module by entering frontpage.html as your page template, select your template area.html for your blocks 8 and 9 and choose Yes to display these blocks:
11. Go back to your site administration / Autothemes / Autothemes / YOURTHEMENAME / custom modules and edit the module "*Homepage" to the same settings as for the module "frontpage" (see pic above). Save. 12. Done! You should now have your 2 blocks displayed on your homepage. You can obviously make much a better and complex frontpage. Now that you understand how to use pnHome and the areas of Autotheme, your imagination is the only limit! NOTE: I used some screenshots of the MAXdev site for teaching purpose only and the screenshots has been altered to simplify the procedure. There are many different ways to achieve the same results as the MAXdev website and the procedure detailled above is only ONE of them. NOTE2: If you have trouble to create HTML templates for Autotheme (frontpage.html and area.html), I recommend that you read the excellent tutorial on the AT website: NOTE3: This tutorial is based on my own limited experience of Autotheme so it may not be perfect. It worked for me though. If you have another method quicker or more efficient, please share it with the community and/or pm me via maxdev.com so I can edit this tutorial. Many thanks!
Tutorial created by Seb Hascoet |