Jump to content
xisto Community
alex1985

Template Chooser?

Recommended Posts

Hi, do you know any tutorials that is somehow is dedicated to creating kind of templates for your web-site?!Let's say when a user goes to his or her profile there will a button which is called "Choose Template", for instance, after that the templates of your web-site stored on your server, will become active. This is the first point.The second thing, how can I make the templates generally? With respect to font, alignments, buttons, other graphics or even hide some buttons or functions of the web-site?

Share this post


Link to post
Share on other sites

Well I would assume the PHP include funtion has something to do with it which I suppose would change the look of the site whilst keeping the text the same. I don't know of any tutorials but you will probably find some here [HERE]

Share this post


Link to post
Share on other sites

This is an interesting prospect, and I played with it for quite some time. In the end, I realised that most people won't stay long enough to change themes so it wouldn't matter so much.

There's a few ways to do it. I went and made a page, then put php include tags everywhere. For example,

<?php include ("pages/news.php"); ?><?php include ("pages/home.php"); ?>
These contained the raw data for the pages. Using variables in the url, I was able to change theme and page according to what the user wanted.

Share this post


Link to post
Share on other sites

Hi, do you know any tutorials that is somehow is dedicated to creating kind of templates for your web-site?!

There are loads of ways to make a template for your site, depending on what sort of template you are looking for. You can go from a simple HTML/CSS page with PHP just used to add dynamic content, to a full-blown template engine, such as Smarty or the one included in the Zend Framework. Or, you can go for something between the two, sort of writing your own mini template engine specifically for your site. Until you know which you want to do, it is very hard to recommend tutorials.

Let's say when a user goes to his or her profile there will a button which is called "Choose Template", for instance, after that the templates of your web-site stored on your server, will become active. This is the first point.

Store in the database a list of themes, along with the information that allows you to load each one (the path to a CSS file for example). Then, along with your user data, store the user's preference for a theme. Then, in your template, look up what theme the user wants, and load the relevant files.

The second thing, how can I make the templates generally? With respect to font, alignments, buttons, other graphics or even hide some buttons or functions of the web-site?

Font, alignment, images and all page layout factors are controlled by CSS.
Hiding buttons and features would use PHP and some sort of permissions system to determine who has access to which parts of the site.

Share this post


Link to post
Share on other sites

Wait, many templates are actually based on CCS. Do you know anything about this issue?

I presume you mean CSS? CSS stands for Cascading Style Sheets, and they determine the look and position of HTML elements on screen. Such things as colour, width, height, fonts, etc. I suggest you search for some CSS tutorials to learn how CSS works, and makes your templates much easier to work with.

Share this post


Link to post
Share on other sites

I use Adobe FireWorks when I make my website's templates. It is fast and easy to do, because it doesn't take that long to learn. It isn't exactly free (about $300-500) but Adobe offers a 30 day trial on their website. Once finished making the template I put it in Microsoft Expression Web to code it and add functionality to it so it is more than just a JPEG.

Share this post


Link to post
Share on other sites

Seems this topic is in a PHP category and the topic is about template chooser? So I guess I can add a bit about this issue, even though it might be off topic :DCreating a template choose with PHP can be made in several ways, the easiest would be to have a folder named templates, and in that folder to have different folders for template names, like default, ocean blue, red minimalistic and etc. In those folder there might be standard template files with html, header, footer, menu, sidebar, content, error pages and maybe even images.From a DB, or a cookie, you can get a value which the user has selected, and include the template which is selected. The template system which will create the html from your files is a different story.Personally, for my templating system, I'm using output_buffering, ob_start() function, because it's easy to manipulate the template using it by replacing required keywords with the needed data, especially if your templates/cms is multi-language. :)for example, you can put in template files: {title},{description} and your CMS could replace it with data from DB with the required value on the selected language. :(

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.