A Suggestion From A Developer To a Developer

Forum
Last Post
Threads / Messages

HIddenPanda

Premium Member
Premium Member
Joined
Jul 15, 2010
Messages
61
Points
8
Mysidian Dollar
3,655
Take This:
PHP:
// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme
$file = $themeurl;

// Do the template changes and echo the ready template
$template = file_get_contents($file);

$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);

$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);

//Define our links

if($cancp == "yes"){

//Admins see a custom set of links here...

$links = getadmlinks();

}
else{

$links = getlinks();

}

$template = replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...

$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);

//Get the ad content...
$template = replace(':ADS:',$ads,$template);

//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);


echo $template;

// **********************************************************************
// End Template Definition
// **********************************************************************
And Put it into a file called inc\templatedefn.php

So that way instead of the above in EVERY SINGLE FILE... we just have:
PHP:
include('inc\tempdefn.php');
at the end of the file :D

This is mainly directed towards HoF and the other Dev Staff

This also makes it alot easier for people who want to add elements to their pages
 
Thank you for your suggestion. Arianna has been doing this kind of stuff for the next release Mys v1.2.0, as you will soon see.
 
Cool, I just remembered it from when I wanted to write a little news ticker mod but didn't want to make all of the people who wanted to install it go through every single page to insert one little line of code. This way you just add it to this page and the actual template and voila :D
 
Ooh, I'll see if that makes my problems go away. :)

A news ticker wouldn't be that difficult to add I think.

I've done it in templates with little problems.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,119
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top