cyclone200
cyclone200

Reputation: 387

How to make Wordpress-like templates?

I'm building my site without CMS and I want for my articles to chose from several templates that I'll build later.

But I don't see how to do this.

I mean, let's say that I have template01.php, template02.php. How can I retrieve these templates?

The only way I found is to put all the templates in my index.php (in the /articles/ folder which is the equivalent of single.php in WP) and make conditions like these:

if($template==01) {
    TEMPLATE 01
} elseif($template==02) {
    TEMPLATE 02
}
...

Do you have an idea how to use this with separate files?

What I don't understand is : if I go to www.mysite.com/article/a-very-cool-article/, how it will show the article with the second template instead of the first template?

I hope that I was understandable...

Thank you very much for your help!

Best regards, C.

Upvotes: 0

Views: 43

Answers (1)

Goddak
Goddak

Reputation: 59

Surely activating the variable on the individual page will activate your template.

I.e. adding the line;

var $template == 01

or

var $template == 02

to the articles you wish to use template 1 or 2 would return whatever conditions you have stipulated in your IF statement.

Upvotes: 1

Related Questions