Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
Different templates for pages
Today I was curious about creating a landing page for Wild Souls, but I wanted it to have a different appearance than the usual site layout. After some research and experimenting, I now present this tutorial!
-Step 1- You’re going to need to open class_template.php and scroll down to the function “assigntemplateVars”. Add this string of code underneath the other assigned variables: PHP Code:
-Step 2- Now go to the folder of the theme you are currently using and make a new tpl file. It can be called whatever you like, but for the sake of this tutorial I’ll call it “landing.tpl”. Open it up and add in the HTML of your desired layout (including body tags). Here is an example of mine: HTML Code:
<body class='text-center' style='background-image: none;'> <div class=' cover-container d-flex w-100 h-100 p-3 mx-auto flex-column'> <header class='masthead mb-auto'> <div class='inner'> <h3 class='masthead-brand'>{$document_title}</h3> <nav class='nav nav-masthead justify-content-center'> <a class='nav-link active' href='#'>Home</a> <a class='nav-link' href='#'>Features</a> <a class='nav-link' href='#'>Contact</a> </nav> </div> </header> <main role='main' class='inner cover'> <p class='lead'>{$document_content}</p> </main> <footer class='mastfoot mt-auto'> <div class='inner'> <p>Cover template for <a href='https://getbootstrap.com/'>Bootstrap</a>, by <a href='https://twitter.com/mdo'>@mdo</a>.</p> </div> </footer> </div> </body> Now the good part! Take a look at this string of code here: PHP Code:
Now, here is the basic skeleton of how your template.tpl file should use that code: HTML Code:
{include file="{$root}{$temp}{$theme}/header.tpl"} <!-- User is on the landing page --> {if $page_name == 'index' || $page_name == ''} {include file="{$root}{$temp}{$theme}/landing.tpl"} {else} <!-- User is NOT on the landing page --> <body> <!-- Usual template html goes here... --> </body> {/if} </html>
__________________
|
|
|
What's New? |
What's Hot? |
What's Popular? |